@alipay/ams-checkout 0.0.1758505806-dev.5 → 0.0.1758607092-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -240,16 +240,41 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
|
240
240
|
}, {
|
|
241
241
|
key: "updateMaskCloseBtn",
|
|
242
242
|
value: function updateMaskCloseBtn(data) {
|
|
243
|
-
var
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
243
|
+
var CLOSE_BUTTON_OFFSET_Y = 40;
|
|
244
|
+
var amsComponentContainer = document.getElementById(COMPONENT_CONTAINER_ID);
|
|
245
|
+
var maskCloseBtn = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID);
|
|
246
|
+
if (!maskCloseBtn) return;
|
|
247
|
+
|
|
248
|
+
// Position relative to container, more accurate
|
|
249
|
+
var updateRelativeToContainer = function updateRelativeToContainer() {
|
|
250
|
+
if (!amsComponentContainer || !maskCloseBtn) return;
|
|
251
|
+
var rect = amsComponentContainer.getBoundingClientRect();
|
|
252
|
+
var top = rect.top - CLOSE_BUTTON_OFFSET_Y;
|
|
253
|
+
var left = rect.left + rect.width - maskCloseBtn.offsetWidth;
|
|
254
|
+
maskCloseBtn.style.top = "".concat(top, "px");
|
|
255
|
+
maskCloseBtn.style.left = "".concat(left, "px");
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// Position relative to window (Old logic)
|
|
259
|
+
var updateRelativeToWindow = function updateRelativeToWindow() {
|
|
260
|
+
if (!maskCloseBtn) return;
|
|
261
|
+
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
262
|
+
var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
263
|
+
maskCloseBtn.style.top = "".concat((windowHeight - data.height) / 2 - 42, "px");
|
|
264
|
+
maskCloseBtn.style.right = "".concat((windowWidth - data.width) / 2 + 18, "px");
|
|
265
|
+
};
|
|
266
|
+
if (amsComponentContainer) {
|
|
267
|
+
updateRelativeToContainer();
|
|
268
|
+
var events = ['animationend'];
|
|
269
|
+
events.forEach(function (event) {
|
|
270
|
+
var handler = function handler() {
|
|
271
|
+
updateRelativeToContainer();
|
|
272
|
+
amsComponentContainer.removeEventListener(event, handler);
|
|
273
|
+
};
|
|
274
|
+
amsComponentContainer.addEventListener(event, handler);
|
|
275
|
+
});
|
|
276
|
+
} else {
|
|
277
|
+
updateRelativeToWindow();
|
|
253
278
|
}
|
|
254
279
|
}
|
|
255
280
|
}, {
|