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