@omnipad/vue 0.4.5 → 0.5.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/index.d.ts +5 -4
- package/dist/omnipad-vue.css +1 -1
- package/dist/omnipad-vue.mjs +407 -369
- package/dist/omnipad-vue.umd.js +1 -1
- package/package.json +2 -2
package/dist/omnipad-vue.mjs
CHANGED
|
@@ -1,126 +1,164 @@
|
|
|
1
|
-
import { Registry as pe,
|
|
2
|
-
import {
|
|
3
|
-
import { defineComponent as B, h as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Registry as pe, CONTEXT as se, CMP_TYPES as T, InputZoneCore as ye, RootLayerCore as me, TargetZoneCore as ge, ButtonCore as Pe, DPadCore as be, TrackpadCore as he, JoystickCore as Ce, setGlobalSignalHandler as ke, ACTION_TYPES as ae } from "@omnipad/core";
|
|
2
|
+
import { createWebStickyProvider as Re, ElementObserver as j, WindowManager as _e, createPointerBridge as we, supportsContainerQueries as Q, reclaimFocusAtPos as De, dispatchPointerEventAtPos as $e, dispatchKeyboardEvent as le } from "@omnipad/core/dom";
|
|
3
|
+
import { defineComponent as B, h as Ie, shallowRef as Ne, ref as M, watch as te, onMounted as Te, onUnmounted as Ee, computed as D, readonly as ee, openBlock as R, createElementBlock as S, Fragment as Se, renderList as Ae, createBlock as Z, resolveDynamicComponent as oe, renderSlot as b, inject as xe, provide as Ue, useSlots as Le, nextTick as Be, normalizeStyle as O, normalizeClass as $, unref as o, createVNode as X, withCtx as I, createElementVNode as E, createCommentVNode as Y, Transition as Oe, toDisplayString as Ve, normalizeProps as U, guardReactiveProps as L, watchEffect as ue } from "vue";
|
|
4
|
+
import { getObjectDiff as Me, createCachedProvider as Ye, resolveStickyLayout as Ze, generateUID as Ke, getBusinessProps as re, resolveLayoutStyle as J, remap as H } from "@omnipad/core/utils";
|
|
5
|
+
const q = {};
|
|
6
|
+
function K(e, n) {
|
|
7
|
+
q[e] = n;
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
const n =
|
|
9
|
+
function de(e) {
|
|
10
|
+
const n = q[e];
|
|
10
11
|
return n || B({
|
|
11
|
-
render: () =>
|
|
12
|
+
render: () => Ie("div", { style: "color:red" }, `[Unknown: ${e}]`)
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
return !e || !
|
|
15
|
+
function ce(e) {
|
|
16
|
+
return !e || !q[e] ? null : q[e];
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
return e ? !!
|
|
18
|
+
function Ct(e) {
|
|
19
|
+
return e ? !!q[e] : !1;
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
const t = e(),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
function F(e, n, f = {}, c) {
|
|
22
|
+
const t = e(), l = Ne(), P = M(), i = M(), u = M(null);
|
|
23
|
+
let s;
|
|
24
|
+
const p = M(0), h = () => {
|
|
25
|
+
p.value = p.value % 65535 + 1;
|
|
25
26
|
};
|
|
27
|
+
te(
|
|
28
|
+
// 1. 精确定义依赖源:只有这个字符串变了,才触发回调
|
|
29
|
+
() => i.value?.layout?.stickySelector,
|
|
30
|
+
(a, d, g) => {
|
|
31
|
+
if (!a) {
|
|
32
|
+
s = null, h();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
let v = !1;
|
|
36
|
+
if (s ? v = s.updateSelector(a) : (s = Re(a), v = !0), !v) return;
|
|
37
|
+
const r = s.getTarget();
|
|
38
|
+
if (!r) return;
|
|
39
|
+
const N = t.uid + "-sticky";
|
|
40
|
+
j.getInstance().observeResize(N, r, () => {
|
|
41
|
+
s?.markDirty(), t.markRectDirty();
|
|
42
|
+
}), j.getInstance().observeIntersect(N, r, (y) => {
|
|
43
|
+
y || t.reset();
|
|
44
|
+
}), h(), g(() => {
|
|
45
|
+
j.getInstance().disconnect(N);
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
{ immediate: !0 }
|
|
49
|
+
// 必须开启,以处理初始配置即存在吸附的情况
|
|
50
|
+
);
|
|
26
51
|
let _ = { ...n.value };
|
|
27
|
-
|
|
52
|
+
te(
|
|
28
53
|
n,
|
|
29
|
-
(
|
|
30
|
-
if (!
|
|
31
|
-
const
|
|
32
|
-
Object.keys(
|
|
54
|
+
(a) => {
|
|
55
|
+
if (!l.value) return;
|
|
56
|
+
const d = Me(_, a);
|
|
57
|
+
Object.keys(d).length > 0 && l.value.updateConfig(d), _ = { ...n.value };
|
|
33
58
|
},
|
|
34
59
|
{ deep: !0 }
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
60
|
+
);
|
|
61
|
+
const w = (a) => {
|
|
62
|
+
l.value && "bindDelegate" in l.value && Object.entries(a).forEach(([d, g]) => {
|
|
63
|
+
l.value.bindDelegate(d, g);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
Te(() => {
|
|
67
|
+
l.value = t, pe.getInstance().register(t), "subscribeState" in t && t.subscribeState((d) => P.value = d), "subscribeConfig" in t && t.subscribeConfig((d) => i.value = d), c && w(c);
|
|
68
|
+
let a = null;
|
|
69
|
+
if (u.value && (u.value instanceof Element ? a = u.value : u.value.$el instanceof Element && (a = u.value.$el)), a instanceof Element) {
|
|
70
|
+
const d = j.getInstance();
|
|
40
71
|
if ("bindRectProvider" in t) {
|
|
41
|
-
const
|
|
42
|
-
t.bindRectProvider(
|
|
72
|
+
const g = Ye(() => a.getBoundingClientRect());
|
|
73
|
+
t.bindRectProvider(g.get, () => {
|
|
74
|
+
g.markDirty(), s && (s.markDirty(), h());
|
|
75
|
+
}), d.observeResize(t.uid, a, () => {
|
|
43
76
|
t.markRectDirty();
|
|
44
77
|
});
|
|
45
78
|
}
|
|
46
|
-
|
|
47
|
-
|
|
79
|
+
d.observeIntersect(t.uid, a, (g) => {
|
|
80
|
+
g || t.reset();
|
|
48
81
|
});
|
|
49
82
|
}
|
|
50
|
-
|
|
51
|
-
}),
|
|
52
|
-
|
|
83
|
+
_e.getInstance().init();
|
|
84
|
+
}), Ee(() => {
|
|
85
|
+
j.getInstance().disconnect(t.uid), j.getInstance().disconnect(t.uid + "-sticky"), l.value && l.value.destroy();
|
|
86
|
+
});
|
|
87
|
+
const k = "onPointerDown" in t ? we(t, f) : {}, C = D(() => {
|
|
88
|
+
const a = i.value?.layout;
|
|
89
|
+
if (!s || !p.value) return a;
|
|
90
|
+
const d = s.getRect();
|
|
91
|
+
return d ? Ze(a, d) : a;
|
|
53
92
|
});
|
|
54
|
-
const R = "onPointerDown" in t ? $e(t, d) : {};
|
|
55
93
|
return {
|
|
56
|
-
core:
|
|
57
|
-
state:
|
|
58
|
-
domEvents:
|
|
59
|
-
effectiveConfig:
|
|
60
|
-
effectiveLayout:
|
|
61
|
-
elementRef:
|
|
62
|
-
bindDelegates:
|
|
94
|
+
core: ee(l),
|
|
95
|
+
state: ee(P),
|
|
96
|
+
domEvents: k,
|
|
97
|
+
effectiveConfig: ee(i),
|
|
98
|
+
effectiveLayout: C,
|
|
99
|
+
elementRef: u,
|
|
100
|
+
bindDelegates: w
|
|
63
101
|
};
|
|
64
102
|
}
|
|
65
|
-
const
|
|
103
|
+
const Fe = { class: "omnipad-virtual-layer-base omnipad-prevent" }, ze = /* @__PURE__ */ B({
|
|
66
104
|
__name: "VirtualLayerBase",
|
|
67
105
|
props: {
|
|
68
106
|
nodes: {}
|
|
69
107
|
},
|
|
70
108
|
setup(e) {
|
|
71
|
-
const n = e,
|
|
72
|
-
let t =
|
|
73
|
-
return !t &&
|
|
74
|
-
node:
|
|
109
|
+
const n = e, f = D(() => (n.nodes || []).map((c) => {
|
|
110
|
+
let t = ce(c.type);
|
|
111
|
+
return !t && c.config?.baseType && (t = ce(c.config.baseType)), t || (t = de(c.type)), {
|
|
112
|
+
node: c,
|
|
75
113
|
component: t
|
|
76
114
|
};
|
|
77
115
|
}));
|
|
78
|
-
return (
|
|
79
|
-
(
|
|
80
|
-
key:
|
|
81
|
-
"tree-node":
|
|
116
|
+
return (c, t) => (R(), S("div", Fe, [
|
|
117
|
+
(R(!0), S(Se, null, Ae(f.value, (l) => (R(), Z(oe(l.component), {
|
|
118
|
+
key: l.node.uid,
|
|
119
|
+
"tree-node": l.node
|
|
82
120
|
}, null, 8, ["tree-node"]))), 128)),
|
|
83
|
-
|
|
121
|
+
b(c.$slots, "default", {}, void 0, !0)
|
|
84
122
|
]));
|
|
85
123
|
}
|
|
86
124
|
}), V = (e, n) => {
|
|
87
|
-
const
|
|
88
|
-
for (const [
|
|
89
|
-
|
|
90
|
-
return
|
|
91
|
-
}, ve = /* @__PURE__ */ V(
|
|
92
|
-
function z(e, n,
|
|
93
|
-
const t = n.treeNode,
|
|
94
|
-
t && !
|
|
125
|
+
const f = e.__vccOpts || e;
|
|
126
|
+
for (const [c, t] of n)
|
|
127
|
+
f[c] = t;
|
|
128
|
+
return f;
|
|
129
|
+
}, ve = /* @__PURE__ */ V(ze, [["__scopeId", "data-v-a172c7c0"]]), We = ["treeNode", "widgetId", "parentId"];
|
|
130
|
+
function z(e, n, f = {}, c = []) {
|
|
131
|
+
const t = n.treeNode, l = t && t.config?.baseType === e || t?.type === e ? t : void 0;
|
|
132
|
+
t && !l && console.warn(
|
|
95
133
|
`[OmniPad-Validation] Type mismatch! Component expected "${e}", but received "${t.type}". Config ignored.`
|
|
96
134
|
);
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
...d,
|
|
135
|
+
const P = xe(se.PARENT_ID_KEY, M(void 0)), i = D(() => n.parentId || l?.config?.parentId || P.value), u = D(() => n.widgetId || l?.uid || Ke(e));
|
|
136
|
+
Ue(se.PARENT_ID_KEY, u);
|
|
137
|
+
const s = /* @__PURE__ */ new Set([...We, ...c]), p = l?.config || {}, h = re(n, s), _ = D(() => ({
|
|
101
138
|
...f,
|
|
102
|
-
...
|
|
103
|
-
|
|
139
|
+
...p,
|
|
140
|
+
...h,
|
|
141
|
+
id: u.value,
|
|
104
142
|
baseType: e,
|
|
105
143
|
parentId: i.value,
|
|
106
144
|
// 特殊处理 Layout:深度合并,确保即便只传了 { width: 100 } 也不丢失原来的 left/top
|
|
107
145
|
layout: {
|
|
108
|
-
...d.layout || {},
|
|
109
146
|
...f.layout || {},
|
|
110
|
-
...
|
|
147
|
+
...p.layout || {},
|
|
148
|
+
...h.layout || {}
|
|
111
149
|
}
|
|
112
|
-
},
|
|
113
|
-
const
|
|
150
|
+
})), w = D(() => {
|
|
151
|
+
const k = re(n, s);
|
|
114
152
|
return {
|
|
115
|
-
...
|
|
153
|
+
...k,
|
|
116
154
|
parentId: i.value,
|
|
117
|
-
layout:
|
|
155
|
+
layout: k.layout || void 0
|
|
118
156
|
// 只有当传入了新的 layout 时才包裹
|
|
119
157
|
};
|
|
120
158
|
});
|
|
121
|
-
return { uid:
|
|
159
|
+
return { uid: u, initialConfig: _, reactiveConfig: w };
|
|
122
160
|
}
|
|
123
|
-
const
|
|
161
|
+
const je = ["id"], qe = /* @__PURE__ */ B({
|
|
124
162
|
__name: "InputZone",
|
|
125
163
|
props: {
|
|
126
164
|
treeNode: {},
|
|
@@ -129,111 +167,111 @@ const ze = ["id"], We = /* @__PURE__ */ B({
|
|
|
129
167
|
preventFocusLoss: {}
|
|
130
168
|
},
|
|
131
169
|
setup(e) {
|
|
132
|
-
const n = e,
|
|
133
|
-
|
|
170
|
+
const n = e, f = Le(), c = M(null), { uid: t, initialConfig: l, reactiveConfig: P } = z(
|
|
171
|
+
T.INPUT_ZONE,
|
|
134
172
|
n
|
|
135
|
-
), { core: i, state:
|
|
136
|
-
() => new
|
|
137
|
-
|
|
173
|
+
), { core: i, state: u, domEvents: s, effectiveConfig: p, effectiveLayout: h, elementRef: _, bindDelegates: w } = F(
|
|
174
|
+
() => new ye(t.value, l.value, n.treeNode?.type),
|
|
175
|
+
P,
|
|
138
176
|
{
|
|
139
177
|
requireDirectHit: !0
|
|
140
178
|
}
|
|
141
|
-
),
|
|
142
|
-
const
|
|
143
|
-
return n.treeNode?.children?.filter((A) => A.uid !==
|
|
144
|
-
}),
|
|
145
|
-
const A = (
|
|
146
|
-
(
|
|
179
|
+
), k = D(() => {
|
|
180
|
+
const m = n.treeNode?.config?.dynamicWidgetId;
|
|
181
|
+
return n.treeNode?.children?.filter((A) => A.uid !== m) || [];
|
|
182
|
+
}), C = D(() => {
|
|
183
|
+
const A = (f.dynamicWidget?.() || []).filter((G) => !(G.type === Comment || G.type === Text)), x = n.treeNode?.children?.find(
|
|
184
|
+
(G) => G.uid === n.treeNode?.config?.dynamicWidgetId
|
|
147
185
|
), W = A.length > 0;
|
|
148
186
|
return A.length > 1 && console.error(
|
|
149
187
|
`[OmniPad-Validation] InputZone ${t} has multiple dynamic widgets in slot. Only the first one will be activated.`
|
|
150
|
-
), W &&
|
|
188
|
+
), W && x && console.warn(
|
|
151
189
|
`[OmniPad-Validation] InputZone ${t} has both Slot and Config dynamic widgets. Config ignored.`
|
|
152
190
|
), {
|
|
153
|
-
nodeToRender: W ? A[0] :
|
|
191
|
+
nodeToRender: W ? A[0] : x || null,
|
|
154
192
|
isFromSlot: W
|
|
155
193
|
};
|
|
156
|
-
}),
|
|
157
|
-
const
|
|
158
|
-
return
|
|
194
|
+
}), a = D(() => {
|
|
195
|
+
const m = C.value.nodeToRender;
|
|
196
|
+
return de(m.config?.baseType || m.type);
|
|
159
197
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
dynamicWidgetId:
|
|
166
|
-
}),
|
|
198
|
+
te(
|
|
199
|
+
c,
|
|
200
|
+
(m) => {
|
|
201
|
+
Be(() => {
|
|
202
|
+
m && m?.uid && (i.value?.updateConfig({
|
|
203
|
+
dynamicWidgetId: m.uid
|
|
204
|
+
}), w({
|
|
167
205
|
dynamicWidgetPointerDown: (A) => {
|
|
168
|
-
|
|
206
|
+
m.markRectDirty?.(), m.onPointerDown?.(A);
|
|
169
207
|
},
|
|
170
|
-
dynamicWidgetPointerMove:
|
|
171
|
-
dynamicWidgetPointerUp:
|
|
172
|
-
dynamicWidgetPointerCancel:
|
|
208
|
+
dynamicWidgetPointerMove: m.onPointerMove,
|
|
209
|
+
dynamicWidgetPointerUp: m.onPointerUp,
|
|
210
|
+
dynamicWidgetPointerCancel: m.onPointerCancel
|
|
173
211
|
}));
|
|
174
212
|
});
|
|
175
213
|
},
|
|
176
214
|
{ immediate: !0 }
|
|
177
215
|
);
|
|
178
|
-
const
|
|
179
|
-
if (!
|
|
180
|
-
if (!
|
|
181
|
-
let
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
184
|
-
|
|
216
|
+
const d = D(() => h.value ? J(h.value) : {}), g = Q(), v = D(() => {
|
|
217
|
+
if (!u.value) return { display: "none" };
|
|
218
|
+
if (!u.value?.isDynamicActive) return { visibility: "hidden", opacity: 0 };
|
|
219
|
+
let m, A;
|
|
220
|
+
const x = u?.value?.dynamicPosition;
|
|
221
|
+
if (g)
|
|
222
|
+
m = `${x.x}cqw`, A = `${x.y}cqh`;
|
|
185
223
|
else {
|
|
186
224
|
const W = i?.value?.rect;
|
|
187
|
-
|
|
225
|
+
m = `${H(x?.x || 0, 0, 100, 0, W?.width || 0)}px`, A = `${H(x?.y || 0, 0, 100, 0, W?.height || 0)}px`;
|
|
188
226
|
}
|
|
189
227
|
return {
|
|
190
228
|
zIndex: 100,
|
|
191
|
-
"--dynamic-widget-mount-x":
|
|
229
|
+
"--dynamic-widget-mount-x": m,
|
|
192
230
|
"--dynamic-widget-mount-y": A,
|
|
193
231
|
visibility: "visible",
|
|
194
232
|
opacity: 1,
|
|
195
233
|
pointerEvents: "auto"
|
|
196
234
|
};
|
|
197
|
-
}),
|
|
198
|
-
return (
|
|
235
|
+
}), r = (m) => s?.onPointerDown?.(m), N = (m) => s?.onPointerMove?.(m), y = (m) => s?.onPointerUp?.(m), ie = (m) => s?.onPointerCancel?.(m);
|
|
236
|
+
return (m, A) => (R(), S("div", {
|
|
199
237
|
id: o(t),
|
|
200
238
|
ref_key: "elementRef",
|
|
201
|
-
ref:
|
|
202
|
-
class:
|
|
203
|
-
style: O(
|
|
239
|
+
ref: _,
|
|
240
|
+
class: $(["omnipad-input-zone omnipad-prevent", o(p)?.cssClass]),
|
|
241
|
+
style: O(d.value)
|
|
204
242
|
}, [
|
|
205
|
-
|
|
206
|
-
default:
|
|
207
|
-
|
|
243
|
+
X(ve, { nodes: k.value }, {
|
|
244
|
+
default: I(() => [
|
|
245
|
+
b(m.$slots, "default", {}, void 0, !0)
|
|
208
246
|
]),
|
|
209
247
|
_: 3
|
|
210
248
|
}, 8, ["nodes"]),
|
|
211
|
-
|
|
249
|
+
C.value.nodeToRender || o(i)?.isInterceptorRequired ? (R(), S("div", {
|
|
212
250
|
key: 0,
|
|
213
251
|
class: "omnipad-input-zone-trigger omnipad-prevent",
|
|
214
|
-
onPointerdown:
|
|
215
|
-
onPointermove:
|
|
216
|
-
onPointerup:
|
|
217
|
-
onPointercancel:
|
|
218
|
-
onLostpointercapture:
|
|
252
|
+
onPointerdown: r,
|
|
253
|
+
onPointermove: N,
|
|
254
|
+
onPointerup: y,
|
|
255
|
+
onPointercancel: ie,
|
|
256
|
+
onLostpointercapture: ie
|
|
219
257
|
}, [
|
|
220
|
-
|
|
258
|
+
E("div", {
|
|
221
259
|
class: "dynamic-widget-mount",
|
|
222
260
|
style: O(v.value)
|
|
223
261
|
}, [
|
|
224
|
-
|
|
262
|
+
C.value.isFromSlot ? (R(), Z(oe(C.value.nodeToRender), {
|
|
225
263
|
key: 0,
|
|
226
|
-
ref: (
|
|
227
|
-
}, null, 512)) :
|
|
264
|
+
ref: (x) => c.value = x
|
|
265
|
+
}, null, 512)) : C.value.nodeToRender ? (R(), Z(oe(a.value), {
|
|
228
266
|
key: 1,
|
|
229
|
-
ref: (
|
|
230
|
-
"tree-node":
|
|
267
|
+
ref: (x) => c.value = x,
|
|
268
|
+
"tree-node": C.value.nodeToRender
|
|
231
269
|
}, null, 8, ["tree-node"])) : Y("", !0)
|
|
232
270
|
], 4)
|
|
233
271
|
], 32)) : Y("", !0)
|
|
234
|
-
], 14,
|
|
272
|
+
], 14, je));
|
|
235
273
|
}
|
|
236
|
-
}),
|
|
274
|
+
}), Qe = /* @__PURE__ */ V(qe, [["__scopeId", "data-v-2f22290e"]]), Je = ["id"], Ge = /* @__PURE__ */ B({
|
|
237
275
|
__name: "RootLayer",
|
|
238
276
|
props: {
|
|
239
277
|
treeNode: {},
|
|
@@ -241,34 +279,34 @@ const ze = ["id"], We = /* @__PURE__ */ B({
|
|
|
241
279
|
layout: {}
|
|
242
280
|
},
|
|
243
281
|
setup(e) {
|
|
244
|
-
const n = e, { uid:
|
|
245
|
-
|
|
282
|
+
const n = e, { uid: f, initialConfig: c, reactiveConfig: t } = z(
|
|
283
|
+
T.ROOT_LAYER,
|
|
246
284
|
n
|
|
247
|
-
), { effectiveConfig:
|
|
248
|
-
() => new
|
|
285
|
+
), { effectiveConfig: l, effectiveLayout: P, elementRef: i } = F(
|
|
286
|
+
() => new me(f.value, c.value, n.treeNode?.type),
|
|
249
287
|
t
|
|
250
|
-
),
|
|
251
|
-
return (
|
|
252
|
-
id: o(
|
|
288
|
+
), u = D(() => P.value ? J(P.value) : {});
|
|
289
|
+
return (s, p) => (R(), S("div", {
|
|
290
|
+
id: o(f),
|
|
253
291
|
ref_key: "elementRef",
|
|
254
292
|
ref: i,
|
|
255
|
-
class:
|
|
256
|
-
style: O(
|
|
293
|
+
class: $(["omnipad-root-layer omnipad-prevent", o(l)?.cssClass]),
|
|
294
|
+
style: O(u.value)
|
|
257
295
|
}, [
|
|
258
|
-
|
|
296
|
+
X(ve, {
|
|
259
297
|
nodes: e.treeNode?.children || []
|
|
260
298
|
}, {
|
|
261
|
-
default:
|
|
262
|
-
|
|
299
|
+
default: I(() => [
|
|
300
|
+
b(s.$slots, "default", {}, void 0, !0)
|
|
263
301
|
]),
|
|
264
302
|
_: 3
|
|
265
303
|
}, 8, ["nodes"])
|
|
266
|
-
], 14,
|
|
304
|
+
], 14, Je));
|
|
267
305
|
}
|
|
268
|
-
}),
|
|
306
|
+
}), He = /* @__PURE__ */ V(Ge, [["__scopeId", "data-v-ad8f02d4"]]), Xe = ["id"], et = {
|
|
269
307
|
key: 0,
|
|
270
308
|
class: "omnipad-default-focus-border-feedback"
|
|
271
|
-
},
|
|
309
|
+
}, tt = /* @__PURE__ */ B({
|
|
272
310
|
__name: "TargetZone",
|
|
273
311
|
props: {
|
|
274
312
|
treeNode: {},
|
|
@@ -278,101 +316,101 @@ const ze = ["id"], We = /* @__PURE__ */ B({
|
|
|
278
316
|
layout: {}
|
|
279
317
|
},
|
|
280
318
|
setup(e) {
|
|
281
|
-
const n = e,
|
|
319
|
+
const n = e, f = {
|
|
282
320
|
cursorAutoDelay: 2500
|
|
283
|
-
}, { uid:
|
|
284
|
-
|
|
321
|
+
}, { uid: c, initialConfig: t, reactiveConfig: l } = z(
|
|
322
|
+
T.TARGET_ZONE,
|
|
285
323
|
n,
|
|
286
|
-
|
|
287
|
-
), { core:
|
|
288
|
-
() => new
|
|
289
|
-
|
|
324
|
+
f
|
|
325
|
+
), { core: P, state: i, domEvents: u, effectiveConfig: s, effectiveLayout: p, elementRef: h } = F(
|
|
326
|
+
() => new ge(c.value, t.value, n.treeNode?.type),
|
|
327
|
+
l,
|
|
290
328
|
{},
|
|
291
329
|
{
|
|
292
|
-
dispatchKeyboardEvent:
|
|
293
|
-
dispatchPointerEventAtPos:
|
|
294
|
-
reclaimFocusAtPos:
|
|
330
|
+
dispatchKeyboardEvent: le,
|
|
331
|
+
dispatchPointerEventAtPos: $e,
|
|
332
|
+
reclaimFocusAtPos: De
|
|
295
333
|
}
|
|
296
|
-
),
|
|
334
|
+
), _ = D(() => p.value ? J(p.value) : {}), w = Q(), k = D(() => {
|
|
297
335
|
if (!i.value) return { display: "none" };
|
|
298
|
-
let v,
|
|
299
|
-
const
|
|
300
|
-
if (
|
|
301
|
-
v = `${
|
|
336
|
+
let v, r;
|
|
337
|
+
const N = i?.value?.position;
|
|
338
|
+
if (w)
|
|
339
|
+
v = `${N.x}cqw`, r = `${N.y}cqh`;
|
|
302
340
|
else {
|
|
303
|
-
const
|
|
304
|
-
v = `${
|
|
341
|
+
const y = P?.value?.rect;
|
|
342
|
+
v = `${H(N?.x || 0, 0, 100, 0, y?.width || 0)}px`, r = `${H(N?.y || 0, 0, 100, 0, y?.height || 0)}px`;
|
|
305
343
|
}
|
|
306
344
|
return {
|
|
307
345
|
"--omnipad-virtual-cursor-x": v,
|
|
308
|
-
"--omnipad-virtual-cursor-y":
|
|
346
|
+
"--omnipad-virtual-cursor-y": r,
|
|
309
347
|
opacity: i.value.isVisible ? 1 : 0
|
|
310
348
|
};
|
|
311
|
-
}),
|
|
312
|
-
return (v,
|
|
313
|
-
id: o(
|
|
349
|
+
}), C = (v) => u?.onPointerDown?.(v), a = (v) => u?.onPointerMove?.(v), d = (v) => u?.onPointerUp?.(v), g = (v) => u?.onPointerCancel?.(v);
|
|
350
|
+
return (v, r) => (R(), S("div", {
|
|
351
|
+
id: o(c),
|
|
314
352
|
ref_key: "elementRef",
|
|
315
|
-
ref:
|
|
316
|
-
class:
|
|
317
|
-
style: O(
|
|
318
|
-
onPointerdown:
|
|
319
|
-
onPointermove:
|
|
320
|
-
onPointerup:
|
|
321
|
-
onPointercancel:
|
|
322
|
-
onLostpointercapture:
|
|
353
|
+
ref: h,
|
|
354
|
+
class: $(["omnipad-target-zone omnipad-prevent", o(s)?.cssClass]),
|
|
355
|
+
style: O(_.value),
|
|
356
|
+
onPointerdown: C,
|
|
357
|
+
onPointermove: a,
|
|
358
|
+
onPointerup: d,
|
|
359
|
+
onPointercancel: g,
|
|
360
|
+
onLostpointercapture: g
|
|
323
361
|
}, [
|
|
324
|
-
|
|
362
|
+
b(v.$slots, "focus-feedback", {
|
|
325
363
|
state: o(i),
|
|
326
364
|
isReturning: o(i)?.isFocusReturning,
|
|
327
365
|
cursorPos: o(i)?.position
|
|
328
366
|
}, () => [
|
|
329
|
-
|
|
330
|
-
default:
|
|
331
|
-
o(i)?.isFocusReturning ? (
|
|
367
|
+
X(Oe, { name: "omnipad-default-focus-fade" }, {
|
|
368
|
+
default: I(() => [
|
|
369
|
+
o(i)?.isFocusReturning ? (R(), S("div", et)) : Y("", !0)
|
|
332
370
|
]),
|
|
333
371
|
_: 1
|
|
334
372
|
})
|
|
335
373
|
], !0),
|
|
336
|
-
o(
|
|
374
|
+
o(s)?.cursorEnabled ? (R(), S("div", {
|
|
337
375
|
key: 0,
|
|
338
376
|
class: "omnipad-virtual-cursor",
|
|
339
|
-
style: O(
|
|
377
|
+
style: O(k.value)
|
|
340
378
|
}, [
|
|
341
|
-
|
|
379
|
+
b(v.$slots, "cursor", {
|
|
342
380
|
state: o(i),
|
|
343
381
|
isDown: o(i)?.isPointerDown,
|
|
344
382
|
isReturning: o(i)?.isFocusReturning,
|
|
345
383
|
cursorPos: o(i)?.position
|
|
346
384
|
}, () => [
|
|
347
|
-
|
|
348
|
-
class:
|
|
385
|
+
E("div", {
|
|
386
|
+
class: $(["omnipad-default-cursor-dot", { "is-down": o(i)?.isPointerDown }])
|
|
349
387
|
}, null, 2)
|
|
350
388
|
], !0)
|
|
351
389
|
], 4)) : Y("", !0),
|
|
352
|
-
o(
|
|
390
|
+
o(s)?.cursorEnabled ? (R(), S("div", {
|
|
353
391
|
key: 1,
|
|
354
392
|
class: "omnipad-virtual-cursor",
|
|
355
|
-
style: O(
|
|
393
|
+
style: O(k.value)
|
|
356
394
|
}, [
|
|
357
|
-
|
|
395
|
+
b(v.$slots, "with-cursor", {
|
|
358
396
|
state: o(i),
|
|
359
397
|
isDown: o(i)?.isPointerDown,
|
|
360
398
|
isReturning: o(i)?.isFocusReturning,
|
|
361
399
|
cursorPos: o(i)?.position
|
|
362
400
|
}, void 0, !0)
|
|
363
401
|
], 4)) : Y("", !0),
|
|
364
|
-
|
|
402
|
+
b(v.$slots, "default", {
|
|
365
403
|
state: o(i),
|
|
366
404
|
isDown: o(i)?.isPointerDown,
|
|
367
405
|
isReturning: o(i)?.isFocusReturning,
|
|
368
406
|
cursorPos: o(i)?.position
|
|
369
407
|
}, void 0, !0)
|
|
370
|
-
], 46,
|
|
408
|
+
], 46, Xe));
|
|
371
409
|
}
|
|
372
|
-
}),
|
|
410
|
+
}), ot = /* @__PURE__ */ V(tt, [["__scopeId", "data-v-b1782723"]]), nt = { class: "omnipad-button-content-layer" }, it = {
|
|
373
411
|
key: 0,
|
|
374
412
|
class: "omnipad-default-button-label"
|
|
375
|
-
},
|
|
413
|
+
}, st = /* @__PURE__ */ B({
|
|
376
414
|
__name: "VirtualButtonBase",
|
|
377
415
|
props: {
|
|
378
416
|
layout: {},
|
|
@@ -380,31 +418,31 @@ const ze = ["id"], We = /* @__PURE__ */ B({
|
|
|
380
418
|
label: {}
|
|
381
419
|
},
|
|
382
420
|
setup(e) {
|
|
383
|
-
const n = e,
|
|
384
|
-
return (
|
|
421
|
+
const n = e, f = D(() => n.layout ? J(n.layout) : {});
|
|
422
|
+
return (c, t) => (R(), S("div", {
|
|
385
423
|
class: "omnipad-button-base omnipad-prevent",
|
|
386
|
-
style: O(
|
|
424
|
+
style: O(f.value),
|
|
387
425
|
tabindex: "-1"
|
|
388
426
|
}, [
|
|
389
|
-
|
|
427
|
+
b(c.$slots, "base", {
|
|
390
428
|
isActive: e.isActive,
|
|
391
429
|
label: e.label
|
|
392
430
|
}, () => [
|
|
393
|
-
|
|
394
|
-
class:
|
|
431
|
+
E("div", {
|
|
432
|
+
class: $(["omnipad-default-button-base", { "is-active": e.isActive }])
|
|
395
433
|
}, null, 2)
|
|
396
434
|
], !0),
|
|
397
|
-
|
|
398
|
-
|
|
435
|
+
E("div", nt, [
|
|
436
|
+
b(c.$slots, "default", {
|
|
399
437
|
isActive: e.isActive,
|
|
400
438
|
label: e.label
|
|
401
439
|
}, () => [
|
|
402
|
-
e.label ? (
|
|
440
|
+
e.label ? (R(), S("span", it, Ve(e.label), 1)) : Y("", !0)
|
|
403
441
|
], !0)
|
|
404
442
|
])
|
|
405
443
|
], 4));
|
|
406
444
|
}
|
|
407
|
-
}),
|
|
445
|
+
}), ne = /* @__PURE__ */ V(st, [["__scopeId", "data-v-f6a6e082"]]), at = /* @__PURE__ */ B({
|
|
408
446
|
__name: "VirtualButton",
|
|
409
447
|
props: {
|
|
410
448
|
treeNode: {},
|
|
@@ -415,43 +453,43 @@ const ze = ["id"], We = /* @__PURE__ */ B({
|
|
|
415
453
|
layout: {}
|
|
416
454
|
},
|
|
417
455
|
setup(e, { expose: n }) {
|
|
418
|
-
const
|
|
456
|
+
const f = e, c = {
|
|
419
457
|
label: "BTN"
|
|
420
|
-
}, { uid: t, initialConfig:
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
), { core: i, state:
|
|
458
|
+
}, { uid: t, initialConfig: l, reactiveConfig: P } = z(
|
|
459
|
+
T.BUTTON,
|
|
460
|
+
f,
|
|
461
|
+
c
|
|
462
|
+
), { core: i, state: u, domEvents: s, effectiveConfig: p, effectiveLayout: h, elementRef: _ } = F(() => new Pe(t.value, l.value, f.treeNode?.type), P), w = (d) => s?.onPointerDown?.(d), k = (d) => s?.onPointerMove?.(d), C = (d) => s?.onPointerUp?.(d), a = (d) => s?.onPointerCancel?.(d);
|
|
425
463
|
return n({
|
|
426
464
|
uid: t,
|
|
427
|
-
onPointerDown:
|
|
428
|
-
onPointerMove:
|
|
429
|
-
onPointerUp:
|
|
430
|
-
onPointerCancel:
|
|
465
|
+
onPointerDown: w,
|
|
466
|
+
onPointerMove: k,
|
|
467
|
+
onPointerUp: C,
|
|
468
|
+
onPointerCancel: a,
|
|
431
469
|
markRectDirty: () => i.value?.markRectDirty
|
|
432
|
-
}), (
|
|
470
|
+
}), (d, g) => (R(), Z(ne, {
|
|
433
471
|
id: o(t),
|
|
434
472
|
ref_key: "elementRef",
|
|
435
|
-
ref:
|
|
436
|
-
class:
|
|
437
|
-
layout: o(
|
|
438
|
-
label: o(
|
|
439
|
-
"is-active": o(
|
|
440
|
-
onPointerdown:
|
|
441
|
-
onPointerup:
|
|
442
|
-
onPointercancel:
|
|
443
|
-
onLostpointercapture:
|
|
473
|
+
ref: _,
|
|
474
|
+
class: $(["omnipad-button omnipad-prevent", o(p)?.cssClass]),
|
|
475
|
+
layout: o(h),
|
|
476
|
+
label: o(p)?.label,
|
|
477
|
+
"is-active": o(u)?.isPressed,
|
|
478
|
+
onPointerdown: w,
|
|
479
|
+
onPointerup: C,
|
|
480
|
+
onPointercancel: a,
|
|
481
|
+
onLostpointercapture: a
|
|
444
482
|
}, {
|
|
445
|
-
base:
|
|
446
|
-
|
|
483
|
+
base: I((v) => [
|
|
484
|
+
b(d.$slots, "base", U(L(v)))
|
|
447
485
|
]),
|
|
448
|
-
default:
|
|
449
|
-
|
|
486
|
+
default: I((v) => [
|
|
487
|
+
b(d.$slots, "default", U(L(v)))
|
|
450
488
|
]),
|
|
451
489
|
_: 3
|
|
452
490
|
}, 8, ["id", "class", "layout", "label", "is-active"]));
|
|
453
491
|
}
|
|
454
|
-
}),
|
|
492
|
+
}), rt = { class: "omnipad-axis-bg" }, ct = { class: "omnipad-axis-content-layer" }, lt = /* @__PURE__ */ B({
|
|
455
493
|
__name: "VirtualAxisBase",
|
|
456
494
|
props: {
|
|
457
495
|
layout: {},
|
|
@@ -461,51 +499,51 @@ const ze = ["id"], We = /* @__PURE__ */ B({
|
|
|
461
499
|
baseRadius: {}
|
|
462
500
|
},
|
|
463
501
|
setup(e) {
|
|
464
|
-
const n = e,
|
|
465
|
-
const
|
|
502
|
+
const n = e, f = D(() => n.layout ? J(n.layout) : {}), c = Q(), t = D(() => {
|
|
503
|
+
const l = n.vector?.x || 0, P = n.vector?.y || 0, i = n.baseRadius?.x || 0, u = n.baseRadius?.y || 0, s = c ? `${l * 50}cqw` : `${l * i}px`, p = c ? `${P * 50}cqh` : `${P * u}px`, h = c ? "100cqw" : `${i * 2}px`, _ = c ? "100cqh" : `${u * 2}px`;
|
|
466
504
|
return {
|
|
467
|
-
"--omnipad-axis-stick-container-x":
|
|
468
|
-
"--omnipad-axis-stick-container-y":
|
|
469
|
-
"--omnipad-axis-stick-width":
|
|
470
|
-
"--omnipad-axis-stick-height":
|
|
505
|
+
"--omnipad-axis-stick-container-x": s,
|
|
506
|
+
"--omnipad-axis-stick-container-y": p,
|
|
507
|
+
"--omnipad-axis-stick-width": h,
|
|
508
|
+
"--omnipad-axis-stick-height": _,
|
|
471
509
|
// 松手时加一点回弹过渡,活动时取消过渡保证绝对跟手
|
|
472
510
|
transition: n.isActive ? "none" : "transform 0.1s ease-out"
|
|
473
511
|
};
|
|
474
512
|
});
|
|
475
|
-
return (
|
|
476
|
-
class:
|
|
477
|
-
style: O(
|
|
513
|
+
return (l, P) => (R(), S("div", {
|
|
514
|
+
class: $(["omnipad-axis-base omnipad-prevent", { "is-active": e.isActive }]),
|
|
515
|
+
style: O(f.value),
|
|
478
516
|
tabindex: "-1"
|
|
479
517
|
}, [
|
|
480
|
-
|
|
481
|
-
|
|
518
|
+
E("div", rt, [
|
|
519
|
+
b(l.$slots, "base", {
|
|
482
520
|
isActive: e.isActive,
|
|
483
521
|
vector: e.vector
|
|
484
522
|
}, void 0, !0)
|
|
485
523
|
]),
|
|
486
|
-
e.showStick ? (
|
|
524
|
+
e.showStick ? (R(), S("div", {
|
|
487
525
|
key: 0,
|
|
488
526
|
class: "omnipad-axis-stick-container",
|
|
489
527
|
style: O(t.value)
|
|
490
528
|
}, [
|
|
491
|
-
|
|
529
|
+
b(l.$slots, "stick", {
|
|
492
530
|
isActive: e.isActive,
|
|
493
531
|
vector: e.vector
|
|
494
532
|
}, () => [
|
|
495
|
-
|
|
496
|
-
class:
|
|
533
|
+
E("div", {
|
|
534
|
+
class: $(["omnipad-default-axis-stick", { "is-active": e.isActive }])
|
|
497
535
|
}, null, 2)
|
|
498
536
|
], !0)
|
|
499
537
|
], 4)) : Y("", !0),
|
|
500
|
-
|
|
501
|
-
|
|
538
|
+
E("div", ct, [
|
|
539
|
+
b(l.$slots, "default", {
|
|
502
540
|
isActive: e.isActive,
|
|
503
541
|
vector: e.vector
|
|
504
542
|
}, void 0, !0)
|
|
505
543
|
])
|
|
506
544
|
], 6));
|
|
507
545
|
}
|
|
508
|
-
}), fe = /* @__PURE__ */ V(
|
|
546
|
+
}), fe = /* @__PURE__ */ V(lt, [["__scopeId", "data-v-6ae17f17"]]), ut = { class: "omnipad-dpad-cross-bg" }, dt = /* @__PURE__ */ B({
|
|
509
547
|
__name: "VirtualDPad",
|
|
510
548
|
props: {
|
|
511
549
|
treeNode: {},
|
|
@@ -517,70 +555,70 @@ const ze = ["id"], We = /* @__PURE__ */ B({
|
|
|
517
555
|
layout: {}
|
|
518
556
|
},
|
|
519
557
|
setup(e, { expose: n }) {
|
|
520
|
-
const
|
|
558
|
+
const f = e, c = {
|
|
521
559
|
showStick: !1,
|
|
522
560
|
threshold: 0.3
|
|
523
|
-
}, { uid: t, initialConfig:
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
), { core: i, state:
|
|
528
|
-
const
|
|
529
|
-
|
|
561
|
+
}, { uid: t, initialConfig: l, reactiveConfig: P } = z(
|
|
562
|
+
T.D_PAD,
|
|
563
|
+
f,
|
|
564
|
+
c
|
|
565
|
+
), { core: i, state: u, domEvents: s, effectiveConfig: p, effectiveLayout: h, elementRef: _ } = F(() => new be(t.value, l.value, f.treeNode?.type), P), w = Q(), k = M({ x: 0, y: 0 }), C = ue(() => {
|
|
566
|
+
const r = i.value?.rect;
|
|
567
|
+
r && (k.value = { x: r.width / 2, y: r.height / 2 });
|
|
530
568
|
});
|
|
531
|
-
|
|
532
|
-
const
|
|
569
|
+
w && C();
|
|
570
|
+
const a = (r) => s?.onPointerDown?.(r), d = (r) => s?.onPointerMove?.(r), g = (r) => s?.onPointerUp?.(r), v = (r) => s?.onPointerCancel?.(r);
|
|
533
571
|
return n({
|
|
534
572
|
uid: t,
|
|
535
|
-
onPointerDown:
|
|
536
|
-
onPointerMove:
|
|
537
|
-
onPointerUp:
|
|
573
|
+
onPointerDown: a,
|
|
574
|
+
onPointerMove: d,
|
|
575
|
+
onPointerUp: g,
|
|
538
576
|
onPointerCancel: v,
|
|
539
577
|
markRectDirty: () => i.value?.markRectDirty()
|
|
540
|
-
}), (
|
|
578
|
+
}), (r, N) => (R(), Z(fe, {
|
|
541
579
|
ref_key: "elementRef",
|
|
542
|
-
ref:
|
|
543
|
-
class:
|
|
544
|
-
layout: o(
|
|
545
|
-
"is-active": o(
|
|
546
|
-
vector: o(
|
|
547
|
-
"show-stick": o(
|
|
548
|
-
"base-radius":
|
|
549
|
-
onPointerdown:
|
|
550
|
-
onPointermove:
|
|
551
|
-
onPointerup:
|
|
580
|
+
ref: _,
|
|
581
|
+
class: $(["omnipad-dpad omnipad-prevent", o(p)?.cssClass]),
|
|
582
|
+
layout: o(h),
|
|
583
|
+
"is-active": o(u)?.isActive,
|
|
584
|
+
vector: o(u)?.vector,
|
|
585
|
+
"show-stick": o(p)?.showStick,
|
|
586
|
+
"base-radius": k.value,
|
|
587
|
+
onPointerdown: a,
|
|
588
|
+
onPointermove: d,
|
|
589
|
+
onPointerup: g,
|
|
552
590
|
onPointercancel: v,
|
|
553
591
|
onLostpointercapture: v
|
|
554
592
|
}, {
|
|
555
|
-
base:
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
class:
|
|
593
|
+
base: I((y) => [
|
|
594
|
+
b(r.$slots, "base", U(L(y)), () => [
|
|
595
|
+
E("div", ut, [
|
|
596
|
+
E("div", {
|
|
597
|
+
class: $(["dpad-arm top", { on: y.vector && y.vector.y < -o(p)?.threshold }])
|
|
560
598
|
}, null, 2),
|
|
561
|
-
|
|
562
|
-
class:
|
|
599
|
+
E("div", {
|
|
600
|
+
class: $(["dpad-arm bottom", { on: y.vector && y.vector.y > o(p)?.threshold }])
|
|
563
601
|
}, null, 2),
|
|
564
|
-
|
|
565
|
-
class:
|
|
602
|
+
E("div", {
|
|
603
|
+
class: $(["dpad-arm left", { on: y.vector && y.vector.x < -o(p)?.threshold }])
|
|
566
604
|
}, null, 2),
|
|
567
|
-
|
|
568
|
-
class:
|
|
605
|
+
E("div", {
|
|
606
|
+
class: $(["dpad-arm right", { on: y.vector && y.vector.x > o(p)?.threshold }])
|
|
569
607
|
}, null, 2),
|
|
570
|
-
|
|
608
|
+
N[0] || (N[0] = E("div", { class: "dpad-center" }, null, -1))
|
|
571
609
|
])
|
|
572
610
|
], !0)
|
|
573
611
|
]),
|
|
574
|
-
stick:
|
|
575
|
-
|
|
612
|
+
stick: I((y) => [
|
|
613
|
+
b(r.$slots, "stick", U(L(y)), void 0, !0)
|
|
576
614
|
]),
|
|
577
|
-
default:
|
|
578
|
-
|
|
615
|
+
default: I((y) => [
|
|
616
|
+
b(r.$slots, "default", U(L(y)), void 0, !0)
|
|
579
617
|
]),
|
|
580
618
|
_: 3
|
|
581
619
|
}, 8, ["class", "layout", "is-active", "vector", "show-stick", "base-radius"]));
|
|
582
620
|
}
|
|
583
|
-
}),
|
|
621
|
+
}), vt = /* @__PURE__ */ V(dt, [["__scopeId", "data-v-8c030849"]]), ft = /* @__PURE__ */ B({
|
|
584
622
|
__name: "VirtualTrackpad",
|
|
585
623
|
props: {
|
|
586
624
|
treeNode: {},
|
|
@@ -592,45 +630,45 @@ const ze = ["id"], We = /* @__PURE__ */ B({
|
|
|
592
630
|
layout: {}
|
|
593
631
|
},
|
|
594
632
|
setup(e, { expose: n }) {
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
633
|
+
const f = e, { uid: c, initialConfig: t, reactiveConfig: l } = z(
|
|
634
|
+
T.TRACKPAD,
|
|
635
|
+
f,
|
|
598
636
|
{
|
|
599
637
|
label: "TRACKPAD",
|
|
600
638
|
sensitivity: 1
|
|
601
639
|
}
|
|
602
|
-
), { core:
|
|
640
|
+
), { core: P, state: i, domEvents: u, effectiveConfig: s, effectiveLayout: p, elementRef: h } = F(() => new he(c.value, t.value, f.treeNode?.type), l), _ = (a) => u?.onPointerDown?.(a), w = (a) => u?.onPointerMove?.(a), k = (a) => u?.onPointerUp?.(a), C = (a) => u?.onPointerCancel?.(a);
|
|
603
641
|
return n({
|
|
604
|
-
uid:
|
|
605
|
-
onPointerDown:
|
|
606
|
-
onPointerMove:
|
|
607
|
-
onPointerUp:
|
|
608
|
-
onPointerCancel:
|
|
609
|
-
markRectDirty: () =>
|
|
610
|
-
}), (
|
|
611
|
-
id: o(
|
|
642
|
+
uid: c,
|
|
643
|
+
onPointerDown: _,
|
|
644
|
+
onPointerMove: w,
|
|
645
|
+
onPointerUp: k,
|
|
646
|
+
onPointerCancel: C,
|
|
647
|
+
markRectDirty: () => P.value?.markRectDirty
|
|
648
|
+
}), (a, d) => (R(), Z(ne, {
|
|
649
|
+
id: o(c),
|
|
612
650
|
ref_key: "elementRef",
|
|
613
|
-
ref:
|
|
614
|
-
class:
|
|
615
|
-
layout: o(
|
|
616
|
-
label: o(
|
|
651
|
+
ref: h,
|
|
652
|
+
class: $(["omnipad-trackpad omnipad-prevent", o(s)?.cssClass]),
|
|
653
|
+
layout: o(p),
|
|
654
|
+
label: o(s)?.label,
|
|
617
655
|
"is-active": o(i)?.isPressed,
|
|
618
|
-
onPointerdown:
|
|
619
|
-
onPointermove:
|
|
620
|
-
onPointerup:
|
|
621
|
-
onPointercancel:
|
|
622
|
-
onLostpointercapture:
|
|
656
|
+
onPointerdown: _,
|
|
657
|
+
onPointermove: w,
|
|
658
|
+
onPointerup: k,
|
|
659
|
+
onPointercancel: C,
|
|
660
|
+
onLostpointercapture: C
|
|
623
661
|
}, {
|
|
624
|
-
base:
|
|
625
|
-
|
|
662
|
+
base: I((g) => [
|
|
663
|
+
b(a.$slots, "base", U(L(g)), void 0, !0)
|
|
626
664
|
]),
|
|
627
|
-
default:
|
|
628
|
-
|
|
665
|
+
default: I((g) => [
|
|
666
|
+
b(a.$slots, "default", U(L(g)), void 0, !0)
|
|
629
667
|
]),
|
|
630
668
|
_: 3
|
|
631
669
|
}, 8, ["id", "class", "layout", "label", "is-active"]));
|
|
632
670
|
}
|
|
633
|
-
}),
|
|
671
|
+
}), pt = /* @__PURE__ */ V(ft, [["__scopeId", "data-v-bacab613"]]), yt = /* @__PURE__ */ B({
|
|
634
672
|
__name: "VirtualJoystick",
|
|
635
673
|
props: {
|
|
636
674
|
treeNode: {},
|
|
@@ -644,88 +682,88 @@ const ze = ["id"], We = /* @__PURE__ */ B({
|
|
|
644
682
|
layout: {}
|
|
645
683
|
},
|
|
646
684
|
setup(e, { expose: n }) {
|
|
647
|
-
const
|
|
685
|
+
const f = e, c = {
|
|
648
686
|
label: "PUSH",
|
|
649
687
|
threshold: 0.2,
|
|
650
688
|
cursorMode: !1,
|
|
651
689
|
cursorSensitivity: 1
|
|
652
|
-
}, { uid: t, initialConfig:
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
), { core: i, state:
|
|
657
|
-
const
|
|
658
|
-
|
|
690
|
+
}, { uid: t, initialConfig: l, reactiveConfig: P } = z(
|
|
691
|
+
T.JOYSTICK,
|
|
692
|
+
f,
|
|
693
|
+
c
|
|
694
|
+
), { core: i, state: u, domEvents: s, effectiveConfig: p, effectiveLayout: h, elementRef: _ } = F(() => new Ce(t.value, l.value, f.treeNode?.type), P), w = Q(), k = M({ x: 0, y: 0 }), C = ue(() => {
|
|
695
|
+
const r = i.value?.rect;
|
|
696
|
+
r && (k.value = { x: r.width / 2, y: r.height / 2 });
|
|
659
697
|
});
|
|
660
|
-
|
|
661
|
-
const
|
|
698
|
+
w && C();
|
|
699
|
+
const a = (r) => s?.onPointerDown?.(r), d = (r) => s?.onPointerMove?.(r), g = (r) => s?.onPointerUp?.(r), v = (r) => s?.onPointerCancel?.(r);
|
|
662
700
|
return n({
|
|
663
701
|
uid: t,
|
|
664
|
-
onPointerDown:
|
|
665
|
-
onPointerMove:
|
|
666
|
-
onPointerUp:
|
|
702
|
+
onPointerDown: a,
|
|
703
|
+
onPointerMove: d,
|
|
704
|
+
onPointerUp: g,
|
|
667
705
|
onPointerCancel: v,
|
|
668
706
|
markRectDirty: () => i.value?.markRectDirty
|
|
669
|
-
}), (
|
|
707
|
+
}), (r, N) => (R(), Z(fe, {
|
|
670
708
|
ref_key: "elementRef",
|
|
671
|
-
ref:
|
|
672
|
-
class:
|
|
673
|
-
layout: o(
|
|
674
|
-
"is-active": o(
|
|
675
|
-
vector: o(
|
|
709
|
+
ref: _,
|
|
710
|
+
class: $(["omnipad-joystick omnipad-prevent", o(p)?.cssClass]),
|
|
711
|
+
layout: o(h),
|
|
712
|
+
"is-active": o(u)?.isActive,
|
|
713
|
+
vector: o(u)?.vector,
|
|
676
714
|
"show-stick": "",
|
|
677
|
-
"base-radius":
|
|
678
|
-
onPointerdown:
|
|
679
|
-
onPointermove:
|
|
680
|
-
onPointerup:
|
|
715
|
+
"base-radius": k.value,
|
|
716
|
+
onPointerdown: a,
|
|
717
|
+
onPointermove: d,
|
|
718
|
+
onPointerup: g,
|
|
681
719
|
onPointercancel: v,
|
|
682
720
|
onLostpointercapture: v
|
|
683
721
|
}, {
|
|
684
|
-
base:
|
|
685
|
-
|
|
722
|
+
base: I((y) => [
|
|
723
|
+
b(r.$slots, "base", U(L(y)), void 0, !0)
|
|
686
724
|
]),
|
|
687
|
-
stick:
|
|
688
|
-
|
|
725
|
+
stick: I(() => [
|
|
726
|
+
X(ne, {
|
|
689
727
|
layout: { height: "100%", width: "100%" },
|
|
690
|
-
"is-active": o(
|
|
691
|
-
label: o(
|
|
728
|
+
"is-active": o(u)?.isPressed,
|
|
729
|
+
label: o(p)?.label
|
|
692
730
|
}, {
|
|
693
|
-
base:
|
|
694
|
-
|
|
731
|
+
base: I((y) => [
|
|
732
|
+
b(r.$slots, "stick-base", U(L(y)), void 0, !0)
|
|
695
733
|
]),
|
|
696
|
-
default:
|
|
697
|
-
|
|
734
|
+
default: I((y) => [
|
|
735
|
+
b(r.$slots, "stick", U(L(y)), void 0, !0)
|
|
698
736
|
]),
|
|
699
737
|
_: 3
|
|
700
738
|
}, 8, ["is-active", "label"])
|
|
701
739
|
]),
|
|
702
|
-
default:
|
|
703
|
-
|
|
740
|
+
default: I((y) => [
|
|
741
|
+
b(r.$slots, "default", U(L(y)), void 0, !0)
|
|
704
742
|
]),
|
|
705
743
|
_: 3
|
|
706
744
|
}, 8, ["class", "layout", "is-active", "vector", "base-radius"]));
|
|
707
745
|
}
|
|
708
|
-
}),
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
(e.type ===
|
|
746
|
+
}), mt = /* @__PURE__ */ V(yt, [["__scopeId", "data-v-ae628e53"]]);
|
|
747
|
+
K(T.BUTTON, at);
|
|
748
|
+
K(T.INPUT_ZONE, Qe);
|
|
749
|
+
K(T.ROOT_LAYER, He);
|
|
750
|
+
K(T.TARGET_ZONE, ot);
|
|
751
|
+
K(T.TRACKPAD, pt);
|
|
752
|
+
K(T.D_PAD, vt);
|
|
753
|
+
K(T.JOYSTICK, mt);
|
|
754
|
+
ke((e) => {
|
|
755
|
+
(e.type === ae.KEYDOWN || e.type === ae.KEYUP) && le(e.type, e.payload);
|
|
718
756
|
});
|
|
719
757
|
export {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
758
|
+
Qe as InputZone,
|
|
759
|
+
He as RootLayer,
|
|
760
|
+
ot as TargetZone,
|
|
761
|
+
at as VirtualButton,
|
|
762
|
+
vt as VirtualDPad,
|
|
763
|
+
mt as VirtualJoystick,
|
|
764
|
+
pt as VirtualTrackpad,
|
|
765
|
+
de as getComponent,
|
|
766
|
+
ce as getComponentSafe,
|
|
767
|
+
Ct as hasRegisteredComponent,
|
|
768
|
+
K as registerComponent
|
|
731
769
|
};
|