@omnipad/vue 0.5.0 → 0.6.1
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 +20 -17
- package/dist/omnipad-vue.css +1 -1
- package/dist/omnipad-vue.mjs +527 -505
- package/dist/omnipad-vue.umd.js +1 -1
- package/package.json +2 -2
package/dist/omnipad-vue.mjs
CHANGED
|
@@ -1,164 +1,226 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { defineComponent as
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
|
|
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;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
render: () =>
|
|
9
|
+
function le(e) {
|
|
10
|
+
const o = W[e];
|
|
11
|
+
return o || I({
|
|
12
|
+
render: () => Oe("div", { style: "color:red" }, `[Unknown: ${e}]`)
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return !e || !
|
|
15
|
+
function ne(e) {
|
|
16
|
+
return !e || !W[e] ? null : W[e];
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return e ? !!
|
|
18
|
+
function It(e) {
|
|
19
|
+
return e ? !!W[e] : !1;
|
|
20
20
|
}
|
|
21
|
-
|
|
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;
|
|
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
|
-
);
|
|
51
|
-
let _ = { ...n.value };
|
|
52
|
-
te(
|
|
53
|
-
n,
|
|
54
|
-
(a) => {
|
|
55
|
-
if (!l.value) return;
|
|
56
|
-
const d = Me(_, a);
|
|
57
|
-
Object.keys(d).length > 0 && l.value.updateConfig(d), _ = { ...n.value };
|
|
58
|
-
},
|
|
59
|
-
{ deep: !0 }
|
|
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();
|
|
71
|
-
if ("bindRectProvider" in t) {
|
|
72
|
-
const g = Ye(() => a.getBoundingClientRect());
|
|
73
|
-
t.bindRectProvider(g.get, () => {
|
|
74
|
-
g.markDirty(), s && (s.markDirty(), h());
|
|
75
|
-
}), d.observeResize(t.uid, a, () => {
|
|
76
|
-
t.markRectDirty();
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
d.observeIntersect(t.uid, a, (g) => {
|
|
80
|
-
g || t.reset();
|
|
81
|
-
});
|
|
82
|
-
}
|
|
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;
|
|
92
|
-
});
|
|
93
|
-
return {
|
|
94
|
-
core: ee(l),
|
|
95
|
-
state: ee(P),
|
|
96
|
-
domEvents: k,
|
|
97
|
-
effectiveConfig: ee(i),
|
|
98
|
-
effectiveLayout: C,
|
|
99
|
-
elementRef: u,
|
|
100
|
-
bindDelegates: w
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
const Fe = { class: "omnipad-virtual-layer-base omnipad-prevent" }, ze = /* @__PURE__ */ B({
|
|
21
|
+
const Je = { class: "omnipad-virtual-layer-base omnipad-prevent" }, Qe = /* @__PURE__ */ I({
|
|
104
22
|
__name: "VirtualLayerBase",
|
|
105
23
|
props: {
|
|
106
24
|
nodes: {}
|
|
107
25
|
},
|
|
108
26
|
setup(e) {
|
|
109
|
-
const
|
|
110
|
-
let
|
|
111
|
-
return !
|
|
112
|
-
node:
|
|
113
|
-
component:
|
|
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)), {
|
|
30
|
+
node: s,
|
|
31
|
+
component: n
|
|
114
32
|
};
|
|
115
33
|
}));
|
|
116
|
-
return (
|
|
117
|
-
(
|
|
118
|
-
key:
|
|
119
|
-
"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
|
|
120
38
|
}, null, 8, ["tree-node"]))), 128)),
|
|
121
|
-
|
|
39
|
+
g(s.$slots, "default", {}, void 0, !0)
|
|
122
40
|
]));
|
|
123
41
|
}
|
|
124
|
-
}),
|
|
125
|
-
const
|
|
126
|
-
for (const [
|
|
127
|
-
|
|
128
|
-
return
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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);
|
|
152
75
|
return {
|
|
153
|
-
...
|
|
154
|
-
parentId:
|
|
155
|
-
layout:
|
|
76
|
+
...p,
|
|
77
|
+
parentId: a.value,
|
|
78
|
+
layout: p.layout || void 0
|
|
156
79
|
// 只有当传入了新的 layout 时才包裹
|
|
157
80
|
};
|
|
158
81
|
});
|
|
159
|
-
return { uid:
|
|
82
|
+
return { uid: r, initialConfig: h, reactiveConfig: f };
|
|
83
|
+
}
|
|
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
|
+
});
|
|
160
177
|
}
|
|
161
|
-
|
|
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({
|
|
162
224
|
__name: "InputZone",
|
|
163
225
|
props: {
|
|
164
226
|
treeNode: {},
|
|
@@ -167,111 +229,97 @@ const je = ["id"], qe = /* @__PURE__ */ B({
|
|
|
167
229
|
preventFocusLoss: {}
|
|
168
230
|
},
|
|
169
231
|
setup(e) {
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
n
|
|
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,
|
|
176
|
-
{
|
|
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: {
|
|
177
234
|
requireDirectHit: !0
|
|
178
235
|
}
|
|
179
|
-
),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
isFromSlot: W
|
|
193
|
-
};
|
|
194
|
-
}), a = D(() => {
|
|
195
|
-
const m = C.value.nodeToRender;
|
|
196
|
-
return de(m.config?.baseType || m.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);
|
|
197
249
|
});
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
dynamicWidgetId:
|
|
204
|
-
}),
|
|
205
|
-
dynamicWidgetPointerDown: (
|
|
206
|
-
|
|
250
|
+
J(
|
|
251
|
+
s,
|
|
252
|
+
(P) => {
|
|
253
|
+
Ve(() => {
|
|
254
|
+
P && P?.uid && (t.value?.updateConfig({
|
|
255
|
+
dynamicWidgetId: P.uid
|
|
256
|
+
}), h({
|
|
257
|
+
dynamicWidgetPointerDown: (K) => {
|
|
258
|
+
P.markRectDirty?.(), P.onPointerDown?.(K);
|
|
207
259
|
},
|
|
208
|
-
dynamicWidgetPointerMove:
|
|
209
|
-
dynamicWidgetPointerUp:
|
|
210
|
-
dynamicWidgetPointerCancel:
|
|
260
|
+
dynamicWidgetPointerMove: P.onPointerMove,
|
|
261
|
+
dynamicWidgetPointerUp: P.onPointerUp,
|
|
262
|
+
dynamicWidgetPointerCancel: P.onPointerCancel
|
|
211
263
|
}));
|
|
212
264
|
});
|
|
213
265
|
},
|
|
214
266
|
{ immediate: !0 }
|
|
215
267
|
);
|
|
216
|
-
const
|
|
217
|
-
if (!
|
|
218
|
-
if (!
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
else {
|
|
224
|
-
const W = i?.value?.rect;
|
|
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`;
|
|
226
|
-
}
|
|
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);
|
|
227
275
|
return {
|
|
228
276
|
zIndex: 100,
|
|
229
|
-
"--dynamic-widget-mount-x":
|
|
230
|
-
"--dynamic-widget-mount-y":
|
|
277
|
+
"--dynamic-widget-mount-x": $.x,
|
|
278
|
+
"--dynamic-widget-mount-y": $.y,
|
|
231
279
|
visibility: "visible",
|
|
232
280
|
opacity: 1,
|
|
233
281
|
pointerEvents: "auto"
|
|
234
282
|
};
|
|
235
|
-
}),
|
|
236
|
-
return (
|
|
237
|
-
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),
|
|
238
286
|
ref_key: "elementRef",
|
|
239
|
-
ref:
|
|
240
|
-
class:
|
|
241
|
-
style: O(
|
|
287
|
+
ref: k,
|
|
288
|
+
class: w(["omnipad-input-zone omnipad-prevent", i(d)?.cssClass]),
|
|
289
|
+
style: O(c.value)
|
|
242
290
|
}, [
|
|
243
|
-
|
|
244
|
-
default:
|
|
245
|
-
|
|
291
|
+
F(ue, { nodes: f.value }, {
|
|
292
|
+
default: S(() => [
|
|
293
|
+
g(P.$slots, "default", {}, void 0, !0)
|
|
246
294
|
]),
|
|
247
295
|
_: 3
|
|
248
296
|
}, 8, ["nodes"]),
|
|
249
|
-
|
|
297
|
+
p.value.nodeToRender || i(t)?.isInterceptorRequired ? (C(), E("div", {
|
|
250
298
|
key: 0,
|
|
251
299
|
class: "omnipad-input-zone-trigger omnipad-prevent",
|
|
252
|
-
onPointerdown:
|
|
253
|
-
onPointermove:
|
|
300
|
+
onPointerdown: l,
|
|
301
|
+
onPointermove: x,
|
|
254
302
|
onPointerup: y,
|
|
255
|
-
onPointercancel:
|
|
256
|
-
onLostpointercapture:
|
|
303
|
+
onPointercancel: H,
|
|
304
|
+
onLostpointercapture: H
|
|
257
305
|
}, [
|
|
258
|
-
|
|
306
|
+
T("div", {
|
|
259
307
|
class: "dynamic-widget-mount",
|
|
260
308
|
style: O(v.value)
|
|
261
309
|
}, [
|
|
262
|
-
|
|
310
|
+
p.value.isFromSlot ? (C(), z(j(p.value.nodeToRender), {
|
|
263
311
|
key: 0,
|
|
264
|
-
ref: (
|
|
265
|
-
}, null, 512)) :
|
|
312
|
+
ref: ($) => s.value = $
|
|
313
|
+
}, null, 512)) : p.value.nodeToRender ? (C(), z(j(_.value), {
|
|
266
314
|
key: 1,
|
|
267
|
-
ref: (
|
|
268
|
-
"tree-node":
|
|
269
|
-
}, null, 8, ["tree-node"])) :
|
|
315
|
+
ref: ($) => s.value = $,
|
|
316
|
+
"tree-node": p.value.nodeToRender
|
|
317
|
+
}, null, 8, ["tree-node"])) : B("", !0)
|
|
270
318
|
], 4)
|
|
271
|
-
], 32)) :
|
|
272
|
-
], 14,
|
|
319
|
+
], 32)) : B("", !0)
|
|
320
|
+
], 14, it));
|
|
273
321
|
}
|
|
274
|
-
}),
|
|
322
|
+
}), rt = /* @__PURE__ */ U(st, [["__scopeId", "data-v-6543281e"]]), at = ["id"], ct = /* @__PURE__ */ I({
|
|
275
323
|
__name: "RootLayer",
|
|
276
324
|
props: {
|
|
277
325
|
treeNode: {},
|
|
@@ -279,138 +327,122 @@ const je = ["id"], qe = /* @__PURE__ */ B({
|
|
|
279
327
|
layout: {}
|
|
280
328
|
},
|
|
281
329
|
setup(e) {
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
), { effectiveConfig: l, effectiveLayout: P, elementRef: i } = F(
|
|
286
|
-
() => new me(f.value, c.value, n.treeNode?.type),
|
|
287
|
-
t
|
|
288
|
-
), u = D(() => P.value ? J(P.value) : {});
|
|
289
|
-
return (s, p) => (R(), S("div", {
|
|
290
|
-
id: o(f),
|
|
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),
|
|
291
333
|
ref_key: "elementRef",
|
|
292
|
-
ref:
|
|
293
|
-
class:
|
|
294
|
-
style: O(
|
|
334
|
+
ref: t,
|
|
335
|
+
class: w(["omnipad-root-layer omnipad-prevent", i(s)?.cssClass]),
|
|
336
|
+
style: O(a.value)
|
|
295
337
|
}, [
|
|
296
|
-
|
|
338
|
+
F(ue, {
|
|
297
339
|
nodes: e.treeNode?.children || []
|
|
298
340
|
}, {
|
|
299
|
-
default:
|
|
300
|
-
|
|
341
|
+
default: S(() => [
|
|
342
|
+
g(r.$slots, "default", {}, void 0, !0)
|
|
301
343
|
]),
|
|
302
344
|
_: 3
|
|
303
345
|
}, 8, ["nodes"])
|
|
304
|
-
], 14,
|
|
346
|
+
], 14, at));
|
|
305
347
|
}
|
|
306
|
-
}),
|
|
348
|
+
}), lt = /* @__PURE__ */ U(ct, [["__scopeId", "data-v-99206012"]]), ut = ["id"], dt = {
|
|
307
349
|
key: 0,
|
|
308
350
|
class: "omnipad-default-focus-border-feedback"
|
|
309
|
-
},
|
|
351
|
+
}, vt = /* @__PURE__ */ I({
|
|
310
352
|
__name: "TargetZone",
|
|
311
353
|
props: {
|
|
312
354
|
treeNode: {},
|
|
313
355
|
widgetId: {},
|
|
314
|
-
cursorEnabled: {
|
|
356
|
+
cursorEnabled: {},
|
|
315
357
|
cursorAutoDelay: {},
|
|
316
358
|
layout: {}
|
|
317
359
|
},
|
|
318
360
|
setup(e) {
|
|
319
|
-
const
|
|
361
|
+
const o = e, u = {
|
|
320
362
|
cursorAutoDelay: 2500
|
|
321
|
-
}, { uid:
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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,
|
|
328
|
-
{},
|
|
329
|
-
{
|
|
330
|
-
dispatchKeyboardEvent: le,
|
|
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,
|
|
331
367
|
dispatchPointerEventAtPos: $e,
|
|
332
|
-
reclaimFocusAtPos:
|
|
333
|
-
}
|
|
334
|
-
), _ = D(() => p.value ? J(p.value) : {}), w = Q(), k = D(() => {
|
|
335
|
-
if (!i.value) return { display: "none" };
|
|
336
|
-
let v, r;
|
|
337
|
-
const N = i?.value?.position;
|
|
338
|
-
if (w)
|
|
339
|
-
v = `${N.x}cqw`, r = `${N.y}cqh`;
|
|
340
|
-
else {
|
|
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`;
|
|
368
|
+
reclaimFocusAtPos: Ie
|
|
343
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);
|
|
344
376
|
return {
|
|
345
|
-
"--omnipad-virtual-cursor-x":
|
|
346
|
-
"--omnipad-virtual-cursor-y":
|
|
347
|
-
opacity:
|
|
377
|
+
"--omnipad-virtual-cursor-x": x.x,
|
|
378
|
+
"--omnipad-virtual-cursor-y": x.y,
|
|
379
|
+
opacity: t.value.isVisible ? 1 : 0
|
|
348
380
|
};
|
|
349
|
-
}),
|
|
350
|
-
return (v,
|
|
351
|
-
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),
|
|
352
384
|
ref_key: "elementRef",
|
|
353
|
-
ref:
|
|
354
|
-
class:
|
|
355
|
-
style: O(
|
|
356
|
-
onPointerdown:
|
|
357
|
-
onPointermove:
|
|
358
|
-
onPointerup:
|
|
359
|
-
onPointercancel:
|
|
360
|
-
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
|
|
361
393
|
}, [
|
|
362
|
-
|
|
363
|
-
state:
|
|
364
|
-
isReturning:
|
|
365
|
-
cursorPos:
|
|
394
|
+
g(v.$slots, "focus-feedback", {
|
|
395
|
+
state: i(t),
|
|
396
|
+
isReturning: i(t)?.isFocusReturning,
|
|
397
|
+
cursorPos: i(t)?.position
|
|
366
398
|
}, () => [
|
|
367
|
-
|
|
368
|
-
default:
|
|
369
|
-
|
|
399
|
+
F(Ke, { name: "omnipad-default-focus-fade" }, {
|
|
400
|
+
default: S(() => [
|
|
401
|
+
i(t)?.isFocusReturning ? (C(), E("div", dt)) : B("", !0)
|
|
370
402
|
]),
|
|
371
403
|
_: 1
|
|
372
404
|
})
|
|
373
405
|
], !0),
|
|
374
|
-
|
|
406
|
+
i(r)?.cursorEnabled ? (C(), E("div", {
|
|
375
407
|
key: 0,
|
|
376
408
|
class: "omnipad-virtual-cursor",
|
|
377
|
-
style: O(
|
|
409
|
+
style: O(f.value)
|
|
378
410
|
}, [
|
|
379
|
-
|
|
380
|
-
state:
|
|
381
|
-
isDown:
|
|
382
|
-
isReturning:
|
|
383
|
-
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
|
|
384
416
|
}, () => [
|
|
385
|
-
|
|
386
|
-
class:
|
|
417
|
+
T("div", {
|
|
418
|
+
class: w(["omnipad-default-cursor-dot", { "is-down": i(t)?.isPointerDown }])
|
|
387
419
|
}, null, 2)
|
|
388
420
|
], !0)
|
|
389
|
-
], 4)) :
|
|
390
|
-
|
|
421
|
+
], 4)) : B("", !0),
|
|
422
|
+
i(r)?.cursorEnabled ? (C(), E("div", {
|
|
391
423
|
key: 1,
|
|
392
424
|
class: "omnipad-virtual-cursor",
|
|
393
|
-
style: O(
|
|
425
|
+
style: O(f.value)
|
|
394
426
|
}, [
|
|
395
|
-
|
|
396
|
-
state:
|
|
397
|
-
isDown:
|
|
398
|
-
isReturning:
|
|
399
|
-
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
|
|
400
432
|
}, void 0, !0)
|
|
401
|
-
], 4)) :
|
|
402
|
-
|
|
403
|
-
state:
|
|
404
|
-
isDown:
|
|
405
|
-
isReturning:
|
|
406
|
-
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
|
|
407
439
|
}, void 0, !0)
|
|
408
|
-
], 46,
|
|
440
|
+
], 46, ut));
|
|
409
441
|
}
|
|
410
|
-
}),
|
|
442
|
+
}), ft = /* @__PURE__ */ U(vt, [["__scopeId", "data-v-8de7c4a4"]]), pt = { class: "omnipad-button-content-layer" }, mt = {
|
|
411
443
|
key: 0,
|
|
412
444
|
class: "omnipad-default-button-label"
|
|
413
|
-
},
|
|
445
|
+
}, yt = /* @__PURE__ */ I({
|
|
414
446
|
__name: "VirtualButtonBase",
|
|
415
447
|
props: {
|
|
416
448
|
layout: {},
|
|
@@ -418,31 +450,31 @@ const je = ["id"], qe = /* @__PURE__ */ B({
|
|
|
418
450
|
label: {}
|
|
419
451
|
},
|
|
420
452
|
setup(e) {
|
|
421
|
-
const
|
|
422
|
-
return (
|
|
453
|
+
const o = e, u = R(() => o.layout ? Z(o.layout) : {});
|
|
454
|
+
return (s, n) => (C(), E("div", {
|
|
423
455
|
class: "omnipad-button-base omnipad-prevent",
|
|
424
|
-
style: O(
|
|
456
|
+
style: O(u.value),
|
|
425
457
|
tabindex: "-1"
|
|
426
458
|
}, [
|
|
427
|
-
|
|
459
|
+
g(s.$slots, "base", {
|
|
428
460
|
isActive: e.isActive,
|
|
429
461
|
label: e.label
|
|
430
462
|
}, () => [
|
|
431
|
-
|
|
432
|
-
class:
|
|
463
|
+
T("div", {
|
|
464
|
+
class: w(["omnipad-default-button-base", { "is-active": e.isActive }])
|
|
433
465
|
}, null, 2)
|
|
434
466
|
], !0),
|
|
435
|
-
|
|
436
|
-
|
|
467
|
+
T("div", pt, [
|
|
468
|
+
g(s.$slots, "default", {
|
|
437
469
|
isActive: e.isActive,
|
|
438
470
|
label: e.label
|
|
439
471
|
}, () => [
|
|
440
|
-
e.label ? (
|
|
472
|
+
e.label ? (C(), E("span", mt, We(e.label), 1)) : B("", !0)
|
|
441
473
|
], !0)
|
|
442
474
|
])
|
|
443
475
|
], 4));
|
|
444
476
|
}
|
|
445
|
-
}),
|
|
477
|
+
}), G = /* @__PURE__ */ U(yt, [["__scopeId", "data-v-f6a6e082"]]), Pt = /* @__PURE__ */ I({
|
|
446
478
|
__name: "VirtualButton",
|
|
447
479
|
props: {
|
|
448
480
|
treeNode: {},
|
|
@@ -452,98 +484,94 @@ const je = ["id"], qe = /* @__PURE__ */ B({
|
|
|
452
484
|
mapping: {},
|
|
453
485
|
layout: {}
|
|
454
486
|
},
|
|
455
|
-
setup(e, { expose:
|
|
456
|
-
const
|
|
487
|
+
setup(e, { expose: o }) {
|
|
488
|
+
const u = e, s = {
|
|
457
489
|
label: "BTN"
|
|
458
|
-
}, { uid: t,
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
onPointerCancel: a,
|
|
469
|
-
markRectDirty: () => i.value?.markRectDirty
|
|
470
|
-
}), (d, g) => (R(), Z(ne, {
|
|
471
|
-
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),
|
|
472
500
|
ref_key: "elementRef",
|
|
473
|
-
ref:
|
|
474
|
-
class:
|
|
475
|
-
layout:
|
|
476
|
-
label:
|
|
477
|
-
"is-active":
|
|
478
|
-
onPointerdown:
|
|
479
|
-
onPointerup:
|
|
480
|
-
onPointercancel:
|
|
481
|
-
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: _
|
|
482
510
|
}, {
|
|
483
|
-
base:
|
|
484
|
-
|
|
511
|
+
base: S((v) => [
|
|
512
|
+
g(c.$slots, "base", N(A(v)))
|
|
485
513
|
]),
|
|
486
|
-
default:
|
|
487
|
-
|
|
514
|
+
default: S((v) => [
|
|
515
|
+
g(c.$slots, "default", N(A(v)))
|
|
488
516
|
]),
|
|
489
517
|
_: 3
|
|
490
518
|
}, 8, ["id", "class", "layout", "label", "is-active"]));
|
|
491
519
|
}
|
|
492
|
-
}),
|
|
520
|
+
}), gt = { class: "omnipad-axis-bg" }, bt = { class: "omnipad-axis-content-layer" }, Ct = /* @__PURE__ */ I({
|
|
493
521
|
__name: "VirtualAxisBase",
|
|
494
522
|
props: {
|
|
495
523
|
layout: {},
|
|
496
524
|
isActive: { type: Boolean },
|
|
497
525
|
vector: {},
|
|
498
526
|
showStick: { type: Boolean },
|
|
499
|
-
|
|
527
|
+
baseSize: {}
|
|
500
528
|
},
|
|
501
529
|
setup(e) {
|
|
502
|
-
const
|
|
503
|
-
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);
|
|
504
532
|
return {
|
|
505
|
-
"--omnipad-axis-stick-container-x":
|
|
506
|
-
"--omnipad-axis-stick-container-y":
|
|
507
|
-
"--omnipad-axis-stick-width":
|
|
508
|
-
"--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,
|
|
509
537
|
// 松手时加一点回弹过渡,活动时取消过渡保证绝对跟手
|
|
510
|
-
transition:
|
|
538
|
+
transition: o.isActive ? "none" : "transform 0.1s ease-out"
|
|
511
539
|
};
|
|
512
540
|
});
|
|
513
|
-
return (
|
|
514
|
-
class:
|
|
515
|
-
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),
|
|
516
544
|
tabindex: "-1"
|
|
517
545
|
}, [
|
|
518
|
-
|
|
519
|
-
|
|
546
|
+
T("div", gt, [
|
|
547
|
+
g(t.$slots, "base", {
|
|
520
548
|
isActive: e.isActive,
|
|
521
549
|
vector: e.vector
|
|
522
550
|
}, void 0, !0)
|
|
523
551
|
]),
|
|
524
|
-
e.showStick ? (
|
|
552
|
+
e.showStick ? (C(), E("div", {
|
|
525
553
|
key: 0,
|
|
526
554
|
class: "omnipad-axis-stick-container",
|
|
527
|
-
style: O(
|
|
555
|
+
style: O(n.value)
|
|
528
556
|
}, [
|
|
529
|
-
|
|
557
|
+
g(t.$slots, "stick", {
|
|
530
558
|
isActive: e.isActive,
|
|
531
559
|
vector: e.vector
|
|
532
560
|
}, () => [
|
|
533
|
-
|
|
534
|
-
class:
|
|
561
|
+
T("div", {
|
|
562
|
+
class: w(["omnipad-default-axis-stick", { "is-active": e.isActive }])
|
|
535
563
|
}, null, 2)
|
|
536
564
|
], !0)
|
|
537
|
-
], 4)) :
|
|
538
|
-
|
|
539
|
-
|
|
565
|
+
], 4)) : B("", !0),
|
|
566
|
+
T("div", bt, [
|
|
567
|
+
g(t.$slots, "default", {
|
|
540
568
|
isActive: e.isActive,
|
|
541
569
|
vector: e.vector
|
|
542
570
|
}, void 0, !0)
|
|
543
571
|
])
|
|
544
572
|
], 6));
|
|
545
573
|
}
|
|
546
|
-
}),
|
|
574
|
+
}), de = /* @__PURE__ */ U(Ct, [["__scopeId", "data-v-9eef9626"]]), ht = { class: "omnipad-dpad-cross-bg" }, _t = /* @__PURE__ */ I({
|
|
547
575
|
__name: "VirtualDPad",
|
|
548
576
|
props: {
|
|
549
577
|
treeNode: {},
|
|
@@ -554,71 +582,68 @@ const je = ["id"], qe = /* @__PURE__ */ B({
|
|
|
554
582
|
showStick: {},
|
|
555
583
|
layout: {}
|
|
556
584
|
},
|
|
557
|
-
setup(e, { expose:
|
|
558
|
-
const
|
|
585
|
+
setup(e, { expose: o }) {
|
|
586
|
+
const u = e, s = {
|
|
559
587
|
showStick: !1,
|
|
560
588
|
threshold: 0.3
|
|
561
|
-
}, { uid: t,
|
|
562
|
-
|
|
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 });
|
|
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 });
|
|
568
592
|
});
|
|
569
|
-
|
|
570
|
-
const
|
|
571
|
-
return
|
|
572
|
-
uid:
|
|
573
|
-
onPointerDown:
|
|
574
|
-
onPointerMove:
|
|
575
|
-
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,
|
|
576
600
|
onPointerCancel: v,
|
|
577
|
-
markRectDirty: () =>
|
|
578
|
-
}), (
|
|
601
|
+
markRectDirty: () => t.value?.markRectDirty()
|
|
602
|
+
}), (l, x) => (C(), z(de, {
|
|
603
|
+
id: i(n),
|
|
579
604
|
ref_key: "elementRef",
|
|
580
|
-
ref:
|
|
581
|
-
class:
|
|
582
|
-
layout:
|
|
583
|
-
"is-active":
|
|
584
|
-
vector:
|
|
585
|
-
"show-stick":
|
|
586
|
-
"base-
|
|
587
|
-
onPointerdown:
|
|
588
|
-
onPointermove:
|
|
589
|
-
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,
|
|
590
615
|
onPointercancel: v,
|
|
591
616
|
onLostpointercapture: v
|
|
592
617
|
}, {
|
|
593
|
-
base:
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
class:
|
|
618
|
+
base: S((y) => [
|
|
619
|
+
g(l.$slots, "base", N(A(y)), () => [
|
|
620
|
+
T("div", ht, [
|
|
621
|
+
T("div", {
|
|
622
|
+
class: w(["dpad-arm top", { on: y.vector && y.vector.y < -i(d)?.threshold }])
|
|
598
623
|
}, null, 2),
|
|
599
|
-
|
|
600
|
-
class:
|
|
624
|
+
T("div", {
|
|
625
|
+
class: w(["dpad-arm bottom", { on: y.vector && y.vector.y > i(d)?.threshold }])
|
|
601
626
|
}, null, 2),
|
|
602
|
-
|
|
603
|
-
class:
|
|
627
|
+
T("div", {
|
|
628
|
+
class: w(["dpad-arm left", { on: y.vector && y.vector.x < -i(d)?.threshold }])
|
|
604
629
|
}, null, 2),
|
|
605
|
-
|
|
606
|
-
class:
|
|
630
|
+
T("div", {
|
|
631
|
+
class: w(["dpad-arm right", { on: y.vector && y.vector.x > i(d)?.threshold }])
|
|
607
632
|
}, null, 2),
|
|
608
|
-
|
|
633
|
+
x[0] || (x[0] = T("div", { class: "dpad-center" }, null, -1))
|
|
609
634
|
])
|
|
610
635
|
], !0)
|
|
611
636
|
]),
|
|
612
|
-
stick:
|
|
613
|
-
|
|
637
|
+
stick: S((y) => [
|
|
638
|
+
g(l.$slots, "stick", N(A(y)), void 0, !0)
|
|
614
639
|
]),
|
|
615
|
-
default:
|
|
616
|
-
|
|
640
|
+
default: S((y) => [
|
|
641
|
+
g(l.$slots, "default", N(A(y)), void 0, !0)
|
|
617
642
|
]),
|
|
618
643
|
_: 3
|
|
619
|
-
}, 8, ["class", "layout", "is-active", "vector", "show-stick", "base-
|
|
644
|
+
}, 8, ["id", "class", "layout", "is-active", "vector", "show-stick", "base-size"]));
|
|
620
645
|
}
|
|
621
|
-
}),
|
|
646
|
+
}), kt = /* @__PURE__ */ U(_t, [["__scopeId", "data-v-2690a0c6"]]), Rt = /* @__PURE__ */ I({
|
|
622
647
|
__name: "VirtualTrackpad",
|
|
623
648
|
props: {
|
|
624
649
|
treeNode: {},
|
|
@@ -629,46 +654,44 @@ const je = ["id"], qe = /* @__PURE__ */ B({
|
|
|
629
654
|
mapping: {},
|
|
630
655
|
layout: {}
|
|
631
656
|
},
|
|
632
|
-
setup(e, { expose:
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}), (a, d) => (R(), Z(ne, {
|
|
649
|
-
id: o(c),
|
|
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),
|
|
650
673
|
ref_key: "elementRef",
|
|
651
|
-
ref:
|
|
652
|
-
class:
|
|
653
|
-
layout:
|
|
654
|
-
label:
|
|
655
|
-
"is-active":
|
|
656
|
-
onPointerdown:
|
|
657
|
-
onPointermove:
|
|
658
|
-
onPointerup:
|
|
659
|
-
onPointercancel:
|
|
660
|
-
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: _
|
|
661
684
|
}, {
|
|
662
|
-
base:
|
|
663
|
-
|
|
685
|
+
base: S((v) => [
|
|
686
|
+
g(c.$slots, "base", N(A(v)), void 0, !0)
|
|
664
687
|
]),
|
|
665
|
-
default:
|
|
666
|
-
|
|
688
|
+
default: S((v) => [
|
|
689
|
+
g(c.$slots, "default", N(A(v)), void 0, !0)
|
|
667
690
|
]),
|
|
668
691
|
_: 3
|
|
669
692
|
}, 8, ["id", "class", "layout", "label", "is-active"]));
|
|
670
693
|
}
|
|
671
|
-
}),
|
|
694
|
+
}), Dt = /* @__PURE__ */ U(Rt, [["__scopeId", "data-v-55cc7ea4"]]), wt = /* @__PURE__ */ I({
|
|
672
695
|
__name: "VirtualJoystick",
|
|
673
696
|
props: {
|
|
674
697
|
treeNode: {},
|
|
@@ -681,89 +704,88 @@ const je = ["id"], qe = /* @__PURE__ */ B({
|
|
|
681
704
|
mapping: {},
|
|
682
705
|
layout: {}
|
|
683
706
|
},
|
|
684
|
-
setup(e, { expose:
|
|
685
|
-
const
|
|
707
|
+
setup(e, { expose: o }) {
|
|
708
|
+
const u = e, s = {
|
|
686
709
|
label: "PUSH",
|
|
687
710
|
threshold: 0.2,
|
|
688
711
|
cursorMode: !1,
|
|
689
712
|
cursorSensitivity: 1
|
|
690
|
-
}, { uid: t,
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
const r = i.value?.rect;
|
|
696
|
-
r && (k.value = { x: r.width / 2, y: r.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 });
|
|
697
718
|
});
|
|
698
|
-
|
|
699
|
-
const
|
|
700
|
-
return
|
|
701
|
-
uid:
|
|
702
|
-
onPointerDown:
|
|
703
|
-
onPointerMove:
|
|
704
|
-
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,
|
|
705
726
|
onPointerCancel: v,
|
|
706
|
-
markRectDirty: () =>
|
|
707
|
-
}), (
|
|
727
|
+
markRectDirty: () => t.value?.markRectDirty
|
|
728
|
+
}), (l, x) => (C(), z(de, {
|
|
729
|
+
id: i(n),
|
|
708
730
|
ref_key: "elementRef",
|
|
709
|
-
ref:
|
|
710
|
-
class:
|
|
711
|
-
layout:
|
|
712
|
-
"is-active":
|
|
713
|
-
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,
|
|
714
736
|
"show-stick": "",
|
|
715
|
-
"base-
|
|
716
|
-
onPointerdown:
|
|
717
|
-
onPointermove:
|
|
718
|
-
onPointerup:
|
|
737
|
+
"base-size": f.value,
|
|
738
|
+
onPointerdown: _,
|
|
739
|
+
onPointermove: c,
|
|
740
|
+
onPointerup: D,
|
|
719
741
|
onPointercancel: v,
|
|
720
742
|
onLostpointercapture: v
|
|
721
743
|
}, {
|
|
722
|
-
base:
|
|
723
|
-
|
|
744
|
+
base: S((y) => [
|
|
745
|
+
g(l.$slots, "base", N(A(y)), void 0, !0)
|
|
724
746
|
]),
|
|
725
|
-
stick:
|
|
726
|
-
|
|
747
|
+
stick: S(() => [
|
|
748
|
+
F(G, {
|
|
727
749
|
layout: { height: "100%", width: "100%" },
|
|
728
|
-
"is-active":
|
|
729
|
-
label:
|
|
750
|
+
"is-active": i(a)?.isPressed,
|
|
751
|
+
label: i(d)?.label
|
|
730
752
|
}, {
|
|
731
|
-
base:
|
|
732
|
-
|
|
753
|
+
base: S((y) => [
|
|
754
|
+
g(l.$slots, "stick-base", N(A(y)), void 0, !0)
|
|
733
755
|
]),
|
|
734
|
-
default:
|
|
735
|
-
|
|
756
|
+
default: S((y) => [
|
|
757
|
+
g(l.$slots, "stick", N(A(y)), void 0, !0)
|
|
736
758
|
]),
|
|
737
759
|
_: 3
|
|
738
760
|
}, 8, ["is-active", "label"])
|
|
739
761
|
]),
|
|
740
|
-
default:
|
|
741
|
-
|
|
762
|
+
default: S((y) => [
|
|
763
|
+
g(l.$slots, "default", N(A(y)), void 0, !0)
|
|
742
764
|
]),
|
|
743
765
|
_: 3
|
|
744
|
-
}, 8, ["class", "layout", "is-active", "vector", "base-
|
|
766
|
+
}, 8, ["id", "class", "layout", "is-active", "vector", "base-size"]));
|
|
745
767
|
}
|
|
746
|
-
}),
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
(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);
|
|
756
778
|
});
|
|
757
779
|
export {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
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
|
|
769
791
|
};
|