sirius-common-utils 1.0.11 → 1.0.12

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,11 +984,24 @@ function closetByClassName(elem, classNameList) {
984
984
  return null;
985
985
  }
986
986
  }
987
+ function getDomElemMouseRelativePosition(domElem, event) {
988
+ var rect = domElem.getBoundingClientRect();
989
+ var style = getComputedStyle(domElem);
990
+ var marginLeft = parseInt(style.marginLeft);
991
+ var marginTop = parseInt(style.marginTop);
992
+ var scrollX = window.scrollX || window.pageXOffset;
993
+ var scrollY = window.scrollY || window.pageYOffset;
994
+ return {
995
+ x: event.clientX - rect.left - marginLeft + scrollX,
996
+ y: event.clientY - rect.top - marginTop + scrollY
997
+ };
998
+ }
987
999
  const DomUtils = {
988
1000
  resetBodyScroll,
989
1001
  forbidBodyScroll,
990
1002
  syncDomAnimation,
991
- closetByClassName
1003
+ closetByClassName,
1004
+ getDomElemMouseRelativePosition
992
1005
  };
993
1006
  function isIOS() {
994
1007
  return [
@@ -985,11 +985,24 @@
985
985
  return null;
986
986
  }
987
987
  }
988
+ function getDomElemMouseRelativePosition(domElem, event) {
989
+ var rect = domElem.getBoundingClientRect();
990
+ var style = getComputedStyle(domElem);
991
+ var marginLeft = parseInt(style.marginLeft);
992
+ var marginTop = parseInt(style.marginTop);
993
+ var scrollX = window.scrollX || window.pageXOffset;
994
+ var scrollY = window.scrollY || window.pageYOffset;
995
+ return {
996
+ x: event.clientX - rect.left - marginLeft + scrollX,
997
+ y: event.clientY - rect.top - marginTop + scrollY
998
+ };
999
+ }
988
1000
  const DomUtils = {
989
1001
  resetBodyScroll,
990
1002
  forbidBodyScroll,
991
1003
  syncDomAnimation,
992
- closetByClassName
1004
+ closetByClassName,
1005
+ getDomElemMouseRelativePosition
993
1006
  };
994
1007
  function isIOS() {
995
1008
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sirius-common-utils",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
5
  "main": "./dist/sirius-common-utils.umd.cjs",
6
6
  "module": "./dist/sirius-common-utils.js",