@darajs/ui-causal-graph-editor 0.4.8
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/LICENSE +201 -0
- package/README.md +12 -0
- package/dist/CanvasPool.5cd3cdcd.js +30 -0
- package/dist/SharedSystems.140ebe02.js +1905 -0
- package/dist/WebGLRenderer.6ede660f.js +2241 -0
- package/dist/WebGPURenderer.f884c756.js +1544 -0
- package/dist/browserAll.2dcaa9f7.js +953 -0
- package/dist/colorToUniform.7c604fe6.js +76 -0
- package/dist/index.a01cfc5f.js +61895 -0
- package/dist/index.js +35 -0
- package/dist/index.umd.cjs +10287 -0
- package/dist/init.73e5c5e2.js +2602 -0
- package/dist/style.css +1 -0
- package/dist/types/graph-viewer/causal-graph-editor.d.ts +58 -0
- package/dist/types/graph-viewer/causal-graph-editor.d.ts.map +1 -0
- package/dist/types/graph-viewer/storybook/stories-utils.d.ts +1247 -0
- package/dist/types/graph-viewer/storybook/stories-utils.d.ts.map +1 -0
- package/dist/types/graph-viewer/utils/use-iterate-edges.d.ts +32 -0
- package/dist/types/graph-viewer/utils/use-iterate-edges.d.ts.map +1 -0
- package/dist/types/graph-viewer/utils/use-iterate-nodes.d.ts +32 -0
- package/dist/types/graph-viewer/utils/use-iterate-nodes.d.ts.map +1 -0
- package/dist/types/index.d.ts +32 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/jest-setup.d.ts +18 -0
- package/dist/types/jest-setup.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/index.d.ts +19 -0
- package/dist/types/node-hierarchy-builder/index.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/layer-divider.d.ts +15 -0
- package/dist/types/node-hierarchy-builder/layer-divider.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/layer-label-editor.d.ts +24 -0
- package/dist/types/node-hierarchy-builder/layer-label-editor.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/layer.d.ts +35 -0
- package/dist/types/node-hierarchy-builder/layer.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/node-hierarchy-builder.d.ts +27 -0
- package/dist/types/node-hierarchy-builder/node-hierarchy-builder.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/node.d.ts +21 -0
- package/dist/types/node-hierarchy-builder/node.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/shared.d.ts +93 -0
- package/dist/types/node-hierarchy-builder/shared.d.ts.map +1 -0
- package/dist/types/shared/causal-graph-store.d.ts +118 -0
- package/dist/types/shared/causal-graph-store.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/add-node-button.d.ts +25 -0
- package/dist/types/shared/editor-overlay/buttons/add-node-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/center-graph-button.d.ts +7 -0
- package/dist/types/shared/editor-overlay/buttons/center-graph-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/collapse-all-button.d.ts +7 -0
- package/dist/types/shared/editor-overlay/buttons/collapse-all-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/collapse-expand-button.d.ts +26 -0
- package/dist/types/shared/editor-overlay/buttons/collapse-expand-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/drag-mode-button.d.ts +27 -0
- package/dist/types/shared/editor-overlay/buttons/drag-mode-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/index.d.ts +24 -0
- package/dist/types/shared/editor-overlay/buttons/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/recalculate-layout-button.d.ts +7 -0
- package/dist/types/shared/editor-overlay/buttons/recalculate-layout-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/save-image-button.d.ts +7 -0
- package/dist/types/shared/editor-overlay/buttons/save-image-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/soft-edge-arrow-button.d.ts +19 -0
- package/dist/types/shared/editor-overlay/buttons/soft-edge-arrow-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/floating-elements.d.ts +29 -0
- package/dist/types/shared/editor-overlay/floating-elements.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/index.d.ts +22 -0
- package/dist/types/shared/editor-overlay/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/legend/index.d.ts +19 -0
- package/dist/types/shared/editor-overlay/legend/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/legend/legend-data.d.ts +49 -0
- package/dist/types/shared/editor-overlay/legend/legend-data.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/legend/legend-list.d.ts +6 -0
- package/dist/types/shared/editor-overlay/legend/legend-list.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/legend/legend.d.ts +7 -0
- package/dist/types/shared/editor-overlay/legend/legend.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/overlay.d.ts +42 -0
- package/dist/types/shared/editor-overlay/overlay.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/edge-editor.d.ts +8 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/edge-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/edge-info-content.d.ts +41 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/edge-info-content.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/editor-props.d.ts +35 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/editor-props.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/encoder-editor.d.ts +23 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/encoder-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/index.d.ts +18 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/pag-editor.d.ts +23 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/pag-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/resolver-editor.d.ts +7 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/resolver-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/constraint-editor.d.ts +27 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/constraint-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/description-editor.d.ts +15 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/description-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/direction-editor.d.ts +21 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/direction-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/edge-type-editor.d.ts +17 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/edge-type-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/index.d.ts +19 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/index.d.ts +20 -0
- package/dist/types/shared/editor-overlay/panel-content/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/node/index.d.ts +18 -0
- package/dist/types/shared/editor-overlay/panel-content/node/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/node/label-editor.d.ts +11 -0
- package/dist/types/shared/editor-overlay/panel-content/node/label-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/node/node-info-content.d.ts +34 -0
- package/dist/types/shared/editor-overlay/panel-content/node/node-info-content.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/panel-content.d.ts +17 -0
- package/dist/types/shared/editor-overlay/panel-content/panel-content.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/panel-title.d.ts +12 -0
- package/dist/types/shared/editor-overlay/panel-content/panel-title.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/styled.d.ts +9 -0
- package/dist/types/shared/editor-overlay/panel-content/styled.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/positional-divs.d.ts +25 -0
- package/dist/types/shared/editor-overlay/positional-divs.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/search-bar/index.d.ts +19 -0
- package/dist/types/shared/editor-overlay/search-bar/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/search-bar/search-bar.d.ts +21 -0
- package/dist/types/shared/editor-overlay/search-bar/search-bar.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/search-bar/use-search.d.ts +32 -0
- package/dist/types/shared/editor-overlay/search-bar/use-search.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/zoom-prompt.d.ts +9 -0
- package/dist/types/shared/editor-overlay/zoom-prompt.d.ts.map +1 -0
- package/dist/types/shared/graph-context.d.ts +26 -0
- package/dist/types/shared/graph-context.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/circular-layout.d.ts +32 -0
- package/dist/types/shared/graph-layout/circular-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/common.d.ts +96 -0
- package/dist/types/shared/graph-layout/common.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/custom-layout.d.ts +36 -0
- package/dist/types/shared/graph-layout/custom-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/fcose-layout.d.ts +132 -0
- package/dist/types/shared/graph-layout/fcose-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/force-atlas-layout.d.ts +103 -0
- package/dist/types/shared/graph-layout/force-atlas-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/index.d.ts +25 -0
- package/dist/types/shared/graph-layout/index.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/marketing-layout.d.ts +63 -0
- package/dist/types/shared/graph-layout/marketing-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/planar-layout.d.ts +67 -0
- package/dist/types/shared/graph-layout/planar-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/spring-layout.d.ts +101 -0
- package/dist/types/shared/graph-layout/spring-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/circular.d.ts +5 -0
- package/dist/types/shared/graph-layout/worker/circular.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/client.d.ts +22 -0
- package/dist/types/shared/graph-layout/worker/client.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/fcose.d.ts +18 -0
- package/dist/types/shared/graph-layout/worker/fcose.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/force-atlas.d.ts +5 -0
- package/dist/types/shared/graph-layout/worker/force-atlas.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/marketing.d.ts +5 -0
- package/dist/types/shared/graph-layout/worker/marketing.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/planar.d.ts +5 -0
- package/dist/types/shared/graph-layout/worker/planar.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/spring.d.ts +19 -0
- package/dist/types/shared/graph-layout/worker/spring.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/worker.d.ts +27 -0
- package/dist/types/shared/graph-layout/worker/worker.d.ts.map +1 -0
- package/dist/types/shared/parsers.d.ts +43 -0
- package/dist/types/shared/parsers.d.ts.map +1 -0
- package/dist/types/shared/pointer-context.d.ts +20 -0
- package/dist/types/shared/pointer-context.d.ts.map +1 -0
- package/dist/types/shared/rendering/background.d.ts +48 -0
- package/dist/types/shared/rendering/background.d.ts.map +1 -0
- package/dist/types/shared/rendering/colors.d.ts +27 -0
- package/dist/types/shared/rendering/colors.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/curve.d.ts +51 -0
- package/dist/types/shared/rendering/edge/curve.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/definitions.d.ts +73 -0
- package/dist/types/shared/rendering/edge/definitions.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/edge-object.d.ts +93 -0
- package/dist/types/shared/rendering/edge/edge-object.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/index.d.ts +19 -0
- package/dist/types/shared/rendering/edge/index.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/symbols.d.ts +40 -0
- package/dist/types/shared/rendering/edge/symbols.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/utils.d.ts +27 -0
- package/dist/types/shared/rendering/edge/utils.d.ts.map +1 -0
- package/dist/types/shared/rendering/engine.d.ts +436 -0
- package/dist/types/shared/rendering/engine.d.ts.map +1 -0
- package/dist/types/shared/rendering/grouping/group-container-object.d.ts +56 -0
- package/dist/types/shared/rendering/grouping/group-container-object.d.ts.map +1 -0
- package/dist/types/shared/rendering/grouping/index.d.ts +2 -0
- package/dist/types/shared/rendering/grouping/index.d.ts.map +1 -0
- package/dist/types/shared/rendering/node/definitions.d.ts +59 -0
- package/dist/types/shared/rendering/node/definitions.d.ts.map +1 -0
- package/dist/types/shared/rendering/node/index.d.ts +20 -0
- package/dist/types/shared/rendering/node/index.d.ts.map +1 -0
- package/dist/types/shared/rendering/node/node-object.d.ts +78 -0
- package/dist/types/shared/rendering/node/node-object.d.ts.map +1 -0
- package/dist/types/shared/rendering/node/utils.d.ts +33 -0
- package/dist/types/shared/rendering/node/utils.d.ts.map +1 -0
- package/dist/types/shared/rendering/svg.d.ts +26 -0
- package/dist/types/shared/rendering/svg.d.ts.map +1 -0
- package/dist/types/shared/rendering/text.d.ts +33 -0
- package/dist/types/shared/rendering/text.d.ts.map +1 -0
- package/dist/types/shared/rendering/texture-cache.d.ts +47 -0
- package/dist/types/shared/rendering/texture-cache.d.ts.map +1 -0
- package/dist/types/shared/rendering/use-render-engine.d.ts +115 -0
- package/dist/types/shared/rendering/use-render-engine.d.ts.map +1 -0
- package/dist/types/shared/rendering/utils.d.ts +27 -0
- package/dist/types/shared/rendering/utils.d.ts.map +1 -0
- package/dist/types/shared/serializer.d.ts +39 -0
- package/dist/types/shared/serializer.d.ts.map +1 -0
- package/dist/types/shared/settings-context.d.ts +56 -0
- package/dist/types/shared/settings-context.d.ts.map +1 -0
- package/dist/types/shared/styles.d.ts +4 -0
- package/dist/types/shared/styles.d.ts.map +1 -0
- package/dist/types/shared/use-causal-graph-editor.d.ts +22 -0
- package/dist/types/shared/use-causal-graph-editor.d.ts.map +1 -0
- package/dist/types/shared/use-drag-mode.d.ts +33 -0
- package/dist/types/shared/use-drag-mode.d.ts.map +1 -0
- package/dist/types/shared/use-edge-encoder.d.ts +45 -0
- package/dist/types/shared/use-edge-encoder.d.ts.map +1 -0
- package/dist/types/shared/use-graph-tooltip.d.ts +15 -0
- package/dist/types/shared/use-graph-tooltip.d.ts.map +1 -0
- package/dist/types/shared/use-pane-visibility.d.ts +12 -0
- package/dist/types/shared/use-pane-visibility.d.ts.map +1 -0
- package/dist/types/shared/utils.d.ts +79 -0
- package/dist/types/shared/utils.d.ts.map +1 -0
- package/dist/types/types.d.ts +277 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/webworkerAll.2e3715a5.js +7 -0
- package/package.json +120 -0
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
import { P as y, r as Q, E as w, T as L, U as ee, a as te, w as E, e as Z, C as V } from "./index.a01cfc5f.js";
|
|
2
|
+
import "./init.73e5c5e2.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "styled-components";
|
|
5
|
+
import "react-dom";
|
|
6
|
+
import "./colorToUniform.7c604fe6.js";
|
|
7
|
+
import "./CanvasPool.5cd3cdcd.js";
|
|
8
|
+
class M {
|
|
9
|
+
constructor(e) {
|
|
10
|
+
this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = M.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = new y(), this.page = new y(), this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = e;
|
|
11
|
+
}
|
|
12
|
+
get layerX() {
|
|
13
|
+
return this.layer.x;
|
|
14
|
+
}
|
|
15
|
+
get layerY() {
|
|
16
|
+
return this.layer.y;
|
|
17
|
+
}
|
|
18
|
+
get pageX() {
|
|
19
|
+
return this.page.x;
|
|
20
|
+
}
|
|
21
|
+
get pageY() {
|
|
22
|
+
return this.page.y;
|
|
23
|
+
}
|
|
24
|
+
get data() {
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
composedPath() {
|
|
28
|
+
return this.manager && (!this.path || this.path[this.path.length - 1] !== this.target) && (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.path;
|
|
29
|
+
}
|
|
30
|
+
initEvent(e, t, i) {
|
|
31
|
+
throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
|
|
32
|
+
}
|
|
33
|
+
initUIEvent(e, t, i, n, s) {
|
|
34
|
+
throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
|
|
35
|
+
}
|
|
36
|
+
preventDefault() {
|
|
37
|
+
this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.preventDefault(), this.defaultPrevented = !0;
|
|
38
|
+
}
|
|
39
|
+
stopImmediatePropagation() {
|
|
40
|
+
this.propagationImmediatelyStopped = !0;
|
|
41
|
+
}
|
|
42
|
+
stopPropagation() {
|
|
43
|
+
this.propagationStopped = !0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
var O = /iPhone/i, C = /iPod/i, S = /iPad/i, U = /\biOS-universal(?:.+)Mac\b/i, k = /\bAndroid(?:.+)Mobile\b/i, H = /Android/i, b = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i, A = /Silk/i, m = /Windows Phone/i, X = /\bWindows(?:.+)ARM\b/i, R = /BlackBerry/i, F = /BB10/i, Y = /Opera Mini/i, K = /\b(CriOS|Chrome)(?:.+)Mobile/i, $ = /Mobile(?:.+)Firefox\b/i, G = function(a) {
|
|
47
|
+
return typeof a < "u" && a.platform === "MacIntel" && typeof a.maxTouchPoints == "number" && a.maxTouchPoints > 1 && typeof MSStream > "u";
|
|
48
|
+
};
|
|
49
|
+
function ie(a) {
|
|
50
|
+
return function(e) {
|
|
51
|
+
return e.test(a);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function W(a) {
|
|
55
|
+
var e = {
|
|
56
|
+
userAgent: "",
|
|
57
|
+
platform: "",
|
|
58
|
+
maxTouchPoints: 0
|
|
59
|
+
};
|
|
60
|
+
!a && typeof navigator < "u" ? e = {
|
|
61
|
+
userAgent: navigator.userAgent,
|
|
62
|
+
platform: navigator.platform,
|
|
63
|
+
maxTouchPoints: navigator.maxTouchPoints || 0
|
|
64
|
+
} : typeof a == "string" ? e.userAgent = a : a && a.userAgent && (e = {
|
|
65
|
+
userAgent: a.userAgent,
|
|
66
|
+
platform: a.platform,
|
|
67
|
+
maxTouchPoints: a.maxTouchPoints || 0
|
|
68
|
+
});
|
|
69
|
+
var t = e.userAgent, i = t.split("[FBAN");
|
|
70
|
+
typeof i[1] < "u" && (t = i[0]), i = t.split("Twitter"), typeof i[1] < "u" && (t = i[0]);
|
|
71
|
+
var n = ie(t), s = {
|
|
72
|
+
apple: {
|
|
73
|
+
phone: n(O) && !n(m),
|
|
74
|
+
ipod: n(C),
|
|
75
|
+
tablet: !n(O) && (n(S) || G(e)) && !n(m),
|
|
76
|
+
universal: n(U),
|
|
77
|
+
device: (n(O) || n(C) || n(S) || n(U) || G(e)) && !n(m)
|
|
78
|
+
},
|
|
79
|
+
amazon: {
|
|
80
|
+
phone: n(b),
|
|
81
|
+
tablet: !n(b) && n(A),
|
|
82
|
+
device: n(b) || n(A)
|
|
83
|
+
},
|
|
84
|
+
android: {
|
|
85
|
+
phone: !n(m) && n(b) || !n(m) && n(k),
|
|
86
|
+
tablet: !n(m) && !n(b) && !n(k) && (n(A) || n(H)),
|
|
87
|
+
device: !n(m) && (n(b) || n(A) || n(k) || n(H)) || n(/\bokhttp\b/i)
|
|
88
|
+
},
|
|
89
|
+
windows: {
|
|
90
|
+
phone: n(m),
|
|
91
|
+
tablet: n(X),
|
|
92
|
+
device: n(m) || n(X)
|
|
93
|
+
},
|
|
94
|
+
other: {
|
|
95
|
+
blackberry: n(R),
|
|
96
|
+
blackberry10: n(F),
|
|
97
|
+
opera: n(Y),
|
|
98
|
+
firefox: n($),
|
|
99
|
+
chrome: n(K),
|
|
100
|
+
device: n(R) || n(F) || n(Y) || n($) || n(K)
|
|
101
|
+
},
|
|
102
|
+
any: !1,
|
|
103
|
+
phone: !1,
|
|
104
|
+
tablet: !1
|
|
105
|
+
};
|
|
106
|
+
return s.any = s.apple.device || s.android.device || s.windows.device || s.other.device, s.phone = s.apple.phone || s.android.phone || s.windows.phone, s.tablet = s.apple.tablet || s.android.tablet || s.windows.tablet, s;
|
|
107
|
+
}
|
|
108
|
+
var z;
|
|
109
|
+
const ne = (z = W.default) != null ? z : W, se = ne(globalThis.navigator), oe = 9, I = 100, re = 0, ae = 0, j = 2, N = 1, he = -1e3, le = -1e3, ue = 2;
|
|
110
|
+
class q {
|
|
111
|
+
constructor(e, t = se) {
|
|
112
|
+
this._mobileInfo = t, this.debug = !1, this._isActive = !1, this._isMobileAccessibility = !1, this._pool = [], this._renderId = 0, this._children = [], this._androidUpdateCount = 0, this._androidUpdateFrequency = 500, this._hookDiv = null, (t.tablet || t.phone) && this._createTouchHook();
|
|
113
|
+
const i = document.createElement("div");
|
|
114
|
+
i.style.width = `${I}px`, i.style.height = `${I}px`, i.style.position = "absolute", i.style.top = `${re}px`, i.style.left = `${ae}px`, i.style.zIndex = j.toString(), this._div = i, this._renderer = e, this._onKeyDown = this._onKeyDown.bind(this), this._onMouseMove = this._onMouseMove.bind(this), globalThis.addEventListener("keydown", this._onKeyDown, !1);
|
|
115
|
+
}
|
|
116
|
+
get isActive() {
|
|
117
|
+
return this._isActive;
|
|
118
|
+
}
|
|
119
|
+
get isMobileAccessibility() {
|
|
120
|
+
return this._isMobileAccessibility;
|
|
121
|
+
}
|
|
122
|
+
get hookDiv() {
|
|
123
|
+
return this._hookDiv;
|
|
124
|
+
}
|
|
125
|
+
_createTouchHook() {
|
|
126
|
+
const e = document.createElement("button");
|
|
127
|
+
e.style.width = `${N}px`, e.style.height = `${N}px`, e.style.position = "absolute", e.style.top = `${he}px`, e.style.left = `${le}px`, e.style.zIndex = ue.toString(), e.style.backgroundColor = "#FF0000", e.title = "select to enable accessibility for this content", e.addEventListener("focus", () => {
|
|
128
|
+
this._isMobileAccessibility = !0, this._activate(), this._destroyTouchHook();
|
|
129
|
+
}), document.body.appendChild(e), this._hookDiv = e;
|
|
130
|
+
}
|
|
131
|
+
_destroyTouchHook() {
|
|
132
|
+
!this._hookDiv || (document.body.removeChild(this._hookDiv), this._hookDiv = null);
|
|
133
|
+
}
|
|
134
|
+
_activate() {
|
|
135
|
+
var e;
|
|
136
|
+
this._isActive || (this._isActive = !0, globalThis.document.addEventListener("mousemove", this._onMouseMove, !0), globalThis.removeEventListener("keydown", this._onKeyDown, !1), this._renderer.runners.postrender.add(this), (e = this._renderer.view.canvas.parentNode) == null || e.appendChild(this._div));
|
|
137
|
+
}
|
|
138
|
+
_deactivate() {
|
|
139
|
+
var e;
|
|
140
|
+
!this._isActive || this._isMobileAccessibility || (this._isActive = !1, globalThis.document.removeEventListener("mousemove", this._onMouseMove, !0), globalThis.addEventListener("keydown", this._onKeyDown, !1), this._renderer.runners.postrender.remove(this), (e = this._div.parentNode) == null || e.removeChild(this._div));
|
|
141
|
+
}
|
|
142
|
+
_updateAccessibleObjects(e) {
|
|
143
|
+
if (!e.visible || !e.accessibleChildren)
|
|
144
|
+
return;
|
|
145
|
+
e.accessible && e.isInteractive() && (e._accessibleActive || this._addChild(e), e._renderId = this._renderId);
|
|
146
|
+
const t = e.children;
|
|
147
|
+
if (t)
|
|
148
|
+
for (let i = 0; i < t.length; i++)
|
|
149
|
+
this._updateAccessibleObjects(t[i]);
|
|
150
|
+
}
|
|
151
|
+
init(e) {
|
|
152
|
+
var t;
|
|
153
|
+
this.debug = (t = e == null ? void 0 : e.debug) != null ? t : this.debug, this._renderer.runners.postrender.remove(this);
|
|
154
|
+
}
|
|
155
|
+
postrender() {
|
|
156
|
+
const e = performance.now();
|
|
157
|
+
if (this._mobileInfo.android.device && e < this._androidUpdateCount || (this._androidUpdateCount = e + this._androidUpdateFrequency, !this._renderer.renderingToScreen || !this._renderer.view.canvas))
|
|
158
|
+
return;
|
|
159
|
+
this._renderer.lastObjectRendered && this._updateAccessibleObjects(this._renderer.lastObjectRendered);
|
|
160
|
+
const { x: t, y: i, width: n, height: s } = this._renderer.view.canvas.getBoundingClientRect(), { width: o, height: h, resolution: u } = this._renderer, p = n / o * u, v = s / h * u;
|
|
161
|
+
let l = this._div;
|
|
162
|
+
l.style.left = `${t}px`, l.style.top = `${i}px`, l.style.width = `${o}px`, l.style.height = `${h}px`;
|
|
163
|
+
for (let d = 0; d < this._children.length; d++) {
|
|
164
|
+
const r = this._children[d];
|
|
165
|
+
if (r._renderId !== this._renderId)
|
|
166
|
+
r._accessibleActive = !1, Q(this._children, d, 1), this._div.removeChild(r._accessibleDiv), this._pool.push(r._accessibleDiv), r._accessibleDiv = null, d--;
|
|
167
|
+
else {
|
|
168
|
+
l = r._accessibleDiv;
|
|
169
|
+
let f = r.hitArea;
|
|
170
|
+
const c = r.worldTransform;
|
|
171
|
+
r.hitArea ? (l.style.left = `${(c.tx + f.x * c.a) * p}px`, l.style.top = `${(c.ty + f.y * c.d) * v}px`, l.style.width = `${f.width * c.a * p}px`, l.style.height = `${f.height * c.d * v}px`) : (f = r.getBounds().rectangle, this._capHitArea(f), l.style.left = `${f.x * p}px`, l.style.top = `${f.y * v}px`, l.style.width = `${f.width * p}px`, l.style.height = `${f.height * v}px`, l.title !== r.accessibleTitle && r.accessibleTitle !== null && (l.title = r.accessibleTitle || ""), l.getAttribute("aria-label") !== r.accessibleHint && r.accessibleHint !== null && l.setAttribute("aria-label", r.accessibleHint || "")), (r.accessibleTitle !== l.title || r.tabIndex !== l.tabIndex) && (l.title = r.accessibleTitle || "", l.tabIndex = r.tabIndex, this.debug && this._updateDebugHTML(l));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
this._renderId++;
|
|
175
|
+
}
|
|
176
|
+
_updateDebugHTML(e) {
|
|
177
|
+
e.innerHTML = `type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`;
|
|
178
|
+
}
|
|
179
|
+
_capHitArea(e) {
|
|
180
|
+
e.x < 0 && (e.width += e.x, e.x = 0), e.y < 0 && (e.height += e.y, e.y = 0);
|
|
181
|
+
const { width: t, height: i } = this._renderer;
|
|
182
|
+
e.x + e.width > t && (e.width = t - e.x), e.y + e.height > i && (e.height = i - e.y);
|
|
183
|
+
}
|
|
184
|
+
_addChild(e) {
|
|
185
|
+
let t = this._pool.pop();
|
|
186
|
+
t || (t = document.createElement("button"), t.style.width = `${I}px`, t.style.height = `${I}px`, t.style.backgroundColor = this.debug ? "rgba(255,255,255,0.5)" : "transparent", t.style.position = "absolute", t.style.zIndex = j.toString(), t.style.borderStyle = "none", navigator.userAgent.toLowerCase().includes("chrome") ? t.setAttribute("aria-live", "off") : t.setAttribute("aria-live", "polite"), navigator.userAgent.match(/rv:.*Gecko\//) ? t.setAttribute("aria-relevant", "additions") : t.setAttribute("aria-relevant", "text"), t.addEventListener("click", this._onClick.bind(this)), t.addEventListener("focus", this._onFocus.bind(this)), t.addEventListener("focusout", this._onFocusOut.bind(this))), t.style.pointerEvents = e.accessiblePointerEvents, t.type = e.accessibleType, e.accessibleTitle && e.accessibleTitle !== null ? t.title = e.accessibleTitle : (!e.accessibleHint || e.accessibleHint === null) && (t.title = `container ${e.tabIndex}`), e.accessibleHint && e.accessibleHint !== null && t.setAttribute("aria-label", e.accessibleHint), this.debug && this._updateDebugHTML(t), e._accessibleActive = !0, e._accessibleDiv = t, t.container = e, this._children.push(e), this._div.appendChild(e._accessibleDiv), e._accessibleDiv.tabIndex = e.tabIndex;
|
|
187
|
+
}
|
|
188
|
+
_dispatchEvent(e, t) {
|
|
189
|
+
const { container: i } = e.target, n = this._renderer.events.rootBoundary, s = Object.assign(new M(n), { target: i });
|
|
190
|
+
n.rootTarget = this._renderer.lastObjectRendered, t.forEach((o) => n.dispatchEvent(s, o));
|
|
191
|
+
}
|
|
192
|
+
_onClick(e) {
|
|
193
|
+
this._dispatchEvent(e, ["click", "pointertap", "tap"]);
|
|
194
|
+
}
|
|
195
|
+
_onFocus(e) {
|
|
196
|
+
e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "assertive"), this._dispatchEvent(e, ["mouseover"]);
|
|
197
|
+
}
|
|
198
|
+
_onFocusOut(e) {
|
|
199
|
+
e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "polite"), this._dispatchEvent(e, ["mouseout"]);
|
|
200
|
+
}
|
|
201
|
+
_onKeyDown(e) {
|
|
202
|
+
e.keyCode === oe && this._activate();
|
|
203
|
+
}
|
|
204
|
+
_onMouseMove(e) {
|
|
205
|
+
e.movementX === 0 && e.movementY === 0 || this._deactivate();
|
|
206
|
+
}
|
|
207
|
+
destroy() {
|
|
208
|
+
this._destroyTouchHook(), this._div = null, globalThis.document.removeEventListener("mousemove", this._onMouseMove, !0), globalThis.removeEventListener("keydown", this._onKeyDown), this._pool = null, this._children = null, this._renderer = null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
q.extension = {
|
|
212
|
+
type: [
|
|
213
|
+
w.WebGLSystem,
|
|
214
|
+
w.WebGPUSystem
|
|
215
|
+
],
|
|
216
|
+
name: "accessibility"
|
|
217
|
+
};
|
|
218
|
+
const de = {
|
|
219
|
+
accessible: !1,
|
|
220
|
+
accessibleTitle: null,
|
|
221
|
+
accessibleHint: null,
|
|
222
|
+
tabIndex: 0,
|
|
223
|
+
_accessibleActive: !1,
|
|
224
|
+
_accessibleDiv: null,
|
|
225
|
+
accessibleType: "button",
|
|
226
|
+
accessiblePointerEvents: "auto",
|
|
227
|
+
accessibleChildren: !0,
|
|
228
|
+
_renderId: -1
|
|
229
|
+
};
|
|
230
|
+
class ce {
|
|
231
|
+
constructor() {
|
|
232
|
+
this.interactionFrequency = 10, this._deltaTime = 0, this._didMove = !1, this._tickerAdded = !1, this._pauseUpdate = !0;
|
|
233
|
+
}
|
|
234
|
+
init(e) {
|
|
235
|
+
this.removeTickerListener(), this.events = e, this.interactionFrequency = 10, this._deltaTime = 0, this._didMove = !1, this._tickerAdded = !1, this._pauseUpdate = !0;
|
|
236
|
+
}
|
|
237
|
+
get pauseUpdate() {
|
|
238
|
+
return this._pauseUpdate;
|
|
239
|
+
}
|
|
240
|
+
set pauseUpdate(e) {
|
|
241
|
+
this._pauseUpdate = e;
|
|
242
|
+
}
|
|
243
|
+
addTickerListener() {
|
|
244
|
+
this._tickerAdded || !this.domElement || (L.system.add(this._tickerUpdate, this, ee.INTERACTION), this._tickerAdded = !0);
|
|
245
|
+
}
|
|
246
|
+
removeTickerListener() {
|
|
247
|
+
!this._tickerAdded || (L.system.remove(this._tickerUpdate, this), this._tickerAdded = !1);
|
|
248
|
+
}
|
|
249
|
+
pointerMoved() {
|
|
250
|
+
this._didMove = !0;
|
|
251
|
+
}
|
|
252
|
+
_update() {
|
|
253
|
+
if (!this.domElement || this._pauseUpdate)
|
|
254
|
+
return;
|
|
255
|
+
if (this._didMove) {
|
|
256
|
+
this._didMove = !1;
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const e = this.events._rootPointerEvent;
|
|
260
|
+
this.events.supportsTouchEvents && e.pointerType === "touch" || globalThis.document.dispatchEvent(new PointerEvent("pointermove", {
|
|
261
|
+
clientX: e.clientX,
|
|
262
|
+
clientY: e.clientY,
|
|
263
|
+
pointerType: e.pointerType,
|
|
264
|
+
pointerId: e.pointerId
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
_tickerUpdate(e) {
|
|
268
|
+
this._deltaTime += e.deltaTime, !(this._deltaTime < this.interactionFrequency) && (this._deltaTime = 0, this._update());
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const _ = new ce();
|
|
272
|
+
class D extends M {
|
|
273
|
+
constructor() {
|
|
274
|
+
super(...arguments), this.client = new y(), this.movement = new y(), this.offset = new y(), this.global = new y(), this.screen = new y();
|
|
275
|
+
}
|
|
276
|
+
get clientX() {
|
|
277
|
+
return this.client.x;
|
|
278
|
+
}
|
|
279
|
+
get clientY() {
|
|
280
|
+
return this.client.y;
|
|
281
|
+
}
|
|
282
|
+
get x() {
|
|
283
|
+
return this.clientX;
|
|
284
|
+
}
|
|
285
|
+
get y() {
|
|
286
|
+
return this.clientY;
|
|
287
|
+
}
|
|
288
|
+
get movementX() {
|
|
289
|
+
return this.movement.x;
|
|
290
|
+
}
|
|
291
|
+
get movementY() {
|
|
292
|
+
return this.movement.y;
|
|
293
|
+
}
|
|
294
|
+
get offsetX() {
|
|
295
|
+
return this.offset.x;
|
|
296
|
+
}
|
|
297
|
+
get offsetY() {
|
|
298
|
+
return this.offset.y;
|
|
299
|
+
}
|
|
300
|
+
get globalX() {
|
|
301
|
+
return this.global.x;
|
|
302
|
+
}
|
|
303
|
+
get globalY() {
|
|
304
|
+
return this.global.y;
|
|
305
|
+
}
|
|
306
|
+
get screenX() {
|
|
307
|
+
return this.screen.x;
|
|
308
|
+
}
|
|
309
|
+
get screenY() {
|
|
310
|
+
return this.screen.y;
|
|
311
|
+
}
|
|
312
|
+
getLocalPosition(e, t, i) {
|
|
313
|
+
return e.worldTransform.applyInverse(i || this.global, t);
|
|
314
|
+
}
|
|
315
|
+
getModifierState(e) {
|
|
316
|
+
return "getModifierState" in this.nativeEvent && this.nativeEvent.getModifierState(e);
|
|
317
|
+
}
|
|
318
|
+
initMouseEvent(e, t, i, n, s, o, h, u, p, v, l, d, r, f, c) {
|
|
319
|
+
throw new Error("Method not implemented.");
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
class g extends D {
|
|
323
|
+
constructor() {
|
|
324
|
+
super(...arguments), this.width = 0, this.height = 0, this.isPrimary = !1;
|
|
325
|
+
}
|
|
326
|
+
getCoalescedEvents() {
|
|
327
|
+
return this.type === "pointermove" || this.type === "mousemove" || this.type === "touchmove" ? [this] : [];
|
|
328
|
+
}
|
|
329
|
+
getPredictedEvents() {
|
|
330
|
+
throw new Error("getPredictedEvents is not supported!");
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
class T extends D {
|
|
334
|
+
constructor() {
|
|
335
|
+
super(...arguments), this.DOM_DELTA_PIXEL = 0, this.DOM_DELTA_LINE = 1, this.DOM_DELTA_PAGE = 2;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
T.DOM_DELTA_PIXEL = 0;
|
|
339
|
+
T.DOM_DELTA_LINE = 1;
|
|
340
|
+
T.DOM_DELTA_PAGE = 2;
|
|
341
|
+
const pe = 2048, ve = new y(), P = new y();
|
|
342
|
+
class fe {
|
|
343
|
+
constructor(e) {
|
|
344
|
+
this.dispatch = new te(), this.moveOnAll = !1, this.enableGlobalMoveEvents = !0, this.mappingState = {
|
|
345
|
+
trackingData: {}
|
|
346
|
+
}, this.eventPool = /* @__PURE__ */ new Map(), this._allInteractiveElements = [], this._hitElements = [], this._isPointerMoveEvent = !1, this.rootTarget = e, this.hitPruneFn = this.hitPruneFn.bind(this), this.hitTestFn = this.hitTestFn.bind(this), this.mapPointerDown = this.mapPointerDown.bind(this), this.mapPointerMove = this.mapPointerMove.bind(this), this.mapPointerOut = this.mapPointerOut.bind(this), this.mapPointerOver = this.mapPointerOver.bind(this), this.mapPointerUp = this.mapPointerUp.bind(this), this.mapPointerUpOutside = this.mapPointerUpOutside.bind(this), this.mapWheel = this.mapWheel.bind(this), this.mappingTable = {}, this.addEventMapping("pointerdown", this.mapPointerDown), this.addEventMapping("pointermove", this.mapPointerMove), this.addEventMapping("pointerout", this.mapPointerOut), this.addEventMapping("pointerleave", this.mapPointerOut), this.addEventMapping("pointerover", this.mapPointerOver), this.addEventMapping("pointerup", this.mapPointerUp), this.addEventMapping("pointerupoutside", this.mapPointerUpOutside), this.addEventMapping("wheel", this.mapWheel);
|
|
347
|
+
}
|
|
348
|
+
addEventMapping(e, t) {
|
|
349
|
+
this.mappingTable[e] || (this.mappingTable[e] = []), this.mappingTable[e].push({
|
|
350
|
+
fn: t,
|
|
351
|
+
priority: 0
|
|
352
|
+
}), this.mappingTable[e].sort((i, n) => i.priority - n.priority);
|
|
353
|
+
}
|
|
354
|
+
dispatchEvent(e, t) {
|
|
355
|
+
e.propagationStopped = !1, e.propagationImmediatelyStopped = !1, this.propagate(e, t), this.dispatch.emit(t || e.type, e);
|
|
356
|
+
}
|
|
357
|
+
mapEvent(e) {
|
|
358
|
+
if (!this.rootTarget)
|
|
359
|
+
return;
|
|
360
|
+
const t = this.mappingTable[e.type];
|
|
361
|
+
if (t)
|
|
362
|
+
for (let i = 0, n = t.length; i < n; i++)
|
|
363
|
+
t[i].fn(e);
|
|
364
|
+
else
|
|
365
|
+
E(`[EventBoundary]: Event mapping not defined for ${e.type}`);
|
|
366
|
+
}
|
|
367
|
+
hitTest(e, t) {
|
|
368
|
+
_.pauseUpdate = !0;
|
|
369
|
+
const n = this._isPointerMoveEvent && this.enableGlobalMoveEvents ? "hitTestMoveRecursive" : "hitTestRecursive", s = this[n](
|
|
370
|
+
this.rootTarget,
|
|
371
|
+
this.rootTarget.eventMode,
|
|
372
|
+
ve.set(e, t),
|
|
373
|
+
this.hitTestFn,
|
|
374
|
+
this.hitPruneFn
|
|
375
|
+
);
|
|
376
|
+
return s && s[0];
|
|
377
|
+
}
|
|
378
|
+
propagate(e, t) {
|
|
379
|
+
if (!e.target)
|
|
380
|
+
return;
|
|
381
|
+
const i = e.composedPath();
|
|
382
|
+
e.eventPhase = e.CAPTURING_PHASE;
|
|
383
|
+
for (let n = 0, s = i.length - 1; n < s; n++)
|
|
384
|
+
if (e.currentTarget = i[n], this.notifyTarget(e, t), e.propagationStopped || e.propagationImmediatelyStopped)
|
|
385
|
+
return;
|
|
386
|
+
if (e.eventPhase = e.AT_TARGET, e.currentTarget = e.target, this.notifyTarget(e, t), !(e.propagationStopped || e.propagationImmediatelyStopped)) {
|
|
387
|
+
e.eventPhase = e.BUBBLING_PHASE;
|
|
388
|
+
for (let n = i.length - 2; n >= 0; n--)
|
|
389
|
+
if (e.currentTarget = i[n], this.notifyTarget(e, t), e.propagationStopped || e.propagationImmediatelyStopped)
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
all(e, t, i = this._allInteractiveElements) {
|
|
394
|
+
if (i.length === 0)
|
|
395
|
+
return;
|
|
396
|
+
e.eventPhase = e.BUBBLING_PHASE;
|
|
397
|
+
const n = Array.isArray(t) ? t : [t];
|
|
398
|
+
for (let s = i.length - 1; s >= 0; s--)
|
|
399
|
+
n.forEach((o) => {
|
|
400
|
+
e.currentTarget = i[s], this.notifyTarget(e, o);
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
propagationPath(e) {
|
|
404
|
+
const t = [e];
|
|
405
|
+
for (let i = 0; i < pe && e !== this.rootTarget && e.parent; i++) {
|
|
406
|
+
if (!e.parent)
|
|
407
|
+
throw new Error("Cannot find propagation path to disconnected target");
|
|
408
|
+
t.push(e.parent), e = e.parent;
|
|
409
|
+
}
|
|
410
|
+
return t.reverse(), t;
|
|
411
|
+
}
|
|
412
|
+
hitTestMoveRecursive(e, t, i, n, s, o = !1) {
|
|
413
|
+
let h = !1;
|
|
414
|
+
if (this._interactivePrune(e))
|
|
415
|
+
return null;
|
|
416
|
+
if ((e.eventMode === "dynamic" || t === "dynamic") && (_.pauseUpdate = !1), e.interactiveChildren && e.children) {
|
|
417
|
+
const v = e.children;
|
|
418
|
+
for (let l = v.length - 1; l >= 0; l--) {
|
|
419
|
+
const d = v[l], r = this.hitTestMoveRecursive(
|
|
420
|
+
d,
|
|
421
|
+
this._isInteractive(t) ? t : d.eventMode,
|
|
422
|
+
i,
|
|
423
|
+
n,
|
|
424
|
+
s,
|
|
425
|
+
o || s(e, i)
|
|
426
|
+
);
|
|
427
|
+
if (r) {
|
|
428
|
+
if (r.length > 0 && !r[r.length - 1].parent)
|
|
429
|
+
continue;
|
|
430
|
+
const f = e.isInteractive();
|
|
431
|
+
(r.length > 0 || f) && (f && this._allInteractiveElements.push(e), r.push(e)), this._hitElements.length === 0 && (this._hitElements = r), h = !0;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
const u = this._isInteractive(t), p = e.isInteractive();
|
|
436
|
+
return p && p && this._allInteractiveElements.push(e), o || this._hitElements.length > 0 ? null : h ? this._hitElements : u && !s(e, i) && n(e, i) ? p ? [e] : [] : null;
|
|
437
|
+
}
|
|
438
|
+
hitTestRecursive(e, t, i, n, s) {
|
|
439
|
+
if (this._interactivePrune(e) || s(e, i))
|
|
440
|
+
return null;
|
|
441
|
+
if ((e.eventMode === "dynamic" || t === "dynamic") && (_.pauseUpdate = !1), e.interactiveChildren && e.children) {
|
|
442
|
+
const u = e.children, p = i;
|
|
443
|
+
for (let v = u.length - 1; v >= 0; v--) {
|
|
444
|
+
const l = u[v], d = this.hitTestRecursive(
|
|
445
|
+
l,
|
|
446
|
+
this._isInteractive(t) ? t : l.eventMode,
|
|
447
|
+
p,
|
|
448
|
+
n,
|
|
449
|
+
s
|
|
450
|
+
);
|
|
451
|
+
if (d) {
|
|
452
|
+
if (d.length > 0 && !d[d.length - 1].parent)
|
|
453
|
+
continue;
|
|
454
|
+
const r = e.isInteractive();
|
|
455
|
+
return (d.length > 0 || r) && d.push(e), d;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
const o = this._isInteractive(t), h = e.isInteractive();
|
|
460
|
+
return o && n(e, i) ? h ? [e] : [] : null;
|
|
461
|
+
}
|
|
462
|
+
_isInteractive(e) {
|
|
463
|
+
return e === "static" || e === "dynamic";
|
|
464
|
+
}
|
|
465
|
+
_interactivePrune(e) {
|
|
466
|
+
return !e || !e.visible || !e.renderable || !e.includeInBuild || !e.measurable || e.eventMode === "none" || e.eventMode === "passive" && !e.interactiveChildren;
|
|
467
|
+
}
|
|
468
|
+
hitPruneFn(e, t) {
|
|
469
|
+
if (e.hitArea && (e.worldTransform.applyInverse(t, P), !e.hitArea.contains(P.x, P.y)))
|
|
470
|
+
return !0;
|
|
471
|
+
if (e.effects && e.effects.length)
|
|
472
|
+
for (let i = 0; i < e.effects.length; i++) {
|
|
473
|
+
const n = e.effects[i];
|
|
474
|
+
if (n.containsPoint && !n.containsPoint(t, this.hitTestFn))
|
|
475
|
+
return !0;
|
|
476
|
+
}
|
|
477
|
+
return !1;
|
|
478
|
+
}
|
|
479
|
+
hitTestFn(e, t) {
|
|
480
|
+
return e.hitArea ? !0 : e != null && e.containsPoint ? (e.worldTransform.applyInverse(t, P), e.containsPoint(P)) : !1;
|
|
481
|
+
}
|
|
482
|
+
notifyTarget(e, t) {
|
|
483
|
+
var s, o;
|
|
484
|
+
if (!e.currentTarget.isInteractive())
|
|
485
|
+
return;
|
|
486
|
+
t = t != null ? t : e.type;
|
|
487
|
+
const i = `on${t}`;
|
|
488
|
+
(o = (s = e.currentTarget)[i]) == null || o.call(s, e);
|
|
489
|
+
const n = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? `${t}capture` : t;
|
|
490
|
+
this._notifyListeners(e, n), e.eventPhase === e.AT_TARGET && this._notifyListeners(e, t);
|
|
491
|
+
}
|
|
492
|
+
mapPointerDown(e) {
|
|
493
|
+
if (!(e instanceof g)) {
|
|
494
|
+
E("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
const t = this.createPointerEvent(e);
|
|
498
|
+
if (this.dispatchEvent(t, "pointerdown"), t.pointerType === "touch")
|
|
499
|
+
this.dispatchEvent(t, "touchstart");
|
|
500
|
+
else if (t.pointerType === "mouse" || t.pointerType === "pen") {
|
|
501
|
+
const n = t.button === 2;
|
|
502
|
+
this.dispatchEvent(t, n ? "rightdown" : "mousedown");
|
|
503
|
+
}
|
|
504
|
+
const i = this.trackingData(e.pointerId);
|
|
505
|
+
i.pressTargetsByButton[e.button] = t.composedPath(), this.freeEvent(t);
|
|
506
|
+
}
|
|
507
|
+
mapPointerMove(e) {
|
|
508
|
+
var u, p, v;
|
|
509
|
+
if (!(e instanceof g)) {
|
|
510
|
+
E("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
this._allInteractiveElements.length = 0, this._hitElements.length = 0, this._isPointerMoveEvent = !0;
|
|
514
|
+
const t = this.createPointerEvent(e);
|
|
515
|
+
this._isPointerMoveEvent = !1;
|
|
516
|
+
const i = t.pointerType === "mouse" || t.pointerType === "pen", n = this.trackingData(e.pointerId), s = this.findMountedTarget(n.overTargets);
|
|
517
|
+
if (((u = n.overTargets) == null ? void 0 : u.length) > 0 && s !== t.target) {
|
|
518
|
+
const l = e.type === "mousemove" ? "mouseout" : "pointerout", d = this.createPointerEvent(e, l, s);
|
|
519
|
+
if (this.dispatchEvent(d, "pointerout"), i && this.dispatchEvent(d, "mouseout"), !t.composedPath().includes(s)) {
|
|
520
|
+
const r = this.createPointerEvent(e, "pointerleave", s);
|
|
521
|
+
for (r.eventPhase = r.AT_TARGET; r.target && !t.composedPath().includes(r.target); )
|
|
522
|
+
r.currentTarget = r.target, this.notifyTarget(r), i && this.notifyTarget(r, "mouseleave"), r.target = r.target.parent;
|
|
523
|
+
this.freeEvent(r);
|
|
524
|
+
}
|
|
525
|
+
this.freeEvent(d);
|
|
526
|
+
}
|
|
527
|
+
if (s !== t.target) {
|
|
528
|
+
const l = e.type === "mousemove" ? "mouseover" : "pointerover", d = this.clonePointerEvent(t, l);
|
|
529
|
+
this.dispatchEvent(d, "pointerover"), i && this.dispatchEvent(d, "mouseover");
|
|
530
|
+
let r = s == null ? void 0 : s.parent;
|
|
531
|
+
for (; r && r !== this.rootTarget.parent && r !== t.target; )
|
|
532
|
+
r = r.parent;
|
|
533
|
+
if (!r || r === this.rootTarget.parent) {
|
|
534
|
+
const c = this.clonePointerEvent(t, "pointerenter");
|
|
535
|
+
for (c.eventPhase = c.AT_TARGET; c.target && c.target !== s && c.target !== this.rootTarget.parent; )
|
|
536
|
+
c.currentTarget = c.target, this.notifyTarget(c), i && this.notifyTarget(c, "mouseenter"), c.target = c.target.parent;
|
|
537
|
+
this.freeEvent(c);
|
|
538
|
+
}
|
|
539
|
+
this.freeEvent(d);
|
|
540
|
+
}
|
|
541
|
+
const o = [], h = (p = this.enableGlobalMoveEvents) != null ? p : !0;
|
|
542
|
+
this.moveOnAll ? o.push("pointermove") : this.dispatchEvent(t, "pointermove"), h && o.push("globalpointermove"), t.pointerType === "touch" && (this.moveOnAll ? o.splice(1, 0, "touchmove") : this.dispatchEvent(t, "touchmove"), h && o.push("globaltouchmove")), i && (this.moveOnAll ? o.splice(1, 0, "mousemove") : this.dispatchEvent(t, "mousemove"), h && o.push("globalmousemove"), this.cursor = (v = t.target) == null ? void 0 : v.cursor), o.length > 0 && this.all(t, o), this._allInteractiveElements.length = 0, this._hitElements.length = 0, n.overTargets = t.composedPath(), this.freeEvent(t);
|
|
543
|
+
}
|
|
544
|
+
mapPointerOver(e) {
|
|
545
|
+
var o;
|
|
546
|
+
if (!(e instanceof g)) {
|
|
547
|
+
E("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
const t = this.trackingData(e.pointerId), i = this.createPointerEvent(e), n = i.pointerType === "mouse" || i.pointerType === "pen";
|
|
551
|
+
this.dispatchEvent(i, "pointerover"), n && this.dispatchEvent(i, "mouseover"), i.pointerType === "mouse" && (this.cursor = (o = i.target) == null ? void 0 : o.cursor);
|
|
552
|
+
const s = this.clonePointerEvent(i, "pointerenter");
|
|
553
|
+
for (s.eventPhase = s.AT_TARGET; s.target && s.target !== this.rootTarget.parent; )
|
|
554
|
+
s.currentTarget = s.target, this.notifyTarget(s), n && this.notifyTarget(s, "mouseenter"), s.target = s.target.parent;
|
|
555
|
+
t.overTargets = i.composedPath(), this.freeEvent(i), this.freeEvent(s);
|
|
556
|
+
}
|
|
557
|
+
mapPointerOut(e) {
|
|
558
|
+
if (!(e instanceof g)) {
|
|
559
|
+
E("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
const t = this.trackingData(e.pointerId);
|
|
563
|
+
if (t.overTargets) {
|
|
564
|
+
const i = e.pointerType === "mouse" || e.pointerType === "pen", n = this.findMountedTarget(t.overTargets), s = this.createPointerEvent(e, "pointerout", n);
|
|
565
|
+
this.dispatchEvent(s), i && this.dispatchEvent(s, "mouseout");
|
|
566
|
+
const o = this.createPointerEvent(e, "pointerleave", n);
|
|
567
|
+
for (o.eventPhase = o.AT_TARGET; o.target && o.target !== this.rootTarget.parent; )
|
|
568
|
+
o.currentTarget = o.target, this.notifyTarget(o), i && this.notifyTarget(o, "mouseleave"), o.target = o.target.parent;
|
|
569
|
+
t.overTargets = null, this.freeEvent(s), this.freeEvent(o);
|
|
570
|
+
}
|
|
571
|
+
this.cursor = null;
|
|
572
|
+
}
|
|
573
|
+
mapPointerUp(e) {
|
|
574
|
+
if (!(e instanceof g)) {
|
|
575
|
+
E("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
const t = performance.now(), i = this.createPointerEvent(e);
|
|
579
|
+
if (this.dispatchEvent(i, "pointerup"), i.pointerType === "touch")
|
|
580
|
+
this.dispatchEvent(i, "touchend");
|
|
581
|
+
else if (i.pointerType === "mouse" || i.pointerType === "pen") {
|
|
582
|
+
const h = i.button === 2;
|
|
583
|
+
this.dispatchEvent(i, h ? "rightup" : "mouseup");
|
|
584
|
+
}
|
|
585
|
+
const n = this.trackingData(e.pointerId), s = this.findMountedTarget(n.pressTargetsByButton[e.button]);
|
|
586
|
+
let o = s;
|
|
587
|
+
if (s && !i.composedPath().includes(s)) {
|
|
588
|
+
let h = s;
|
|
589
|
+
for (; h && !i.composedPath().includes(h); ) {
|
|
590
|
+
if (i.currentTarget = h, this.notifyTarget(i, "pointerupoutside"), i.pointerType === "touch")
|
|
591
|
+
this.notifyTarget(i, "touchendoutside");
|
|
592
|
+
else if (i.pointerType === "mouse" || i.pointerType === "pen") {
|
|
593
|
+
const u = i.button === 2;
|
|
594
|
+
this.notifyTarget(i, u ? "rightupoutside" : "mouseupoutside");
|
|
595
|
+
}
|
|
596
|
+
h = h.parent;
|
|
597
|
+
}
|
|
598
|
+
delete n.pressTargetsByButton[e.button], o = h;
|
|
599
|
+
}
|
|
600
|
+
if (o) {
|
|
601
|
+
const h = this.clonePointerEvent(i, "click");
|
|
602
|
+
h.target = o, h.path = null, n.clicksByButton[e.button] || (n.clicksByButton[e.button] = {
|
|
603
|
+
clickCount: 0,
|
|
604
|
+
target: h.target,
|
|
605
|
+
timeStamp: t
|
|
606
|
+
});
|
|
607
|
+
const u = n.clicksByButton[e.button];
|
|
608
|
+
if (u.target === h.target && t - u.timeStamp < 200 ? ++u.clickCount : u.clickCount = 1, u.target = h.target, u.timeStamp = t, h.detail = u.clickCount, h.pointerType === "mouse") {
|
|
609
|
+
const p = h.button === 2;
|
|
610
|
+
this.dispatchEvent(h, p ? "rightclick" : "click");
|
|
611
|
+
} else
|
|
612
|
+
h.pointerType === "touch" && this.dispatchEvent(h, "tap");
|
|
613
|
+
this.dispatchEvent(h, "pointertap"), this.freeEvent(h);
|
|
614
|
+
}
|
|
615
|
+
this.freeEvent(i);
|
|
616
|
+
}
|
|
617
|
+
mapPointerUpOutside(e) {
|
|
618
|
+
if (!(e instanceof g)) {
|
|
619
|
+
E("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
const t = this.trackingData(e.pointerId), i = this.findMountedTarget(t.pressTargetsByButton[e.button]), n = this.createPointerEvent(e);
|
|
623
|
+
if (i) {
|
|
624
|
+
let s = i;
|
|
625
|
+
for (; s; )
|
|
626
|
+
n.currentTarget = s, this.notifyTarget(n, "pointerupoutside"), n.pointerType === "touch" ? this.notifyTarget(n, "touchendoutside") : (n.pointerType === "mouse" || n.pointerType === "pen") && this.notifyTarget(n, n.button === 2 ? "rightupoutside" : "mouseupoutside"), s = s.parent;
|
|
627
|
+
delete t.pressTargetsByButton[e.button];
|
|
628
|
+
}
|
|
629
|
+
this.freeEvent(n);
|
|
630
|
+
}
|
|
631
|
+
mapWheel(e) {
|
|
632
|
+
if (!(e instanceof T)) {
|
|
633
|
+
E("EventBoundary cannot map a non-wheel event as a wheel event");
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const t = this.createWheelEvent(e);
|
|
637
|
+
this.dispatchEvent(t), this.freeEvent(t);
|
|
638
|
+
}
|
|
639
|
+
findMountedTarget(e) {
|
|
640
|
+
if (!e)
|
|
641
|
+
return null;
|
|
642
|
+
let t = e[0];
|
|
643
|
+
for (let i = 1; i < e.length && e[i].parent === t; i++)
|
|
644
|
+
t = e[i];
|
|
645
|
+
return t;
|
|
646
|
+
}
|
|
647
|
+
createPointerEvent(e, t, i) {
|
|
648
|
+
var s;
|
|
649
|
+
const n = this.allocateEvent(g);
|
|
650
|
+
return this.copyPointerData(e, n), this.copyMouseData(e, n), this.copyData(e, n), n.nativeEvent = e.nativeEvent, n.originalEvent = e, n.target = (s = i != null ? i : this.hitTest(n.global.x, n.global.y)) != null ? s : this._hitElements[0], typeof t == "string" && (n.type = t), n;
|
|
651
|
+
}
|
|
652
|
+
createWheelEvent(e) {
|
|
653
|
+
const t = this.allocateEvent(T);
|
|
654
|
+
return this.copyWheelData(e, t), this.copyMouseData(e, t), this.copyData(e, t), t.nativeEvent = e.nativeEvent, t.originalEvent = e, t.target = this.hitTest(t.global.x, t.global.y), t;
|
|
655
|
+
}
|
|
656
|
+
clonePointerEvent(e, t) {
|
|
657
|
+
const i = this.allocateEvent(g);
|
|
658
|
+
return i.nativeEvent = e.nativeEvent, i.originalEvent = e.originalEvent, this.copyPointerData(e, i), this.copyMouseData(e, i), this.copyData(e, i), i.target = e.target, i.path = e.composedPath().slice(), i.type = t != null ? t : i.type, i;
|
|
659
|
+
}
|
|
660
|
+
copyWheelData(e, t) {
|
|
661
|
+
t.deltaMode = e.deltaMode, t.deltaX = e.deltaX, t.deltaY = e.deltaY, t.deltaZ = e.deltaZ;
|
|
662
|
+
}
|
|
663
|
+
copyPointerData(e, t) {
|
|
664
|
+
e instanceof g && t instanceof g && (t.pointerId = e.pointerId, t.width = e.width, t.height = e.height, t.isPrimary = e.isPrimary, t.pointerType = e.pointerType, t.pressure = e.pressure, t.tangentialPressure = e.tangentialPressure, t.tiltX = e.tiltX, t.tiltY = e.tiltY, t.twist = e.twist);
|
|
665
|
+
}
|
|
666
|
+
copyMouseData(e, t) {
|
|
667
|
+
e instanceof D && t instanceof D && (t.altKey = e.altKey, t.button = e.button, t.buttons = e.buttons, t.client.copyFrom(e.client), t.ctrlKey = e.ctrlKey, t.metaKey = e.metaKey, t.movement.copyFrom(e.movement), t.screen.copyFrom(e.screen), t.shiftKey = e.shiftKey, t.global.copyFrom(e.global));
|
|
668
|
+
}
|
|
669
|
+
copyData(e, t) {
|
|
670
|
+
t.isTrusted = e.isTrusted, t.srcElement = e.srcElement, t.timeStamp = performance.now(), t.type = e.type, t.detail = e.detail, t.view = e.view, t.which = e.which, t.layer.copyFrom(e.layer), t.page.copyFrom(e.page);
|
|
671
|
+
}
|
|
672
|
+
trackingData(e) {
|
|
673
|
+
return this.mappingState.trackingData[e] || (this.mappingState.trackingData[e] = {
|
|
674
|
+
pressTargetsByButton: {},
|
|
675
|
+
clicksByButton: {},
|
|
676
|
+
overTarget: null
|
|
677
|
+
}), this.mappingState.trackingData[e];
|
|
678
|
+
}
|
|
679
|
+
allocateEvent(e) {
|
|
680
|
+
this.eventPool.has(e) || this.eventPool.set(e, []);
|
|
681
|
+
const t = this.eventPool.get(e).pop() || new e(this);
|
|
682
|
+
return t.eventPhase = t.NONE, t.currentTarget = null, t.defaultPrevented = !1, t.path = null, t.target = null, t;
|
|
683
|
+
}
|
|
684
|
+
freeEvent(e) {
|
|
685
|
+
if (e.manager !== this)
|
|
686
|
+
throw new Error("It is illegal to free an event not managed by this EventBoundary!");
|
|
687
|
+
const t = e.constructor;
|
|
688
|
+
this.eventPool.has(t) || this.eventPool.set(t, []), this.eventPool.get(t).push(e);
|
|
689
|
+
}
|
|
690
|
+
_notifyListeners(e, t) {
|
|
691
|
+
const i = e.currentTarget._events[t];
|
|
692
|
+
if (!!i)
|
|
693
|
+
if ("fn" in i)
|
|
694
|
+
i.once && e.currentTarget.removeListener(t, i.fn, void 0, !0), i.fn.call(i.context, e);
|
|
695
|
+
else
|
|
696
|
+
for (let n = 0, s = i.length; n < s && !e.propagationImmediatelyStopped; n++)
|
|
697
|
+
i[n].once && e.currentTarget.removeListener(t, i[n].fn, void 0, !0), i[n].fn.call(i[n].context, e);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
const ge = 1, me = {
|
|
701
|
+
touchstart: "pointerdown",
|
|
702
|
+
touchend: "pointerup",
|
|
703
|
+
touchendoutside: "pointerupoutside",
|
|
704
|
+
touchmove: "pointermove",
|
|
705
|
+
touchcancel: "pointercancel"
|
|
706
|
+
}, B = class x {
|
|
707
|
+
constructor(e) {
|
|
708
|
+
this.supportsTouchEvents = "ontouchstart" in globalThis, this.supportsPointerEvents = !!globalThis.PointerEvent, this.domElement = null, this.resolution = 1, this.renderer = e, this.rootBoundary = new fe(null), _.init(this), this.autoPreventDefault = !0, this._eventsAdded = !1, this._rootPointerEvent = new g(null), this._rootWheelEvent = new T(null), this.cursorStyles = {
|
|
709
|
+
default: "inherit",
|
|
710
|
+
pointer: "pointer"
|
|
711
|
+
}, this.features = new Proxy({ ...x.defaultEventFeatures }, {
|
|
712
|
+
set: (t, i, n) => (i === "globalMove" && (this.rootBoundary.enableGlobalMoveEvents = n), t[i] = n, !0)
|
|
713
|
+
}), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerOverOut = this._onPointerOverOut.bind(this), this.onWheel = this.onWheel.bind(this);
|
|
714
|
+
}
|
|
715
|
+
static get defaultEventMode() {
|
|
716
|
+
return this._defaultEventMode;
|
|
717
|
+
}
|
|
718
|
+
init(e) {
|
|
719
|
+
var n, s;
|
|
720
|
+
const { canvas: t, resolution: i } = this.renderer;
|
|
721
|
+
this.setTargetElement(t), this.resolution = i, x._defaultEventMode = (n = e.eventMode) != null ? n : "passive", Object.assign(this.features, (s = e.eventFeatures) != null ? s : {}), this.rootBoundary.enableGlobalMoveEvents = this.features.globalMove;
|
|
722
|
+
}
|
|
723
|
+
resolutionChange(e) {
|
|
724
|
+
this.resolution = e;
|
|
725
|
+
}
|
|
726
|
+
destroy() {
|
|
727
|
+
this.setTargetElement(null), this.renderer = null, this._currentCursor = null;
|
|
728
|
+
}
|
|
729
|
+
setCursor(e) {
|
|
730
|
+
e = e || "default";
|
|
731
|
+
let t = !0;
|
|
732
|
+
if (globalThis.OffscreenCanvas && this.domElement instanceof OffscreenCanvas && (t = !1), this._currentCursor === e)
|
|
733
|
+
return;
|
|
734
|
+
this._currentCursor = e;
|
|
735
|
+
const i = this.cursorStyles[e];
|
|
736
|
+
if (i)
|
|
737
|
+
switch (typeof i) {
|
|
738
|
+
case "string":
|
|
739
|
+
t && (this.domElement.style.cursor = i);
|
|
740
|
+
break;
|
|
741
|
+
case "function":
|
|
742
|
+
i(e);
|
|
743
|
+
break;
|
|
744
|
+
case "object":
|
|
745
|
+
t && Object.assign(this.domElement.style, i);
|
|
746
|
+
break;
|
|
747
|
+
}
|
|
748
|
+
else
|
|
749
|
+
t && typeof e == "string" && !Object.prototype.hasOwnProperty.call(this.cursorStyles, e) && (this.domElement.style.cursor = e);
|
|
750
|
+
}
|
|
751
|
+
get pointer() {
|
|
752
|
+
return this._rootPointerEvent;
|
|
753
|
+
}
|
|
754
|
+
_onPointerDown(e) {
|
|
755
|
+
if (!this.features.click)
|
|
756
|
+
return;
|
|
757
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
|
|
758
|
+
const t = this._normalizeToPointerData(e);
|
|
759
|
+
this.autoPreventDefault && t[0].isNormalized && (e.cancelable || !("cancelable" in e)) && e.preventDefault();
|
|
760
|
+
for (let i = 0, n = t.length; i < n; i++) {
|
|
761
|
+
const s = t[i], o = this._bootstrapEvent(this._rootPointerEvent, s);
|
|
762
|
+
this.rootBoundary.mapEvent(o);
|
|
763
|
+
}
|
|
764
|
+
this.setCursor(this.rootBoundary.cursor);
|
|
765
|
+
}
|
|
766
|
+
_onPointerMove(e) {
|
|
767
|
+
if (!this.features.move)
|
|
768
|
+
return;
|
|
769
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered, _.pointerMoved();
|
|
770
|
+
const t = this._normalizeToPointerData(e);
|
|
771
|
+
for (let i = 0, n = t.length; i < n; i++) {
|
|
772
|
+
const s = this._bootstrapEvent(this._rootPointerEvent, t[i]);
|
|
773
|
+
this.rootBoundary.mapEvent(s);
|
|
774
|
+
}
|
|
775
|
+
this.setCursor(this.rootBoundary.cursor);
|
|
776
|
+
}
|
|
777
|
+
_onPointerUp(e) {
|
|
778
|
+
if (!this.features.click)
|
|
779
|
+
return;
|
|
780
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
|
|
781
|
+
let t = e.target;
|
|
782
|
+
e.composedPath && e.composedPath().length > 0 && (t = e.composedPath()[0]);
|
|
783
|
+
const i = t !== this.domElement ? "outside" : "", n = this._normalizeToPointerData(e);
|
|
784
|
+
for (let s = 0, o = n.length; s < o; s++) {
|
|
785
|
+
const h = this._bootstrapEvent(this._rootPointerEvent, n[s]);
|
|
786
|
+
h.type += i, this.rootBoundary.mapEvent(h);
|
|
787
|
+
}
|
|
788
|
+
this.setCursor(this.rootBoundary.cursor);
|
|
789
|
+
}
|
|
790
|
+
_onPointerOverOut(e) {
|
|
791
|
+
if (!this.features.click)
|
|
792
|
+
return;
|
|
793
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
|
|
794
|
+
const t = this._normalizeToPointerData(e);
|
|
795
|
+
for (let i = 0, n = t.length; i < n; i++) {
|
|
796
|
+
const s = this._bootstrapEvent(this._rootPointerEvent, t[i]);
|
|
797
|
+
this.rootBoundary.mapEvent(s);
|
|
798
|
+
}
|
|
799
|
+
this.setCursor(this.rootBoundary.cursor);
|
|
800
|
+
}
|
|
801
|
+
onWheel(e) {
|
|
802
|
+
if (!this.features.wheel)
|
|
803
|
+
return;
|
|
804
|
+
const t = this.normalizeWheelEvent(e);
|
|
805
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered, this.rootBoundary.mapEvent(t);
|
|
806
|
+
}
|
|
807
|
+
setTargetElement(e) {
|
|
808
|
+
this._removeEvents(), this.domElement = e, _.domElement = e, this._addEvents();
|
|
809
|
+
}
|
|
810
|
+
_addEvents() {
|
|
811
|
+
if (this._eventsAdded || !this.domElement)
|
|
812
|
+
return;
|
|
813
|
+
_.addTickerListener();
|
|
814
|
+
const e = this.domElement.style;
|
|
815
|
+
e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "none", e.msTouchAction = "none") : this.supportsPointerEvents && (e.touchAction = "none")), this.supportsPointerEvents ? (globalThis.document.addEventListener("pointermove", this._onPointerMove, !0), this.domElement.addEventListener("pointerdown", this._onPointerDown, !0), this.domElement.addEventListener("pointerleave", this._onPointerOverOut, !0), this.domElement.addEventListener("pointerover", this._onPointerOverOut, !0), globalThis.addEventListener("pointerup", this._onPointerUp, !0)) : (globalThis.document.addEventListener("mousemove", this._onPointerMove, !0), this.domElement.addEventListener("mousedown", this._onPointerDown, !0), this.domElement.addEventListener("mouseout", this._onPointerOverOut, !0), this.domElement.addEventListener("mouseover", this._onPointerOverOut, !0), globalThis.addEventListener("mouseup", this._onPointerUp, !0), this.supportsTouchEvents && (this.domElement.addEventListener("touchstart", this._onPointerDown, !0), this.domElement.addEventListener("touchend", this._onPointerUp, !0), this.domElement.addEventListener("touchmove", this._onPointerMove, !0))), this.domElement.addEventListener("wheel", this.onWheel, {
|
|
816
|
+
passive: !0,
|
|
817
|
+
capture: !0
|
|
818
|
+
}), this._eventsAdded = !0;
|
|
819
|
+
}
|
|
820
|
+
_removeEvents() {
|
|
821
|
+
if (!this._eventsAdded || !this.domElement)
|
|
822
|
+
return;
|
|
823
|
+
_.removeTickerListener();
|
|
824
|
+
const e = this.domElement.style;
|
|
825
|
+
e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "", e.msTouchAction = "") : this.supportsPointerEvents && (e.touchAction = "")), this.supportsPointerEvents ? (globalThis.document.removeEventListener("pointermove", this._onPointerMove, !0), this.domElement.removeEventListener("pointerdown", this._onPointerDown, !0), this.domElement.removeEventListener("pointerleave", this._onPointerOverOut, !0), this.domElement.removeEventListener("pointerover", this._onPointerOverOut, !0), globalThis.removeEventListener("pointerup", this._onPointerUp, !0)) : (globalThis.document.removeEventListener("mousemove", this._onPointerMove, !0), this.domElement.removeEventListener("mousedown", this._onPointerDown, !0), this.domElement.removeEventListener("mouseout", this._onPointerOverOut, !0), this.domElement.removeEventListener("mouseover", this._onPointerOverOut, !0), globalThis.removeEventListener("mouseup", this._onPointerUp, !0), this.supportsTouchEvents && (this.domElement.removeEventListener("touchstart", this._onPointerDown, !0), this.domElement.removeEventListener("touchend", this._onPointerUp, !0), this.domElement.removeEventListener("touchmove", this._onPointerMove, !0))), this.domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this._eventsAdded = !1;
|
|
826
|
+
}
|
|
827
|
+
mapPositionToPoint(e, t, i) {
|
|
828
|
+
const n = this.domElement.isConnected ? this.domElement.getBoundingClientRect() : {
|
|
829
|
+
x: 0,
|
|
830
|
+
y: 0,
|
|
831
|
+
width: this.domElement.width,
|
|
832
|
+
height: this.domElement.height,
|
|
833
|
+
left: 0,
|
|
834
|
+
top: 0
|
|
835
|
+
}, s = 1 / this.resolution;
|
|
836
|
+
e.x = (t - n.left) * (this.domElement.width / n.width) * s, e.y = (i - n.top) * (this.domElement.height / n.height) * s;
|
|
837
|
+
}
|
|
838
|
+
_normalizeToPointerData(e) {
|
|
839
|
+
const t = [];
|
|
840
|
+
if (this.supportsTouchEvents && e instanceof TouchEvent)
|
|
841
|
+
for (let i = 0, n = e.changedTouches.length; i < n; i++) {
|
|
842
|
+
const s = e.changedTouches[i];
|
|
843
|
+
typeof s.button > "u" && (s.button = 0), typeof s.buttons > "u" && (s.buttons = 1), typeof s.isPrimary > "u" && (s.isPrimary = e.touches.length === 1 && e.type === "touchstart"), typeof s.width > "u" && (s.width = s.radiusX || 1), typeof s.height > "u" && (s.height = s.radiusY || 1), typeof s.tiltX > "u" && (s.tiltX = 0), typeof s.tiltY > "u" && (s.tiltY = 0), typeof s.pointerType > "u" && (s.pointerType = "touch"), typeof s.pointerId > "u" && (s.pointerId = s.identifier || 0), typeof s.pressure > "u" && (s.pressure = s.force || 0.5), typeof s.twist > "u" && (s.twist = 0), typeof s.tangentialPressure > "u" && (s.tangentialPressure = 0), typeof s.layerX > "u" && (s.layerX = s.offsetX = s.clientX), typeof s.layerY > "u" && (s.layerY = s.offsetY = s.clientY), s.isNormalized = !0, s.type = e.type, t.push(s);
|
|
844
|
+
}
|
|
845
|
+
else if (!globalThis.MouseEvent || e instanceof MouseEvent && (!this.supportsPointerEvents || !(e instanceof globalThis.PointerEvent))) {
|
|
846
|
+
const i = e;
|
|
847
|
+
typeof i.isPrimary > "u" && (i.isPrimary = !0), typeof i.width > "u" && (i.width = 1), typeof i.height > "u" && (i.height = 1), typeof i.tiltX > "u" && (i.tiltX = 0), typeof i.tiltY > "u" && (i.tiltY = 0), typeof i.pointerType > "u" && (i.pointerType = "mouse"), typeof i.pointerId > "u" && (i.pointerId = ge), typeof i.pressure > "u" && (i.pressure = 0.5), typeof i.twist > "u" && (i.twist = 0), typeof i.tangentialPressure > "u" && (i.tangentialPressure = 0), i.isNormalized = !0, t.push(i);
|
|
848
|
+
} else
|
|
849
|
+
t.push(e);
|
|
850
|
+
return t;
|
|
851
|
+
}
|
|
852
|
+
normalizeWheelEvent(e) {
|
|
853
|
+
const t = this._rootWheelEvent;
|
|
854
|
+
return this._transferMouseData(t, e), t.deltaX = e.deltaX, t.deltaY = e.deltaY, t.deltaZ = e.deltaZ, t.deltaMode = e.deltaMode, this.mapPositionToPoint(t.screen, e.clientX, e.clientY), t.global.copyFrom(t.screen), t.offset.copyFrom(t.screen), t.nativeEvent = e, t.type = e.type, t;
|
|
855
|
+
}
|
|
856
|
+
_bootstrapEvent(e, t) {
|
|
857
|
+
return e.originalEvent = null, e.nativeEvent = t, e.pointerId = t.pointerId, e.width = t.width, e.height = t.height, e.isPrimary = t.isPrimary, e.pointerType = t.pointerType, e.pressure = t.pressure, e.tangentialPressure = t.tangentialPressure, e.tiltX = t.tiltX, e.tiltY = t.tiltY, e.twist = t.twist, this._transferMouseData(e, t), this.mapPositionToPoint(e.screen, t.clientX, t.clientY), e.global.copyFrom(e.screen), e.offset.copyFrom(e.screen), e.isTrusted = t.isTrusted, e.type === "pointerleave" && (e.type = "pointerout"), e.type.startsWith("mouse") && (e.type = e.type.replace("mouse", "pointer")), e.type.startsWith("touch") && (e.type = me[e.type] || e.type), e;
|
|
858
|
+
}
|
|
859
|
+
_transferMouseData(e, t) {
|
|
860
|
+
e.isTrusted = t.isTrusted, e.srcElement = t.srcElement, e.timeStamp = performance.now(), e.type = t.type, e.altKey = t.altKey, e.button = t.button, e.buttons = t.buttons, e.client.x = t.clientX, e.client.y = t.clientY, e.ctrlKey = t.ctrlKey, e.metaKey = t.metaKey, e.movement.x = t.movementX, e.movement.y = t.movementY, e.page.x = t.pageX, e.page.y = t.pageY, e.relatedTarget = null, e.shiftKey = t.shiftKey;
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
B.extension = {
|
|
864
|
+
name: "events",
|
|
865
|
+
type: [
|
|
866
|
+
w.WebGLSystem,
|
|
867
|
+
w.CanvasSystem,
|
|
868
|
+
w.WebGPUSystem
|
|
869
|
+
],
|
|
870
|
+
priority: -1
|
|
871
|
+
};
|
|
872
|
+
B.defaultEventFeatures = {
|
|
873
|
+
move: !0,
|
|
874
|
+
globalMove: !0,
|
|
875
|
+
click: !0,
|
|
876
|
+
wheel: !0
|
|
877
|
+
};
|
|
878
|
+
let J = B;
|
|
879
|
+
const ye = {
|
|
880
|
+
onclick: null,
|
|
881
|
+
onmousedown: null,
|
|
882
|
+
onmouseenter: null,
|
|
883
|
+
onmouseleave: null,
|
|
884
|
+
onmousemove: null,
|
|
885
|
+
onglobalmousemove: null,
|
|
886
|
+
onmouseout: null,
|
|
887
|
+
onmouseover: null,
|
|
888
|
+
onmouseup: null,
|
|
889
|
+
onmouseupoutside: null,
|
|
890
|
+
onpointercancel: null,
|
|
891
|
+
onpointerdown: null,
|
|
892
|
+
onpointerenter: null,
|
|
893
|
+
onpointerleave: null,
|
|
894
|
+
onpointermove: null,
|
|
895
|
+
onglobalpointermove: null,
|
|
896
|
+
onpointerout: null,
|
|
897
|
+
onpointerover: null,
|
|
898
|
+
onpointertap: null,
|
|
899
|
+
onpointerup: null,
|
|
900
|
+
onpointerupoutside: null,
|
|
901
|
+
onrightclick: null,
|
|
902
|
+
onrightdown: null,
|
|
903
|
+
onrightup: null,
|
|
904
|
+
onrightupoutside: null,
|
|
905
|
+
ontap: null,
|
|
906
|
+
ontouchcancel: null,
|
|
907
|
+
ontouchend: null,
|
|
908
|
+
ontouchendoutside: null,
|
|
909
|
+
ontouchmove: null,
|
|
910
|
+
onglobaltouchmove: null,
|
|
911
|
+
ontouchstart: null,
|
|
912
|
+
onwheel: null,
|
|
913
|
+
get interactive() {
|
|
914
|
+
return this.eventMode === "dynamic" || this.eventMode === "static";
|
|
915
|
+
},
|
|
916
|
+
set interactive(a) {
|
|
917
|
+
this.eventMode = a ? "static" : "passive";
|
|
918
|
+
},
|
|
919
|
+
_internalEventMode: void 0,
|
|
920
|
+
get eventMode() {
|
|
921
|
+
var a;
|
|
922
|
+
return (a = this._internalEventMode) != null ? a : J.defaultEventMode;
|
|
923
|
+
},
|
|
924
|
+
set eventMode(a) {
|
|
925
|
+
this._internalEventMode = a;
|
|
926
|
+
},
|
|
927
|
+
isInteractive() {
|
|
928
|
+
return this.eventMode === "static" || this.eventMode === "dynamic";
|
|
929
|
+
},
|
|
930
|
+
interactiveChildren: !0,
|
|
931
|
+
hitArea: null,
|
|
932
|
+
addEventListener(a, e, t) {
|
|
933
|
+
const i = typeof t == "boolean" && t || typeof t == "object" && t.capture, n = typeof t == "object" ? t.signal : void 0, s = typeof t == "object" ? t.once === !0 : !1, o = typeof e == "function" ? void 0 : e;
|
|
934
|
+
a = i ? `${a}capture` : a;
|
|
935
|
+
const h = typeof e == "function" ? e : e.handleEvent, u = this;
|
|
936
|
+
n && n.addEventListener("abort", () => {
|
|
937
|
+
u.off(a, h, o);
|
|
938
|
+
}), s ? u.once(a, h, o) : u.on(a, h, o);
|
|
939
|
+
},
|
|
940
|
+
removeEventListener(a, e, t) {
|
|
941
|
+
const i = typeof t == "boolean" && t || typeof t == "object" && t.capture, n = typeof e == "function" ? void 0 : e;
|
|
942
|
+
a = i ? `${a}capture` : a, e = typeof e == "function" ? e : e.handleEvent, this.off(a, e, n);
|
|
943
|
+
},
|
|
944
|
+
dispatchEvent(a) {
|
|
945
|
+
if (!(a instanceof M))
|
|
946
|
+
throw new Error("Container cannot propagate events outside of the Federated Events API");
|
|
947
|
+
return a.defaultPrevented = !1, a.path = null, a.target = this, a.manager.dispatchEvent(a), !a.defaultPrevented;
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
Z.add(q);
|
|
951
|
+
V.mixin(de);
|
|
952
|
+
Z.add(J);
|
|
953
|
+
V.mixin(ye);
|