locizify 9.0.10 → 9.0.11
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.
- package/CHANGELOG.md +4 -0
- package/dist/umd/locizify.js +24 -6
- package/dist/umd/locizify.min.js +2 -2
- package/example/simple/package.json +2 -2
- package/locizify.js +24 -6
- package/locizify.min.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/umd/locizify.js
CHANGED
|
@@ -9592,11 +9592,18 @@
|
|
|
9592
9592
|
popup.style.setProperty('left', "calc(".concat(popup.style.left, " - ").concat(_diff, ")"));
|
|
9593
9593
|
popup.style.setProperty('width', containerStyle.width);
|
|
9594
9594
|
}
|
|
9595
|
-
|
|
9596
|
-
|
|
9595
|
+
var MIN_VISIBLE = 40;
|
|
9596
|
+
if (storedPos && typeof storedPos.top === 'number' && containerStyle.height) {
|
|
9597
|
+
var maxTop = Math.max(0, window.innerHeight - MIN_VISIBLE);
|
|
9598
|
+
var top = Math.max(0, Math.min(storedPos.top, maxTop));
|
|
9599
|
+
popup.style.setProperty('top', top + 'px');
|
|
9597
9600
|
}
|
|
9598
|
-
if (storedPos && storedPos.left
|
|
9599
|
-
|
|
9601
|
+
if (storedPos && typeof storedPos.left === 'number' && containerStyle.width) {
|
|
9602
|
+
var width = parseInt(containerStyle.width, 10) || 0;
|
|
9603
|
+
var minLeft = Math.min(0, MIN_VISIBLE - width);
|
|
9604
|
+
var maxLeft = Math.max(0, window.innerWidth - MIN_VISIBLE);
|
|
9605
|
+
var left = Math.max(minLeft, Math.min(storedPos.left, maxLeft));
|
|
9606
|
+
popup.style.setProperty('left', left + 'px');
|
|
9600
9607
|
}
|
|
9601
9608
|
}
|
|
9602
9609
|
}
|
|
@@ -11708,6 +11715,17 @@
|
|
|
11708
11715
|
};
|
|
11709
11716
|
}
|
|
11710
11717
|
|
|
11718
|
+
var MIN_VISIBLE = 40;
|
|
11719
|
+
function clampTop(top) {
|
|
11720
|
+
var max = Math.max(0, window.innerHeight - MIN_VISIBLE);
|
|
11721
|
+
return Math.max(0, Math.min(top, max));
|
|
11722
|
+
}
|
|
11723
|
+
function clampLeft(left, el) {
|
|
11724
|
+
var width = el.offsetWidth || 0;
|
|
11725
|
+
var min = Math.min(0, MIN_VISIBLE - width);
|
|
11726
|
+
var max = Math.max(0, window.innerWidth - MIN_VISIBLE);
|
|
11727
|
+
return Math.max(min, Math.min(left, max));
|
|
11728
|
+
}
|
|
11711
11729
|
function initDragElement() {
|
|
11712
11730
|
var pos1 = 0;
|
|
11713
11731
|
var pos2 = 0;
|
|
@@ -11751,8 +11769,8 @@
|
|
|
11751
11769
|
pos2 = pos4 - e.clientY;
|
|
11752
11770
|
pos3 = e.clientX;
|
|
11753
11771
|
pos4 = e.clientY;
|
|
11754
|
-
elmnt.style.top = elmnt.offsetTop - pos2 + 'px';
|
|
11755
|
-
elmnt.style.left = elmnt.offsetLeft - pos1 + 'px';
|
|
11772
|
+
elmnt.style.top = clampTop(elmnt.offsetTop - pos2) + 'px';
|
|
11773
|
+
elmnt.style.left = clampLeft(elmnt.offsetLeft - pos1, elmnt) + 'px';
|
|
11756
11774
|
}
|
|
11757
11775
|
function closeDragElement() {
|
|
11758
11776
|
startMouseTracking();
|