sirius-common-utils 1.0.13 → 1.0.14
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.
|
@@ -984,38 +984,22 @@ function closetByClassName(elem, classNameList) {
|
|
|
984
984
|
return null;
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
|
-
function offset(
|
|
987
|
+
function offset(domNode) {
|
|
988
988
|
var offest = {
|
|
989
989
|
top: 0,
|
|
990
990
|
left: 0
|
|
991
991
|
};
|
|
992
|
-
if (!
|
|
992
|
+
if (!domNode.getClientRects().length) {
|
|
993
993
|
return offest;
|
|
994
994
|
}
|
|
995
|
-
if (window.getComputedStyle(
|
|
995
|
+
if (window.getComputedStyle(domNode)["display"] === "none") {
|
|
996
996
|
return offest;
|
|
997
997
|
}
|
|
998
|
-
offest =
|
|
999
|
-
var docElement =
|
|
998
|
+
offest = domNode.getBoundingClientRect();
|
|
999
|
+
var docElement = domNode.ownerDocument.documentElement;
|
|
1000
1000
|
return {
|
|
1001
|
-
top: offest.top + window.pageYOffset - docElement.clientTop,
|
|
1002
|
-
left: offest.left + window.pageXOffset - docElement.clientLeft
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
function getDomElemMouseRelativePosition(domElem, event, withWindowScrollFlag = false) {
|
|
1006
|
-
let rect = domElem.getBoundingClientRect();
|
|
1007
|
-
let style = getComputedStyle(domElem);
|
|
1008
|
-
let marginLeft = parseInt(style.marginLeft);
|
|
1009
|
-
let marginTop = parseInt(style.marginTop);
|
|
1010
|
-
let scrollX = 0;
|
|
1011
|
-
let scrollY = 0;
|
|
1012
|
-
if (withWindowScrollFlag) {
|
|
1013
|
-
scrollX = window.scrollX || window.pageXOffset;
|
|
1014
|
-
scrollY = window.scrollY || window.pageYOffset;
|
|
1015
|
-
}
|
|
1016
|
-
return {
|
|
1017
|
-
x: event.clientX - rect.left - marginLeft + scrollX,
|
|
1018
|
-
y: event.clientY - rect.top - marginTop + scrollY
|
|
1001
|
+
top: offest.top + (window.scrollY || window.pageYOffset) - docElement.clientTop,
|
|
1002
|
+
left: offest.left + (window.scrollX || window.pageXOffset) - docElement.clientLeft
|
|
1019
1003
|
};
|
|
1020
1004
|
}
|
|
1021
1005
|
const DomUtils = {
|
|
@@ -985,38 +985,22 @@
|
|
|
985
985
|
return null;
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
|
-
function offset(
|
|
988
|
+
function offset(domNode) {
|
|
989
989
|
var offest = {
|
|
990
990
|
top: 0,
|
|
991
991
|
left: 0
|
|
992
992
|
};
|
|
993
|
-
if (!
|
|
993
|
+
if (!domNode.getClientRects().length) {
|
|
994
994
|
return offest;
|
|
995
995
|
}
|
|
996
|
-
if (window.getComputedStyle(
|
|
996
|
+
if (window.getComputedStyle(domNode)["display"] === "none") {
|
|
997
997
|
return offest;
|
|
998
998
|
}
|
|
999
|
-
offest =
|
|
1000
|
-
var docElement =
|
|
999
|
+
offest = domNode.getBoundingClientRect();
|
|
1000
|
+
var docElement = domNode.ownerDocument.documentElement;
|
|
1001
1001
|
return {
|
|
1002
|
-
top: offest.top + window.pageYOffset - docElement.clientTop,
|
|
1003
|
-
left: offest.left + window.pageXOffset - docElement.clientLeft
|
|
1004
|
-
};
|
|
1005
|
-
}
|
|
1006
|
-
function getDomElemMouseRelativePosition(domElem, event, withWindowScrollFlag = false) {
|
|
1007
|
-
let rect = domElem.getBoundingClientRect();
|
|
1008
|
-
let style = getComputedStyle(domElem);
|
|
1009
|
-
let marginLeft = parseInt(style.marginLeft);
|
|
1010
|
-
let marginTop = parseInt(style.marginTop);
|
|
1011
|
-
let scrollX = 0;
|
|
1012
|
-
let scrollY = 0;
|
|
1013
|
-
if (withWindowScrollFlag) {
|
|
1014
|
-
scrollX = window.scrollX || window.pageXOffset;
|
|
1015
|
-
scrollY = window.scrollY || window.pageYOffset;
|
|
1016
|
-
}
|
|
1017
|
-
return {
|
|
1018
|
-
x: event.clientX - rect.left - marginLeft + scrollX,
|
|
1019
|
-
y: event.clientY - rect.top - marginTop + scrollY
|
|
1002
|
+
top: offest.top + (window.scrollY || window.pageYOffset) - docElement.clientTop,
|
|
1003
|
+
left: offest.left + (window.scrollX || window.pageXOffset) - docElement.clientLeft
|
|
1020
1004
|
};
|
|
1021
1005
|
}
|
|
1022
1006
|
const DomUtils = {
|