@hanzogui/floating 3.0.6 → 4.4.0
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/dist/cjs/Floating.cjs +7 -5
- package/dist/cjs/Floating.native.js +18 -16
- package/dist/cjs/Floating.native.js.map +1 -1
- package/dist/cjs/index.cjs +28 -26
- package/dist/cjs/index.native.js +28 -26
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/interactions/PopupTriggerMap.cjs +21 -12
- package/dist/cjs/interactions/PopupTriggerMap.native.js +51 -27
- package/dist/cjs/interactions/PopupTriggerMap.native.js.map +1 -1
- package/dist/cjs/interactions/createFloatingEvents.cjs +21 -12
- package/dist/cjs/interactions/createFloatingEvents.native.js +22 -13
- package/dist/cjs/interactions/createFloatingEvents.native.js.map +1 -1
- package/dist/cjs/interactions/safePolygon.cjs +213 -131
- package/dist/cjs/interactions/safePolygon.native.js +182 -103
- package/dist/cjs/interactions/safePolygon.native.js.map +1 -1
- package/dist/cjs/interactions/types.cjs +7 -5
- package/dist/cjs/interactions/types.native.js +7 -5
- package/dist/cjs/interactions/types.native.js.map +1 -1
- package/dist/cjs/interactions/useClick.cjs +91 -49
- package/dist/cjs/interactions/useClick.native.js +96 -54
- package/dist/cjs/interactions/useClick.native.js.map +1 -1
- package/dist/cjs/interactions/useDelayGroup.cjs +63 -44
- package/dist/cjs/interactions/useDelayGroup.native.js +74 -58
- package/dist/cjs/interactions/useDelayGroup.native.js.map +1 -1
- package/dist/cjs/interactions/useFocus.cjs +73 -44
- package/dist/cjs/interactions/useFocus.native.js +75 -49
- package/dist/cjs/interactions/useFocus.native.js.map +1 -1
- package/dist/cjs/interactions/useHover.cjs +242 -109
- package/dist/cjs/interactions/useHover.native.js +268 -143
- package/dist/cjs/interactions/useHover.native.js.map +1 -1
- package/dist/cjs/interactions/useInnerOffset.cjs +88 -64
- package/dist/cjs/interactions/useInnerOffset.native.js +88 -65
- package/dist/cjs/interactions/useInnerOffset.native.js.map +1 -1
- package/dist/cjs/interactions/useInteractions.cjs +60 -31
- package/dist/cjs/interactions/useInteractions.native.js +133 -81
- package/dist/cjs/interactions/useInteractions.native.js.map +1 -1
- package/dist/cjs/interactions/useListNavigation.cjs +346 -181
- package/dist/cjs/interactions/useListNavigation.native.js +350 -214
- package/dist/cjs/interactions/useListNavigation.native.js.map +1 -1
- package/dist/cjs/interactions/useRole.cjs +83 -73
- package/dist/cjs/interactions/useRole.native.js +107 -99
- package/dist/cjs/interactions/useRole.native.js.map +1 -1
- package/dist/cjs/interactions/useTypeahead.cjs +115 -65
- package/dist/cjs/interactions/useTypeahead.native.js +122 -77
- package/dist/cjs/interactions/useTypeahead.native.js.map +1 -1
- package/dist/cjs/interactions/utils.cjs +68 -38
- package/dist/cjs/interactions/utils.native.js +93 -54
- package/dist/cjs/interactions/utils.native.js.map +1 -1
- package/dist/cjs/middleware/inner.cjs +79 -67
- package/dist/cjs/middleware/inner.native.js +86 -76
- package/dist/cjs/middleware/inner.native.js.map +1 -1
- package/dist/cjs/useFloating.cjs +48 -45
- package/dist/cjs/useFloating.native.js +50 -48
- package/dist/cjs/useFloating.native.js.map +1 -1
- package/dist/esm/Floating.native.js +5 -5
- package/dist/esm/Floating.native.js.map +1 -1
- package/dist/esm/interactions/PopupTriggerMap.mjs +9 -2
- package/dist/esm/interactions/PopupTriggerMap.mjs.map +1 -1
- package/dist/esm/interactions/PopupTriggerMap.native.js +39 -17
- package/dist/esm/interactions/PopupTriggerMap.native.js.map +1 -1
- package/dist/esm/interactions/createFloatingEvents.mjs +9 -2
- package/dist/esm/interactions/createFloatingEvents.mjs.map +1 -1
- package/dist/esm/interactions/createFloatingEvents.native.js +10 -3
- package/dist/esm/interactions/createFloatingEvents.native.js.map +1 -1
- package/dist/esm/interactions/safePolygon.mjs +201 -121
- package/dist/esm/interactions/safePolygon.mjs.map +1 -1
- package/dist/esm/interactions/safePolygon.native.js +170 -93
- package/dist/esm/interactions/safePolygon.native.js.map +1 -1
- package/dist/esm/interactions/useClick.mjs +79 -39
- package/dist/esm/interactions/useClick.mjs.map +1 -1
- package/dist/esm/interactions/useClick.native.js +82 -42
- package/dist/esm/interactions/useClick.native.js.map +1 -1
- package/dist/esm/interactions/useDelayGroup.mjs +39 -22
- package/dist/esm/interactions/useDelayGroup.mjs.map +1 -1
- package/dist/esm/interactions/useDelayGroup.native.js +42 -28
- package/dist/esm/interactions/useDelayGroup.native.js.map +1 -1
- package/dist/esm/interactions/useFocus.mjs +59 -32
- package/dist/esm/interactions/useFocus.mjs.map +1 -1
- package/dist/esm/interactions/useFocus.native.js +61 -37
- package/dist/esm/interactions/useFocus.native.js.map +1 -1
- package/dist/esm/interactions/useHover.mjs +215 -84
- package/dist/esm/interactions/useHover.mjs.map +1 -1
- package/dist/esm/interactions/useHover.native.js +240 -117
- package/dist/esm/interactions/useHover.native.js.map +1 -1
- package/dist/esm/interactions/useInnerOffset.mjs +61 -39
- package/dist/esm/interactions/useInnerOffset.mjs.map +1 -1
- package/dist/esm/interactions/useInnerOffset.native.js +61 -40
- package/dist/esm/interactions/useInnerOffset.native.js.map +1 -1
- package/dist/esm/interactions/useInteractions.mjs +48 -21
- package/dist/esm/interactions/useInteractions.mjs.map +1 -1
- package/dist/esm/interactions/useInteractions.native.js +121 -71
- package/dist/esm/interactions/useInteractions.native.js.map +1 -1
- package/dist/esm/interactions/useListNavigation.mjs +331 -168
- package/dist/esm/interactions/useListNavigation.mjs.map +1 -1
- package/dist/esm/interactions/useListNavigation.native.js +335 -201
- package/dist/esm/interactions/useListNavigation.native.js.map +1 -1
- package/dist/esm/interactions/useRole.mjs +59 -51
- package/dist/esm/interactions/useRole.mjs.map +1 -1
- package/dist/esm/interactions/useRole.native.js +82 -76
- package/dist/esm/interactions/useRole.native.js.map +1 -1
- package/dist/esm/interactions/useTypeahead.mjs +100 -52
- package/dist/esm/interactions/useTypeahead.mjs.map +1 -1
- package/dist/esm/interactions/useTypeahead.native.js +107 -64
- package/dist/esm/interactions/useTypeahead.native.js.map +1 -1
- package/dist/esm/interactions/utils.mjs +56 -28
- package/dist/esm/interactions/utils.mjs.map +1 -1
- package/dist/esm/interactions/utils.native.js +81 -44
- package/dist/esm/interactions/utils.native.js.map +1 -1
- package/dist/esm/middleware/inner.mjs +54 -44
- package/dist/esm/middleware/inner.mjs.map +1 -1
- package/dist/esm/middleware/inner.native.js +61 -53
- package/dist/esm/middleware/inner.native.js.map +1 -1
- package/dist/esm/useFloating.mjs +22 -21
- package/dist/esm/useFloating.mjs.map +1 -1
- package/dist/esm/useFloating.native.js +24 -24
- package/dist/esm/useFloating.native.js.map +1 -1
- package/package.json +3 -3
- package/src/middleware/inner.ts +4 -5
- package/types/middleware/inner.d.ts.map +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from "@floating-ui/react-native";
|
|
2
|
-
var autoUpdate = function () {}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var autoUpdate = function () {};
|
|
3
|
+
var getOverflowAncestors = function () {
|
|
4
|
+
return [];
|
|
5
|
+
};
|
|
6
|
+
var platform = null;
|
|
7
7
|
export { autoUpdate, getOverflowAncestors, platform };
|
|
8
8
|
//# sourceMappingURL=Floating.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["autoUpdate","getOverflowAncestors","platform"],"sources":["../../src/Floating.native.tsx"],"sourcesContent":[null],"mappings":"AAIA,cAAc;AAJP,IAAIA,UAAA,GAAa,SAAAA,CAAA,EAAW,CAAC;
|
|
1
|
+
{"version":3,"names":["autoUpdate","getOverflowAncestors","platform"],"sources":["../../src/Floating.native.tsx"],"sourcesContent":[null],"mappings":"AAIA,cAAc;AAJP,IAAIA,UAAA,GAAa,SAAAA,CAAA,EAAW,CAAC;AAC7B,IAAIC,oBAAA,GAAuB,SAAAA,CAAA,EAAW;EACzC,OAAO,EAAC;AACZ;AAEO,IAAIC,QAAA,GAAW","ignoreList":[]}
|
|
@@ -3,11 +3,18 @@ class PopupTriggerMap {
|
|
|
3
3
|
elements = /* @__PURE__ */new Set();
|
|
4
4
|
add(id, element) {
|
|
5
5
|
const prev = this.map.get(id);
|
|
6
|
-
|
|
6
|
+
if (prev) {
|
|
7
|
+
this.elements.delete(prev);
|
|
8
|
+
}
|
|
9
|
+
this.map.set(id, element);
|
|
10
|
+
this.elements.add(element);
|
|
7
11
|
}
|
|
8
12
|
delete(id) {
|
|
9
13
|
const el = this.map.get(id);
|
|
10
|
-
|
|
14
|
+
if (el) {
|
|
15
|
+
this.elements.delete(el);
|
|
16
|
+
this.map.delete(id);
|
|
17
|
+
}
|
|
11
18
|
}
|
|
12
19
|
hasElement(element) {
|
|
13
20
|
return this.elements.has(element);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PopupTriggerMap","map","Map","elements","Set","add","id","element","prev","get","delete","set","el","hasElement","has"],"sources":["../../../src/interactions/PopupTriggerMap.ts"],"sourcesContent":[null],"mappings":"AAKO,MAAMA,eAAA,CAAgB;EACnBC,GAAA,GAAM,mBAAIC,GAAA,CAAqB;EAC/BC,QAAA,GAAW,mBAAIC,GAAA,CAAa;EAEpCC,IAAIC,EAAA,EAAYC,OAAA,EAAkB;IAChC,MAAMC,IAAA,GAAO,KAAKP,GAAA,CAAIQ,GAAA,CAAIH,EAAE;
|
|
1
|
+
{"version":3,"names":["PopupTriggerMap","map","Map","elements","Set","add","id","element","prev","get","delete","set","el","hasElement","has"],"sources":["../../../src/interactions/PopupTriggerMap.ts"],"sourcesContent":[null],"mappings":"AAKO,MAAMA,eAAA,CAAgB;EACnBC,GAAA,GAAM,mBAAIC,GAAA,CAAqB;EAC/BC,QAAA,GAAW,mBAAIC,GAAA,CAAa;EAEpCC,IAAIC,EAAA,EAAYC,OAAA,EAAkB;IAChC,MAAMC,IAAA,GAAO,KAAKP,GAAA,CAAIQ,GAAA,CAAIH,EAAE;IAC5B,IAAIE,IAAA,EAAM;MACR,KAAKL,QAAA,CAASO,MAAA,CAAOF,IAAI;IAC3B;IACA,KAAKP,GAAA,CAAIU,GAAA,CAAIL,EAAA,EAAIC,OAAO;IACxB,KAAKJ,QAAA,CAASE,GAAA,CAAIE,OAAO;EAC3B;EAEAG,OAAOJ,EAAA,EAAY;IACjB,MAAMM,EAAA,GAAK,KAAKX,GAAA,CAAIQ,GAAA,CAAIH,EAAE;IAC1B,IAAIM,EAAA,EAAI;MACN,KAAKT,QAAA,CAASO,MAAA,CAAOE,EAAE;MACvB,KAAKX,GAAA,CAAIS,MAAA,CAAOJ,EAAE;IACpB;EACF;EAEAO,WAAWN,OAAA,EAA2B;IACpC,OAAO,KAAKJ,QAAA,CAASW,GAAA,CAAIP,OAAO;EAClC;AACF","ignoreList":[]}
|
|
@@ -1,47 +1,69 @@
|
|
|
1
1
|
function _class_call_check(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor))
|
|
2
|
+
if (!(instance instanceof Constructor)) {
|
|
3
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4
|
+
}
|
|
3
5
|
}
|
|
4
6
|
function _defineProperties(target, props) {
|
|
5
7
|
for (var i = 0; i < props.length; i++) {
|
|
6
8
|
var descriptor = props[i];
|
|
7
|
-
descriptor.enumerable = descriptor.enumerable ||
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
8
13
|
}
|
|
9
14
|
}
|
|
10
15
|
function _create_class(Constructor, protoProps, staticProps) {
|
|
11
|
-
|
|
16
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
12
19
|
}
|
|
13
20
|
function _define_property(obj, key, value) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
20
32
|
}
|
|
21
33
|
var PopupTriggerMap = /* @__PURE__ */function () {
|
|
22
34
|
"use strict";
|
|
23
35
|
|
|
24
36
|
function PopupTriggerMap2() {
|
|
25
|
-
_class_call_check(this, PopupTriggerMap2)
|
|
37
|
+
_class_call_check(this, PopupTriggerMap2);
|
|
38
|
+
_define_property(this, "map", /* @__PURE__ */new Map());
|
|
39
|
+
_define_property(this, "elements", /* @__PURE__ */new Set());
|
|
26
40
|
}
|
|
27
|
-
|
|
41
|
+
_create_class(PopupTriggerMap2, [{
|
|
28
42
|
key: "add",
|
|
29
|
-
value: function (id, element) {
|
|
43
|
+
value: function add(id, element) {
|
|
30
44
|
var prev = this.map.get(id);
|
|
31
|
-
|
|
45
|
+
if (prev) {
|
|
46
|
+
this.elements.delete(prev);
|
|
47
|
+
}
|
|
48
|
+
this.map.set(id, element);
|
|
49
|
+
this.elements.add(element);
|
|
32
50
|
}
|
|
33
51
|
}, {
|
|
34
52
|
key: "delete",
|
|
35
|
-
value: function (id) {
|
|
53
|
+
value: function _delete(id) {
|
|
36
54
|
var el = this.map.get(id);
|
|
37
|
-
|
|
55
|
+
if (el) {
|
|
56
|
+
this.elements.delete(el);
|
|
57
|
+
this.map.delete(id);
|
|
58
|
+
}
|
|
38
59
|
}
|
|
39
60
|
}, {
|
|
40
61
|
key: "hasElement",
|
|
41
|
-
value: function (element) {
|
|
62
|
+
value: function hasElement(element) {
|
|
42
63
|
return this.elements.has(element);
|
|
43
64
|
}
|
|
44
|
-
}])
|
|
65
|
+
}]);
|
|
66
|
+
return PopupTriggerMap2;
|
|
45
67
|
}();
|
|
46
68
|
export { PopupTriggerMap };
|
|
47
69
|
//# sourceMappingURL=PopupTriggerMap.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_class_call_check","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_create_class","protoProps","staticProps","prototype","_define_property","obj","value"],"sources":["../../../src/interactions/PopupTriggerMap.ts"],"sourcesContent":[null],"mappings":"AAKO,SAAMA,iBAAgBA,CAAAC,QAAA,EAAAC,WAAA;EACnB,MAAMD,QAAA,YAAIC,WAAqB
|
|
1
|
+
{"version":3,"names":["_class_call_check","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_create_class","protoProps","staticProps","prototype","_define_property","obj","value"],"sources":["../../../src/interactions/PopupTriggerMap.ts"],"sourcesContent":[null],"mappings":"AAKO,SAAMA,iBAAgBA,CAAAC,QAAA,EAAAC,WAAA;EACnB,MAAMD,QAAA,YAAIC,WAAqB;IAC/B,UAAWC,SAAA,oCAAiB;EAEpC;AACE;AACA,SAAIC,iBAAMA,CAAAC,MAAA,EAAAC,KAAA;EACR,SAAKC,CAAA,MAAAA,CAAA,GAASD,KAAO,CAAAE,MAAI,EAAAD,CAAA;IAC3B,IAAAE,UAAA,GAAAH,KAAA,CAAAC,CAAA;IACAE,UAAS,CAAAC,UAAQ,GAAOD,UAAA,CAAAC,UAAA;IACxBD,UAAK,CAAAE,YAAa,GAAO;IAC3B,eAAAF,UAAA,EAAAA,UAAA,CAAAG,QAAA;IAEAC,MAAO,CAAAC,cAAY,CAAAT,MAAA,EAAAI,UAAA,CAAAM,GAAA,EAAAN,UAAA;EACjB;AACA;AACE,SAAAO,aAAcA,CAAAd,WAAS,EAAAe,UAAA,EAAAC,WAAA;EACvB,IAAAD,UAAS,EAAAb,iBAAS,CAAAF,WAAA,CAAAiB,SAAA,EAAAF,UAAA;EAAA,IACpBC,WAAA,EAAAd,iBAAA,CAAAF,WAAA,EAAAgB,WAAA;EACF,OAAAhB,WAAA;AAAA;AAGE,SAAAkB,gBAAqBA,CAAAC,GAAI,EAAAN,GAAA,EAAOO,KAAA;EAClC,IAAAP,GAAA,IAAAM,GAAA;IACFR,MAAA,CAAAC,cAAA,CAAAO,GAAA,EAAAN,GAAA","ignoreList":[]}
|
|
@@ -6,11 +6,18 @@ function createFloatingEvents() {
|
|
|
6
6
|
},
|
|
7
7
|
on(event, handler) {
|
|
8
8
|
let set = listeners.get(event);
|
|
9
|
-
|
|
9
|
+
if (!set) {
|
|
10
|
+
set = /* @__PURE__ */new Set();
|
|
11
|
+
listeners.set(event, set);
|
|
12
|
+
}
|
|
13
|
+
set.add(handler);
|
|
10
14
|
},
|
|
11
15
|
off(event, handler) {
|
|
12
16
|
const set = listeners.get(event);
|
|
13
|
-
|
|
17
|
+
if (set) {
|
|
18
|
+
set.delete(handler);
|
|
19
|
+
if (set.size === 0) listeners.delete(event);
|
|
20
|
+
}
|
|
14
21
|
}
|
|
15
22
|
};
|
|
16
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFloatingEvents","listeners","Map","emit","event","data","get","forEach","fn","on","handler","set","Set","add","off","delete","size"],"sources":["../../../src/interactions/createFloatingEvents.ts"],"sourcesContent":[null],"mappings":"AAUO,SAASA,qBAAA,EAAuC;EACrD,MAAMC,SAAA,GAAY,mBAAIC,GAAA,CAAuC;EAE7D,OAAO;IACLC,KAAKC,KAAA,EAAOC,IAAA,EAAM;MAChBJ,SAAA,CAAUK,GAAA,CAAIF,KAAK,GAAGG,OAAA,CAASC,EAAA,IAAOA,EAAA,CAAGH,IAAI,CAAC;IAChD;IACAI,GAAGL,KAAA,EAAOM,OAAA,EAAS;MACjB,IAAIC,GAAA,GAAMV,SAAA,CAAUK,GAAA,CAAIF,KAAK;
|
|
1
|
+
{"version":3,"names":["createFloatingEvents","listeners","Map","emit","event","data","get","forEach","fn","on","handler","set","Set","add","off","delete","size"],"sources":["../../../src/interactions/createFloatingEvents.ts"],"sourcesContent":[null],"mappings":"AAUO,SAASA,qBAAA,EAAuC;EACrD,MAAMC,SAAA,GAAY,mBAAIC,GAAA,CAAuC;EAE7D,OAAO;IACLC,KAAKC,KAAA,EAAOC,IAAA,EAAM;MAChBJ,SAAA,CAAUK,GAAA,CAAIF,KAAK,GAAGG,OAAA,CAASC,EAAA,IAAOA,EAAA,CAAGH,IAAI,CAAC;IAChD;IACAI,GAAGL,KAAA,EAAOM,OAAA,EAAS;MACjB,IAAIC,GAAA,GAAMV,SAAA,CAAUK,GAAA,CAAIF,KAAK;MAC7B,IAAI,CAACO,GAAA,EAAK;QACRA,GAAA,GAAM,mBAAIC,GAAA,CAAI;QACdX,SAAA,CAAUU,GAAA,CAAIP,KAAA,EAAOO,GAAG;MAC1B;MACAA,GAAA,CAAIE,GAAA,CAAIH,OAAO;IACjB;IACAI,IAAIV,KAAA,EAAOM,OAAA,EAAS;MAClB,MAAMC,GAAA,GAAMV,SAAA,CAAUK,GAAA,CAAIF,KAAK;MAC/B,IAAIO,GAAA,EAAK;QACPA,GAAA,CAAII,MAAA,CAAOL,OAAO;QAClB,IAAIC,GAAA,CAAIK,IAAA,KAAS,GAAGf,SAAA,CAAUc,MAAA,CAAOX,KAAK;MAC5C;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -3,17 +3,24 @@ function createFloatingEvents() {
|
|
|
3
3
|
return {
|
|
4
4
|
emit(event, data) {
|
|
5
5
|
var _listeners_get;
|
|
6
|
-
(_listeners_get = listeners.get(event)) === null || _listeners_get === void 0
|
|
6
|
+
(_listeners_get = listeners.get(event)) === null || _listeners_get === void 0 ? void 0 : _listeners_get.forEach(function (fn) {
|
|
7
7
|
return fn(data);
|
|
8
8
|
});
|
|
9
9
|
},
|
|
10
10
|
on(event, handler) {
|
|
11
11
|
var set = listeners.get(event);
|
|
12
|
-
|
|
12
|
+
if (!set) {
|
|
13
|
+
set = /* @__PURE__ */new Set();
|
|
14
|
+
listeners.set(event, set);
|
|
15
|
+
}
|
|
16
|
+
set.add(handler);
|
|
13
17
|
},
|
|
14
18
|
off(event, handler) {
|
|
15
19
|
var set = listeners.get(event);
|
|
16
|
-
|
|
20
|
+
if (set) {
|
|
21
|
+
set.delete(handler);
|
|
22
|
+
if (set.size === 0) listeners.delete(event);
|
|
23
|
+
}
|
|
17
24
|
}
|
|
18
25
|
};
|
|
19
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFloatingEvents","listeners","Map","emit","event","data","_listeners_get","get","forEach","fn","on","handler","set","Set","add","off","delete","size"],"sources":["../../../src/interactions/createFloatingEvents.ts"],"sourcesContent":[null],"mappings":"AAUO,SAASA,qBAAA,EAAuC;EACrD,IAAAC,SAAM,kBAAY,IAAAC,GAAI;EAEtB,OAAO;IACLC,KAAKC,KAAA,EAAOC,IAAA,EAAM;MAChB,IAAAC,cAAc;MAChB,CAAAA,cAAA,GAAAL,SAAA,CAAAM,GAAA,CAAAH,KAAA,eAAAE,cAAA,
|
|
1
|
+
{"version":3,"names":["createFloatingEvents","listeners","Map","emit","event","data","_listeners_get","get","forEach","fn","on","handler","set","Set","add","off","delete","size"],"sources":["../../../src/interactions/createFloatingEvents.ts"],"sourcesContent":[null],"mappings":"AAUO,SAASA,qBAAA,EAAuC;EACrD,IAAAC,SAAM,kBAAY,IAAAC,GAAI;EAEtB,OAAO;IACLC,KAAKC,KAAA,EAAOC,IAAA,EAAM;MAChB,IAAAC,cAAc;MAChB,CAAAA,cAAA,GAAAL,SAAA,CAAAM,GAAA,CAAAH,KAAA,eAAAE,cAAA,uBAAAA,cAAA,CAAAE,OAAA,WAAAC,EAAA;QACG,OAAOA,EAAA,CAAAJ,IAAA,CAAS;MACjB;IACA;IACEK,GAAAN,KAAA,EAAMO,OAAA;MACN,IAAAC,GAAA,GAAAX,SAAc,CAAAM,GAAO,CAAAH,KAAG;MAC1B,KAAAQ,GAAA;QACAA,GAAI,GAAI,eAAO,IAAAC,GAAA;QACjBZ,SAAA,CAAAW,GAAA,CAAAR,KAAA,EAAAQ,GAAA;MACA;MACEA,GAAA,CAAAE,GAAM,CAAAH,OAAM;IACZ;IACEI,IAAAX,KAAI,EAAAO,OAAO;MACX,IAAAC,GAAI,GAAIX,SAAS,CAAAM,GAAG,CAAAH,KAAA;MACtB,IAAAQ,GAAA;QACFA,GAAA,CAAAI,MAAA,CAAAL,OAAA;QACF,IAAAC,GAAA,CAAAK,IAAA,QAAAhB,SAAA,CAAAe,MAAA,CAAAZ,KAAA;MACF","ignoreList":[]}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { clearTimeoutIfSet, contains, getTarget } from "./utils.mjs";
|
|
2
2
|
function isPointInPolygon(point, polygon) {
|
|
3
3
|
const [x, y] = point;
|
|
4
|
-
let isInside2 =
|
|
4
|
+
let isInside2 = false;
|
|
5
5
|
const length = polygon.length;
|
|
6
6
|
for (let i = 0, j = length - 1; i < length; j = i++) {
|
|
7
|
-
const [xi, yi] = polygon[i] || [0, 0]
|
|
8
|
-
|
|
9
|
-
yi >= y
|
|
7
|
+
const [xi, yi] = polygon[i] || [0, 0];
|
|
8
|
+
const [xj, yj] = polygon[j] || [0, 0];
|
|
9
|
+
const intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
10
|
+
if (intersect) {
|
|
11
|
+
isInside2 = !isInside2;
|
|
12
|
+
}
|
|
10
13
|
}
|
|
11
14
|
return isInside2;
|
|
12
15
|
}
|
|
@@ -15,51 +18,90 @@ function isInside(point, rect) {
|
|
|
15
18
|
}
|
|
16
19
|
let debugSvg = null;
|
|
17
20
|
function debugDrawPolygon(polygon, trough, cursor, anchor) {
|
|
18
|
-
if (debugSvg
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
if (!debugSvg) {
|
|
22
|
+
debugSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
23
|
+
debugSvg.id = "__safe-polygon-debug";
|
|
24
|
+
Object.assign(debugSvg.style, {
|
|
25
|
+
position: "fixed",
|
|
26
|
+
inset: "0",
|
|
27
|
+
width: "100vw",
|
|
28
|
+
height: "100vh",
|
|
29
|
+
pointerEvents: "none",
|
|
30
|
+
zIndex: "999999"
|
|
31
|
+
});
|
|
32
|
+
document.body.appendChild(debugSvg);
|
|
33
|
+
}
|
|
34
|
+
debugSvg.innerHTML = "";
|
|
35
|
+
if (trough.length) {
|
|
26
36
|
const troughEl = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
|
27
|
-
troughEl.setAttribute("points", trough.map(p => p.join(",")).join(" "))
|
|
37
|
+
troughEl.setAttribute("points", trough.map(p => p.join(",")).join(" "));
|
|
38
|
+
troughEl.setAttribute("fill", "rgba(0,100,255,0.15)");
|
|
39
|
+
troughEl.setAttribute("stroke", "rgba(0,100,255,0.6)");
|
|
40
|
+
troughEl.setAttribute("stroke-width", "1");
|
|
41
|
+
debugSvg.appendChild(troughEl);
|
|
28
42
|
}
|
|
29
43
|
if (polygon.length) {
|
|
30
44
|
const polyEl = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
|
31
|
-
polyEl.setAttribute("points", polygon.map(p => p.join(",")).join(" "))
|
|
45
|
+
polyEl.setAttribute("points", polygon.map(p => p.join(",")).join(" "));
|
|
46
|
+
polyEl.setAttribute("fill", "rgba(255,50,50,0.2)");
|
|
47
|
+
polyEl.setAttribute("stroke", "rgba(255,50,50,0.8)");
|
|
48
|
+
polyEl.setAttribute("stroke-width", "1.5");
|
|
49
|
+
debugSvg.appendChild(polyEl);
|
|
32
50
|
}
|
|
33
51
|
const anchorCircle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
34
|
-
anchorCircle.setAttribute("cx", String(anchor[0]))
|
|
52
|
+
anchorCircle.setAttribute("cx", String(anchor[0]));
|
|
53
|
+
anchorCircle.setAttribute("cy", String(anchor[1]));
|
|
54
|
+
anchorCircle.setAttribute("r", "5");
|
|
55
|
+
anchorCircle.setAttribute("fill", "lime");
|
|
56
|
+
anchorCircle.setAttribute("stroke", "darkgreen");
|
|
57
|
+
anchorCircle.setAttribute("stroke-width", "1.5");
|
|
58
|
+
debugSvg.appendChild(anchorCircle);
|
|
35
59
|
const cursorCircle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
36
|
-
cursorCircle.setAttribute("cx", String(cursor[0]))
|
|
60
|
+
cursorCircle.setAttribute("cx", String(cursor[0]));
|
|
61
|
+
cursorCircle.setAttribute("cy", String(cursor[1]));
|
|
62
|
+
cursorCircle.setAttribute("r", "4");
|
|
63
|
+
cursorCircle.setAttribute("fill", "yellow");
|
|
64
|
+
cursorCircle.setAttribute("stroke", "orange");
|
|
65
|
+
cursorCircle.setAttribute("stroke-width", "1.5");
|
|
66
|
+
debugSvg.appendChild(cursorCircle);
|
|
37
67
|
}
|
|
38
68
|
function debugClear() {
|
|
39
|
-
|
|
69
|
+
if (debugSvg) {
|
|
70
|
+
debugSvg.remove();
|
|
71
|
+
debugSvg = null;
|
|
72
|
+
}
|
|
40
73
|
}
|
|
41
74
|
function safePolygon(options = {}) {
|
|
42
75
|
const {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
let hasLanded =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
76
|
+
buffer = 0.5,
|
|
77
|
+
blockPointerEvents = false,
|
|
78
|
+
requireIntent = true,
|
|
79
|
+
__debug = false
|
|
80
|
+
} = options;
|
|
81
|
+
const timeoutRef = {
|
|
82
|
+
current: -1
|
|
83
|
+
};
|
|
84
|
+
let hasLanded = false;
|
|
85
|
+
let lastX = null;
|
|
86
|
+
let lastY = null;
|
|
87
|
+
let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
|
|
55
88
|
function getCursorSpeed(x, y) {
|
|
56
|
-
const currentTime = performance.now()
|
|
57
|
-
|
|
58
|
-
if (lastX === null || lastY === null || elapsedTime === 0)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
const currentTime = performance.now();
|
|
90
|
+
const elapsedTime = currentTime - lastCursorTime;
|
|
91
|
+
if (lastX === null || lastY === null || elapsedTime === 0) {
|
|
92
|
+
lastX = x;
|
|
93
|
+
lastY = y;
|
|
94
|
+
lastCursorTime = currentTime;
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const deltaX = x - lastX;
|
|
98
|
+
const deltaY = y - lastY;
|
|
99
|
+
const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
100
|
+
const speed = distance / elapsedTime;
|
|
101
|
+
lastX = x;
|
|
102
|
+
lastY = y;
|
|
103
|
+
lastCursorTime = currentTime;
|
|
104
|
+
return speed;
|
|
63
105
|
}
|
|
64
106
|
const fn = ({
|
|
65
107
|
x,
|
|
@@ -67,102 +109,140 @@ function safePolygon(options = {}) {
|
|
|
67
109
|
placement,
|
|
68
110
|
elements,
|
|
69
111
|
onClose
|
|
70
|
-
}) =>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
112
|
+
}) => {
|
|
113
|
+
hasLanded = false;
|
|
114
|
+
lastX = null;
|
|
115
|
+
lastY = null;
|
|
116
|
+
return function onMouseMove(event) {
|
|
117
|
+
function close() {
|
|
118
|
+
clearTimeoutIfSet(timeoutRef);
|
|
119
|
+
onClose();
|
|
120
|
+
}
|
|
121
|
+
clearTimeoutIfSet(timeoutRef);
|
|
122
|
+
const domReference = elements.domReference ?? elements.reference;
|
|
123
|
+
if (!domReference || !elements.floating || placement == null || x == null || y == null) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const {
|
|
78
127
|
clientX,
|
|
79
128
|
clientY
|
|
80
|
-
} = event
|
|
81
|
-
clientPoint = [clientX, clientY]
|
|
82
|
-
target = getTarget(event)
|
|
83
|
-
isLeave = event.type === "mouseleave"
|
|
84
|
-
isOverFloatingEl = contains(elements.floating, target)
|
|
85
|
-
isOverReferenceEl = contains(domReference, target)
|
|
86
|
-
refRect = domReference.getBoundingClientRect()
|
|
87
|
-
rect = elements.floating.getBoundingClientRect()
|
|
88
|
-
side = placement.split("-")[0]
|
|
89
|
-
cursorLeaveFromRight = x > rect.right - rect.width / 2
|
|
90
|
-
cursorLeaveFromBottom = y > rect.bottom - rect.height / 2
|
|
91
|
-
isOverReferenceRect = isInside(clientPoint, refRect)
|
|
92
|
-
isFloatingWider = rect.width > refRect.width
|
|
93
|
-
isFloatingTaller = rect.height > refRect.height
|
|
94
|
-
left = (isFloatingWider ? refRect : rect).left
|
|
95
|
-
right = (isFloatingWider ? refRect : rect).right
|
|
96
|
-
top = (isFloatingTaller ? refRect : rect).top
|
|
97
|
-
bottom = (isFloatingTaller ? refRect : rect).bottom;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
} = event;
|
|
130
|
+
const clientPoint = [clientX, clientY];
|
|
131
|
+
const target = getTarget(event);
|
|
132
|
+
const isLeave = event.type === "mouseleave";
|
|
133
|
+
const isOverFloatingEl = contains(elements.floating, target);
|
|
134
|
+
const isOverReferenceEl = contains(domReference, target);
|
|
135
|
+
const refRect = domReference.getBoundingClientRect();
|
|
136
|
+
const rect = elements.floating.getBoundingClientRect();
|
|
137
|
+
const side = placement.split("-")[0];
|
|
138
|
+
const cursorLeaveFromRight = x > rect.right - rect.width / 2;
|
|
139
|
+
const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;
|
|
140
|
+
const isOverReferenceRect = isInside(clientPoint, refRect);
|
|
141
|
+
const isFloatingWider = rect.width > refRect.width;
|
|
142
|
+
const isFloatingTaller = rect.height > refRect.height;
|
|
143
|
+
const left = (isFloatingWider ? refRect : rect).left;
|
|
144
|
+
const right = (isFloatingWider ? refRect : rect).right;
|
|
145
|
+
const top = (isFloatingTaller ? refRect : rect).top;
|
|
146
|
+
const bottom = (isFloatingTaller ? refRect : rect).bottom;
|
|
147
|
+
if (isOverFloatingEl) {
|
|
148
|
+
hasLanded = true;
|
|
149
|
+
if (!isLeave) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (isOverReferenceEl) {
|
|
154
|
+
hasLanded = false;
|
|
155
|
+
}
|
|
156
|
+
if (isOverReferenceEl && !isLeave) {
|
|
157
|
+
hasLanded = true;
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (!isOverReferenceEl && isOverReferenceRect && !isLeave) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (isLeave && event.relatedTarget && contains(elements.floating, event.relatedTarget)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (side === "top" && y >= refRect.bottom - 1 || side === "bottom" && y <= refRect.top + 1 || side === "left" && x >= refRect.right - 1 || side === "right" && x <= refRect.left + 1) {
|
|
167
|
+
return close();
|
|
168
|
+
}
|
|
169
|
+
let rectPoly = [];
|
|
121
170
|
switch (side) {
|
|
122
171
|
case "top":
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
cursorPointTwo = [isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 + buffer + 1],
|
|
126
|
-
commonPoints = [[rect.left, cursorLeaveFromRight || isFloatingWider ? rect.bottom - buffer : rect.top], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer]];
|
|
127
|
-
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
128
|
-
}
|
|
172
|
+
rectPoly = [[left, refRect.top + 1], [left, rect.bottom - 1], [right, rect.bottom - 1], [right, refRect.top + 1]];
|
|
173
|
+
break;
|
|
129
174
|
case "bottom":
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
cursorPointTwo = [isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 - buffer],
|
|
133
|
-
commonPoints = [[rect.left, cursorLeaveFromRight || isFloatingWider ? rect.top + buffer : rect.bottom], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer]];
|
|
134
|
-
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
135
|
-
}
|
|
175
|
+
rectPoly = [[left, rect.top + 1], [left, refRect.bottom - 1], [right, refRect.bottom - 1], [right, rect.top + 1]];
|
|
176
|
+
break;
|
|
136
177
|
case "left":
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
cursorPointTwo = [x2 + buffer + 1, isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4];
|
|
140
|
-
return [...[[cursorLeaveFromBottom || isFloatingTaller ? rect.right - buffer : rect.left, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, rect.bottom]], cursorPointOne, cursorPointTwo];
|
|
141
|
-
}
|
|
178
|
+
rectPoly = [[rect.right - 1, bottom], [rect.right - 1, top], [refRect.left + 1, top], [refRect.left + 1, bottom]];
|
|
179
|
+
break;
|
|
142
180
|
case "right":
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
cursorPointTwo = [x2 - buffer, isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4],
|
|
146
|
-
commonPoints = [[cursorLeaveFromBottom || isFloatingTaller ? rect.left + buffer : rect.right, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, rect.bottom]];
|
|
147
|
-
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
148
|
-
}
|
|
181
|
+
rectPoly = [[refRect.right - 1, bottom], [refRect.right - 1, top], [rect.left + 1, top], [rect.left + 1, bottom]];
|
|
182
|
+
break;
|
|
149
183
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
184
|
+
function getPolygon([x2, y2]) {
|
|
185
|
+
switch (side) {
|
|
186
|
+
case "top":
|
|
187
|
+
{
|
|
188
|
+
const cursorPointOne = [isFloatingWider ? x2 + buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 + buffer + 1];
|
|
189
|
+
const cursorPointTwo = [isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 + buffer + 1];
|
|
190
|
+
const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer]];
|
|
191
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
192
|
+
}
|
|
193
|
+
case "bottom":
|
|
194
|
+
{
|
|
195
|
+
const cursorPointOne = [isFloatingWider ? x2 + buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 - buffer];
|
|
196
|
+
const cursorPointTwo = [isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 - buffer];
|
|
197
|
+
const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer]];
|
|
198
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
199
|
+
}
|
|
200
|
+
case "left":
|
|
201
|
+
{
|
|
202
|
+
const cursorPointOne = [x2 + buffer + 1, isFloatingTaller ? y2 + buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4];
|
|
203
|
+
const cursorPointTwo = [x2 + buffer + 1, isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4];
|
|
204
|
+
const commonPoints = [[cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, rect.bottom]];
|
|
205
|
+
return [...commonPoints, cursorPointOne, cursorPointTwo];
|
|
206
|
+
}
|
|
207
|
+
case "right":
|
|
208
|
+
{
|
|
209
|
+
const cursorPointOne = [x2 - buffer, isFloatingTaller ? y2 + buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4];
|
|
210
|
+
const cursorPointTwo = [x2 - buffer, isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4];
|
|
211
|
+
const commonPoints = [[cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, rect.bottom]];
|
|
212
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
213
|
+
}
|
|
158
214
|
}
|
|
159
|
-
__debug && debugClear(), close();
|
|
160
215
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
216
|
+
const poly = getPolygon([x, y]);
|
|
217
|
+
if (__debug) {
|
|
218
|
+
debugDrawPolygon(poly, rectPoly, clientPoint, [x, y]);
|
|
219
|
+
}
|
|
220
|
+
if (isPointInPolygon([clientX, clientY], rectPoly)) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (hasLanded && !isOverReferenceRect) {
|
|
224
|
+
if (__debug) debugClear();
|
|
225
|
+
return close();
|
|
226
|
+
}
|
|
227
|
+
if (isPointInPolygon([clientX, clientY], poly)) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (!isLeave && requireIntent) {
|
|
231
|
+
const cursorSpeed = getCursorSpeed(clientX, clientY);
|
|
232
|
+
const cursorSpeedThreshold = 0.1;
|
|
233
|
+
if (cursorSpeed !== null && cursorSpeed < cursorSpeedThreshold) {
|
|
234
|
+
if (__debug) debugClear();
|
|
235
|
+
return close();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (__debug) debugClear();
|
|
239
|
+
close();
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
fn.__options = {
|
|
164
243
|
blockPointerEvents
|
|
165
|
-
}
|
|
244
|
+
};
|
|
245
|
+
return fn;
|
|
166
246
|
}
|
|
167
247
|
export { safePolygon };
|
|
168
248
|
//# sourceMappingURL=safePolygon.mjs.map
|