@weasel-js/core 1.7.1 → 1.7.3
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/CHANGELOG.md +47 -0
- package/README.md +7 -0
- package/dist/{autoPoseDescriptor-BT_vp9FO.d.ts → autoPoseDescriptor-vCdt55xm.d.ts} +1 -1
- package/dist/{builtins-BSUfH8nU.d.ts → builtins-C-gRyVRx.d.ts} +7 -3
- package/dist/canvas/CursorCoordsHud.js +56 -29
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/hud.module.js +3 -3
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/clipboard.d.ts +1 -1
- package/dist/clone.d.ts +2 -2
- package/dist/core/geometry/poseDescriptor.js +10 -15
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/{cornerHandles-CDcZOV8h.d.ts → cornerHandles-BCrDp_mH.d.ts} +1 -1
- package/dist/features/paths/poseDescriptor.js +6 -11
- package/dist/features/paths/poseDescriptor.js.map +1 -1
- package/dist/index.d.ts +22 -17
- package/dist/interactions/actions/defaults/clone.js +64 -53
- package/dist/interactions/actions/defaults/clone.js.map +1 -1
- package/dist/interactions/actions/defaults/move.js +426 -322
- package/dist/interactions/actions/defaults/move.js.map +1 -1
- package/dist/interactions/actions/defaults/resize.js +75 -72
- package/dist/interactions/actions/defaults/resize.js.map +1 -1
- package/dist/interactions/actions/defaults/rotate.js +88 -85
- package/dist/interactions/actions/defaults/rotate.js.map +1 -1
- package/dist/interactions/actions/planeInput.js +82 -69
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +1 -1
- package/dist/{math-CUMxmZzn.d.ts → math-Drrw4ewZ.d.ts} +2 -2
- package/dist/math.d.ts +3 -3
- package/dist/move.d.ts +4 -4
- package/dist/{originProjection-BSn4xiEy.d.ts → originProjection-DEklpDc_.d.ts} +1 -1
- package/dist/{poseDescriptor-CjSXMf8X.d.ts → poseDescriptor-D-OH-tu5.d.ts} +0 -4
- package/dist/renderer.d.ts +4 -4
- package/dist/resize.d.ts +5 -5
- package/dist/style.css +2 -0
- package/dist/{types-CA54-mAZ.d.ts → types-A37hYkeR.d.ts} +4 -2
- package/dist/{types-DSjd6W3n.d.ts → types-B_9g6hMM.d.ts} +1 -1
- package/dist/version.js +1 -1
- package/package.json +16 -14
- package/dist/index.css +0 -2
|
@@ -1,195 +1,212 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
1
|
+
import { planeToPlane as e, toPlane as t } from "../../../core/viewport/parallax.js";
|
|
2
|
+
import { dropPreviewOverrides as n, syncPreviewOverrides as r } from "../previewOverrides.js";
|
|
3
|
+
import { IDENTITY_POSE_COMPOSITION as i, composeWorldPose as a, frameAtOrAbove as o, rebaseLocalPose as s } from "../../../core/scene/composeFrame.js";
|
|
4
|
+
import { definesFrame as c, documentPose as l, effectivePose as u } from "../../../core/scene/effectivePose.js";
|
|
5
|
+
import { gesturePlaneReader as d, gestureViewReader as f } from "../../gestures/shared/screenTolerance.js";
|
|
6
|
+
import { commitGestureOps as p, readGestureLifecycle as m, reduceBehaviorEnd as h, runBehaviorCancel as g } from "../gestureLifecycle.js";
|
|
7
|
+
import { asNodeId as _ } from "../../../core/scene/types.js";
|
|
8
|
+
import { SceneArrivalRefused as v } from "../../../core/scene/arrivals.js";
|
|
9
|
+
import { createTransformOp as y } from "../../../core/ops/transform.js";
|
|
10
|
+
import { createReparentOp as b } from "../../../core/ops/reparent.js";
|
|
11
|
+
import { geometryDataOp as x } from "../geometryProjection.js";
|
|
12
|
+
import { poseDescriptorForNode as S, translatePoseViaDescriptor as C } from "../../../core/geometry/poseDescriptor.js";
|
|
13
|
+
import { poseDescriptorOf as w } from "../poseDescriptorDep.js";
|
|
14
|
+
import { moveGestureAdapter as T } from "../move/gestureAdapter.js";
|
|
15
|
+
import { carryPose as E, inPlane as D, invertPlane as ee, planeOf as O, selectionLayer as k } from "../planeInput.js";
|
|
16
|
+
import { pointInPath as A } from "@weasel-js/geom";
|
|
17
|
+
import { DRAG_THRESHOLD_PX as te, isAnchorOrControl as j, pastDragThreshold as M, resolveParams as N } from "@weasel-js/routing";
|
|
17
18
|
//#region src/interactions/actions/defaults/move.ts
|
|
18
|
-
function
|
|
19
|
-
let
|
|
20
|
-
if (!
|
|
21
|
-
let i = e.scene, o = e.pc,
|
|
22
|
-
|
|
23
|
-
},
|
|
19
|
+
function P(e, n) {
|
|
20
|
+
let r = e.layout;
|
|
21
|
+
if (!r || !n.drag) return;
|
|
22
|
+
let i = e.scene, o = e.pc, c = V(i), { dx: l, dy: u } = e.currentDelta, d = (t, n) => {
|
|
23
|
+
r.reflow ? e.reflowTargets.set(t, n) : e.previews.set(t, n);
|
|
24
|
+
}, f = e.projection, p = H(e, c), m = [];
|
|
24
25
|
for (let t of e.ids) {
|
|
25
|
-
let
|
|
26
|
-
if (!
|
|
27
|
-
let
|
|
28
|
-
|
|
26
|
+
let n = i.get(t);
|
|
27
|
+
if (!n) continue;
|
|
28
|
+
let r = a(p, t, o.compose), s = S(f, n), c = z(e, t, l, u), d = ee(O(e.view, n.layer)), h = E(s, C(r, c.dx, c.dy, s), d), g = s.getBounds(h);
|
|
29
|
+
m.push({
|
|
29
30
|
id: t,
|
|
30
31
|
arg: {
|
|
31
32
|
id: t,
|
|
32
|
-
originPose:
|
|
33
|
-
pose:
|
|
34
|
-
sourceContainerId:
|
|
33
|
+
originPose: E(s, r, d),
|
|
34
|
+
pose: h,
|
|
35
|
+
sourceContainerId: n.parent ?? null
|
|
35
36
|
},
|
|
36
37
|
center: {
|
|
37
|
-
x:
|
|
38
|
-
y:
|
|
38
|
+
x: g.x + g.width / 2,
|
|
39
|
+
y: g.y + g.height / 2
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
let h = (e, n) => {
|
|
44
|
+
if (n === null) return e;
|
|
45
|
+
let r = S(f, i.get(e.id));
|
|
46
|
+
return {
|
|
47
|
+
id: e.id,
|
|
48
|
+
arg: {
|
|
49
|
+
...e.arg,
|
|
50
|
+
originPose: E(r, e.arg.originPose, n),
|
|
51
|
+
pose: E(r, e.arg.pose, n)
|
|
52
|
+
},
|
|
53
|
+
center: t(n, e.center)
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
if (m.length === 0) return;
|
|
57
|
+
let g = new Set(m.map((e) => e.id)), v = Infinity, y = Infinity, b = -Infinity, x = -Infinity;
|
|
58
|
+
for (let e of m) {
|
|
59
|
+
let t = f.getBounds(e.arg.pose);
|
|
60
|
+
v = Math.min(v, t.x), y = Math.min(y, t.y), b = Math.max(b, t.x + t.width), x = Math.max(x, t.y + t.height);
|
|
47
61
|
}
|
|
48
|
-
let
|
|
49
|
-
x: (
|
|
50
|
-
y: (
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
let w = {
|
|
63
|
+
x: (v + b) / 2,
|
|
64
|
+
y: (y + x) / 2
|
|
65
|
+
};
|
|
66
|
+
e.dropCenter = w;
|
|
67
|
+
let T = {
|
|
68
|
+
x: n.drag.current.x - w.x,
|
|
69
|
+
y: n.drag.current.y - w.y
|
|
70
|
+
}, D = [], k = r.dropTarget ?? "innermost", A = (e, t, n, r, i) => {
|
|
71
|
+
let a = r.dropRegion?.({
|
|
56
72
|
id: e,
|
|
57
73
|
bounds: n
|
|
58
74
|
}) ?? null;
|
|
59
|
-
return
|
|
60
|
-
},
|
|
61
|
-
if (
|
|
62
|
-
let
|
|
63
|
-
if (!
|
|
64
|
-
let
|
|
65
|
-
if (!
|
|
66
|
-
let
|
|
67
|
-
if (
|
|
68
|
-
if (
|
|
69
|
-
let
|
|
70
|
-
id:
|
|
71
|
-
bounds:
|
|
75
|
+
return a ? F(a, n, i) : k === "region" ? !1 : r.contains ? r.contains(t, i) : i.x >= n.x && i.x < n.x + n.width && i.y >= n.y && i.y < n.y + n.height;
|
|
76
|
+
}, te = (n, s) => {
|
|
77
|
+
if (g.has(n)) return;
|
|
78
|
+
let l = r.getLayout(n);
|
|
79
|
+
if (!l) return;
|
|
80
|
+
let u = i.get(n);
|
|
81
|
+
if (!u) return;
|
|
82
|
+
let d = a(c, n, o.compose), p = S(f, u).getBounds(d), _ = O(e.view, u.layer), v = _ ? t(_, w) : w;
|
|
83
|
+
if (A(n, d, p, l, v)) {
|
|
84
|
+
if (l.acceptsDrop) {
|
|
85
|
+
let e = {
|
|
86
|
+
id: n,
|
|
87
|
+
bounds: p
|
|
72
88
|
};
|
|
73
|
-
for (let
|
|
89
|
+
for (let t of m) if (!l.acceptsDrop(e, h(t, _).arg)) return;
|
|
74
90
|
}
|
|
75
|
-
|
|
76
|
-
id:
|
|
77
|
-
bounds:
|
|
78
|
-
layout:
|
|
79
|
-
zPath:
|
|
80
|
-
depth:
|
|
91
|
+
D.push({
|
|
92
|
+
id: n,
|
|
93
|
+
bounds: p,
|
|
94
|
+
layout: l,
|
|
95
|
+
zPath: s,
|
|
96
|
+
depth: s.length,
|
|
97
|
+
plane: _
|
|
81
98
|
});
|
|
82
99
|
}
|
|
83
|
-
},
|
|
100
|
+
}, j = (e, t) => {
|
|
84
101
|
let n = e === null ? i.roots : i.childrenOf(e);
|
|
85
102
|
for (let e = 0; e < n.length; e++) {
|
|
86
103
|
let r = [...t, e];
|
|
87
|
-
|
|
104
|
+
te(n[e], r), j(n[e], r);
|
|
88
105
|
}
|
|
89
106
|
};
|
|
90
|
-
|
|
91
|
-
let
|
|
92
|
-
if (
|
|
93
|
-
let e = new Map(
|
|
94
|
-
for (let t of i.renderOrder())
|
|
95
|
-
} else for (let e of
|
|
96
|
-
if (
|
|
97
|
-
|
|
107
|
+
j(null, []);
|
|
108
|
+
let M = null;
|
|
109
|
+
if (k === "topmost") {
|
|
110
|
+
let e = new Map(D.map((e) => [e.id, e]));
|
|
111
|
+
for (let t of i.renderOrder()) M = e.get(t) ?? M;
|
|
112
|
+
} else for (let e of D) {
|
|
113
|
+
if (M === null) {
|
|
114
|
+
M = e;
|
|
98
115
|
continue;
|
|
99
116
|
}
|
|
100
|
-
if (e.depth >
|
|
101
|
-
|
|
117
|
+
if (e.depth > M.depth) {
|
|
118
|
+
M = e;
|
|
102
119
|
continue;
|
|
103
120
|
}
|
|
104
|
-
if (e.depth <
|
|
121
|
+
if (e.depth < M.depth) continue;
|
|
105
122
|
let t = !1;
|
|
106
123
|
for (let n = 0; n < e.zPath.length; n++) {
|
|
107
|
-
if (e.zPath[n] >
|
|
124
|
+
if (e.zPath[n] > M.zPath[n]) {
|
|
108
125
|
t = !0;
|
|
109
126
|
break;
|
|
110
127
|
}
|
|
111
|
-
if (e.zPath[n] <
|
|
128
|
+
if (e.zPath[n] < M.zPath[n]) {
|
|
112
129
|
t = !1;
|
|
113
130
|
break;
|
|
114
131
|
}
|
|
115
132
|
}
|
|
116
|
-
t && (
|
|
133
|
+
t && (M = e);
|
|
117
134
|
}
|
|
118
|
-
if (!
|
|
119
|
-
let
|
|
120
|
-
id:
|
|
121
|
-
bounds:
|
|
122
|
-
},
|
|
135
|
+
if (!M) return;
|
|
136
|
+
let N = M.layout, P = {
|
|
137
|
+
id: M.id,
|
|
138
|
+
bounds: M.bounds
|
|
139
|
+
}, I = i.childrenOf(M.id).map((e) => ({
|
|
123
140
|
id: e,
|
|
124
|
-
pose:
|
|
125
|
-
})),
|
|
126
|
-
let n =
|
|
127
|
-
n >= 0 ?
|
|
141
|
+
pose: a(c, e, o.compose)
|
|
142
|
+
})), L = (e, t) => {
|
|
143
|
+
let n = I.findIndex((t) => t.id === e);
|
|
144
|
+
n >= 0 ? I[n] = {
|
|
128
145
|
id: e,
|
|
129
146
|
pose: t
|
|
130
|
-
} :
|
|
147
|
+
} : I.push({
|
|
131
148
|
id: e,
|
|
132
149
|
pose: t
|
|
133
150
|
});
|
|
134
|
-
},
|
|
135
|
-
for (let e of
|
|
136
|
-
let
|
|
137
|
-
x: e.center.x +
|
|
138
|
-
y: e.center.y +
|
|
151
|
+
}, R = [], B = /* @__PURE__ */ new Map(), U = M.plane;
|
|
152
|
+
for (let e of m) {
|
|
153
|
+
let n = h(e, U), r = I.map((e) => ({ ...e })), i = N.getDropTargets(P, r, n.arg), a = {
|
|
154
|
+
x: e.center.x + T.x,
|
|
155
|
+
y: e.center.y + T.y
|
|
156
|
+
}, o = N.snap.pickTarget(i, U ? t(U, a) : a);
|
|
157
|
+
if (!o) return;
|
|
158
|
+
R.push({
|
|
159
|
+
dragged: n.arg,
|
|
160
|
+
children: r,
|
|
161
|
+
target: o
|
|
139
162
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
children: t,
|
|
144
|
-
target: r
|
|
145
|
-
});
|
|
146
|
-
let i = k.reflowPoses(A, t, e.arg, r);
|
|
147
|
-
for (let [e, t] of i) P(e, t), m.has(h(e)) || L.set(h(e), t);
|
|
148
|
-
P(e.arg.id, i.get(e.arg.id) ?? r.pose);
|
|
163
|
+
let s = N.reflowPoses(P, r, n.arg, o);
|
|
164
|
+
for (let [e, t] of s) L(e, t), g.has(_(e)) || B.set(_(e), t);
|
|
165
|
+
L(n.arg.id, s.get(n.arg.id) ?? o.pose);
|
|
149
166
|
}
|
|
150
|
-
let
|
|
151
|
-
for (let [e, t] of
|
|
167
|
+
let W = /* @__PURE__ */ new Set();
|
|
168
|
+
for (let [e, t] of B) {
|
|
152
169
|
let n = i.get(e)?.parent ?? null;
|
|
153
|
-
|
|
170
|
+
d(e, s(c, t, n, o.compose, o.decompose)), W.add(e);
|
|
154
171
|
}
|
|
155
|
-
let
|
|
156
|
-
for (let [e, t] of
|
|
172
|
+
let G = /* @__PURE__ */ new Map();
|
|
173
|
+
for (let [e, t] of ne(m.map((e) => ({
|
|
157
174
|
id: e.id,
|
|
158
175
|
sourceContainerId: e.arg.sourceContainerId
|
|
159
|
-
})),
|
|
160
|
-
let
|
|
161
|
-
if (!
|
|
162
|
-
let
|
|
176
|
+
})), P.id)) {
|
|
177
|
+
let n = r.getLayout(e), l = i.get(_(e));
|
|
178
|
+
if (!n || !l) continue;
|
|
179
|
+
let u = {
|
|
163
180
|
id: e,
|
|
164
|
-
bounds:
|
|
165
|
-
}, p = i.childrenOf(
|
|
181
|
+
bounds: f.getBounds(a(c, e, o.compose))
|
|
182
|
+
}, p = i.childrenOf(_(e)).filter((e) => !t.has(e)).map((e) => ({
|
|
166
183
|
id: e,
|
|
167
|
-
pose:
|
|
184
|
+
pose: a(c, e, o.compose)
|
|
168
185
|
}));
|
|
169
|
-
for (let [e, t] of
|
|
170
|
-
let n =
|
|
171
|
-
if (n.x ===
|
|
172
|
-
|
|
173
|
-
let l = i.get(
|
|
174
|
-
|
|
186
|
+
for (let [e, t] of n.childPoses(u, p)) {
|
|
187
|
+
let n = f.getBounds(a(c, e, o.compose)), r = f.getBounds(t);
|
|
188
|
+
if (n.x === r.x && n.y === r.y && n.width === r.width && n.height === r.height) continue;
|
|
189
|
+
G.set(e, t);
|
|
190
|
+
let l = i.get(_(e))?.parent ?? null;
|
|
191
|
+
d(_(e), s(c, t, l, o.compose, o.decompose)), W.add(_(e));
|
|
175
192
|
}
|
|
176
193
|
}
|
|
177
194
|
e.layoutPass = {
|
|
178
|
-
layout:
|
|
179
|
-
container:
|
|
180
|
-
placements:
|
|
181
|
-
sourceReflow:
|
|
182
|
-
reflowIds:
|
|
195
|
+
layout: N,
|
|
196
|
+
container: P,
|
|
197
|
+
placements: R,
|
|
198
|
+
sourceReflow: G,
|
|
199
|
+
reflowIds: W
|
|
183
200
|
};
|
|
184
201
|
}
|
|
185
|
-
function
|
|
202
|
+
function F(e, t, n) {
|
|
186
203
|
let r = {
|
|
187
204
|
x: n.x - t.x,
|
|
188
205
|
y: n.y - t.y
|
|
189
206
|
};
|
|
190
|
-
return typeof e == "function" ? e(r) :
|
|
207
|
+
return typeof e == "function" ? e(r) : A(e, r.x, r.y);
|
|
191
208
|
}
|
|
192
|
-
function
|
|
209
|
+
function ne(e, t) {
|
|
193
210
|
let n = /* @__PURE__ */ new Map();
|
|
194
211
|
for (let r of e) {
|
|
195
212
|
let e = r.sourceContainerId;
|
|
@@ -199,13 +216,40 @@ function M(e, t) {
|
|
|
199
216
|
}
|
|
200
217
|
return n;
|
|
201
218
|
}
|
|
202
|
-
function
|
|
219
|
+
function I(e, n) {
|
|
220
|
+
let r = /* @__PURE__ */ new Map(), i = e.layout, o = e.dropCenter;
|
|
221
|
+
if (!i || !o) return r;
|
|
222
|
+
let { scene: s, pc: c, projection: l } = e, u = V(s), d = /* @__PURE__ */ new Set([...e.ids, ...e.cascadeIds]), f = (n, r) => {
|
|
223
|
+
let i = s.get(n), d = O(e.view, i.layer), f = d ? t(d, o) : o, p = a(u, n, c.compose);
|
|
224
|
+
if (r?.contains) return r.contains(p, f);
|
|
225
|
+
let m = S(l, i).getBounds(p);
|
|
226
|
+
return f.x >= m.x && f.x < m.x + m.width && f.y >= m.y && f.y < m.y + m.height;
|
|
227
|
+
}, p = /* @__PURE__ */ new Map(), m = (e) => {
|
|
228
|
+
if (p.has(e)) return p.get(e);
|
|
229
|
+
let t = null, n = -1, r = (a, o) => {
|
|
230
|
+
for (let c of a === null ? s.roots : s.childrenOf(a)) {
|
|
231
|
+
if (d.has(c)) continue;
|
|
232
|
+
let a = s.get(c);
|
|
233
|
+
a && a.kind === "container" && (a.layer === e && o >= n && i.getLayout(c) === null && f(c, null) && (t = c, n = o), r(c, o + 1));
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
return r(null, 0), p.set(e, t), t;
|
|
237
|
+
};
|
|
238
|
+
for (let e of n) {
|
|
239
|
+
let t = s.get(e), n = t?.parent ?? null;
|
|
240
|
+
if (!t || n === null) continue;
|
|
241
|
+
let a = i.getLayout(n);
|
|
242
|
+
a && !f(n, a) && r.set(e, m(t.layer));
|
|
243
|
+
}
|
|
244
|
+
return r;
|
|
245
|
+
}
|
|
246
|
+
function L(e, t, n, r) {
|
|
203
247
|
let i = [];
|
|
204
248
|
for (let a of t) {
|
|
205
249
|
if (!e.startPoses.has(a) || e.carried.has(a)) continue;
|
|
206
250
|
let t = e.scene.get(a);
|
|
207
251
|
if (!t) continue;
|
|
208
|
-
let o =
|
|
252
|
+
let o = R(e, a, n, r), s = e.caught.get(a);
|
|
209
253
|
s && (o.dx += s.dx, o.dy += s.dy);
|
|
210
254
|
let c = [
|
|
211
255
|
1,
|
|
@@ -215,13 +259,13 @@ function N(e, t, n, r) {
|
|
|
215
259
|
o.dx,
|
|
216
260
|
o.dy
|
|
217
261
|
], l = t.pose;
|
|
218
|
-
if (i.push(
|
|
262
|
+
if (i.push(y({
|
|
219
263
|
id: a,
|
|
220
264
|
from: l,
|
|
221
|
-
to:
|
|
265
|
+
to: C(l, o.dx, o.dy, e.projection),
|
|
222
266
|
label: e.lifecycle.label
|
|
223
267
|
})), e.geometryProjection) {
|
|
224
|
-
let n =
|
|
268
|
+
let n = x(e.geometryProjection, {
|
|
225
269
|
id: a,
|
|
226
270
|
data: t.data,
|
|
227
271
|
pose: l
|
|
@@ -231,19 +275,34 @@ function N(e, t, n, r) {
|
|
|
231
275
|
}
|
|
232
276
|
return i;
|
|
233
277
|
}
|
|
234
|
-
function
|
|
235
|
-
let i = e.frames.get(t);
|
|
236
|
-
if (
|
|
237
|
-
dx:
|
|
238
|
-
dy:
|
|
278
|
+
function R(e, t, n, r) {
|
|
279
|
+
let { dx: i, dy: a } = z(e, t, n, r), o = e.frames.get(t);
|
|
280
|
+
if (o === void 0) return {
|
|
281
|
+
dx: i,
|
|
282
|
+
dy: a
|
|
283
|
+
};
|
|
284
|
+
let { pc: s, projection: c } = e, l = c.getBounds(s.decompose(o.frameWorld, o.world)), u = c.getBounds(s.decompose(o.frameWorld, C(o.world, i, a, c)));
|
|
285
|
+
return {
|
|
286
|
+
dx: u.x - l.x,
|
|
287
|
+
dy: u.y - l.y
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function z(e, n, r, i) {
|
|
291
|
+
let a = e.scene.get(n)?.layer, o = a === void 0 ? void 0 : e.planeRefs.get(a);
|
|
292
|
+
if (!o) return {
|
|
293
|
+
dx: r,
|
|
294
|
+
dy: i
|
|
239
295
|
};
|
|
240
|
-
let
|
|
296
|
+
let s = O(e.view, a), c = {
|
|
297
|
+
x: o.edited.x + r,
|
|
298
|
+
y: o.edited.y + i
|
|
299
|
+
}, l = s ? t(s, c) : c;
|
|
241
300
|
return {
|
|
242
|
-
dx:
|
|
243
|
-
dy:
|
|
301
|
+
dx: l.x - o.own.x,
|
|
302
|
+
dy: l.y - o.own.y
|
|
244
303
|
};
|
|
245
304
|
}
|
|
246
|
-
function
|
|
305
|
+
function B(e, t) {
|
|
247
306
|
let n = new Set(e.ids), r = e.ids.filter((e) => !t.has(e));
|
|
248
307
|
for (let i of e.cascadeIds) {
|
|
249
308
|
let a = e.scene.get(i)?.parent ?? null, o = !1;
|
|
@@ -259,28 +318,28 @@ function F(e, t) {
|
|
|
259
318
|
}
|
|
260
319
|
return r;
|
|
261
320
|
}
|
|
262
|
-
function
|
|
321
|
+
function V(e) {
|
|
263
322
|
return {
|
|
264
|
-
getPose: (t) =>
|
|
323
|
+
getPose: (t) => l(e, e.get(t)),
|
|
265
324
|
getParent: (t) => e.get(t)?.parent ?? null,
|
|
266
325
|
definesFrame: (t) => {
|
|
267
326
|
let n = e.get(t);
|
|
268
|
-
return n === void 0 ||
|
|
327
|
+
return n === void 0 || c(n);
|
|
269
328
|
}
|
|
270
329
|
};
|
|
271
330
|
}
|
|
272
|
-
function
|
|
331
|
+
function H(e, t) {
|
|
273
332
|
return e.caught.size === 0 ? t : {
|
|
274
333
|
...t,
|
|
275
334
|
getPose: (n) => e.caught.has(n) ? e.startPoses.get(n) : t.getPose(n)
|
|
276
335
|
};
|
|
277
336
|
}
|
|
278
|
-
function
|
|
279
|
-
let t = /* @__PURE__ */ new Map(), { scene: n, pc:
|
|
337
|
+
function U(e) {
|
|
338
|
+
let t = /* @__PURE__ */ new Map(), { scene: n, pc: r } = e, i = V(n);
|
|
280
339
|
for (let s of e.startPoses.keys()) {
|
|
281
340
|
let c = e.previews.get(s);
|
|
282
341
|
if (c === void 0) continue;
|
|
283
|
-
let l = n.get(s)?.parent ?? null, u = i
|
|
342
|
+
let l = n.get(s)?.parent ?? null, u = o(i, l), d = u === null ? c : r.compose(a(i, u, r.compose), c);
|
|
284
343
|
t.set(s, {
|
|
285
344
|
local: c,
|
|
286
345
|
parent: l,
|
|
@@ -289,19 +348,19 @@ function L(e) {
|
|
|
289
348
|
}
|
|
290
349
|
return t;
|
|
291
350
|
}
|
|
292
|
-
function
|
|
293
|
-
let { scene: r, pc: i } = e,
|
|
294
|
-
for (let
|
|
295
|
-
let c = n.get(
|
|
351
|
+
function W(e, t, n) {
|
|
352
|
+
let { scene: r, pc: i } = e, a = V(r);
|
|
353
|
+
for (let o of e.startPoses.keys()) {
|
|
354
|
+
let c = n.get(o);
|
|
296
355
|
if (!c) {
|
|
297
|
-
e.caught.has(
|
|
356
|
+
e.caught.has(o) && t.settle(o);
|
|
298
357
|
continue;
|
|
299
358
|
}
|
|
300
|
-
let l = r.get(
|
|
301
|
-
t.settle(
|
|
359
|
+
let l = r.get(o)?.parent ?? null, u = l === c.parent ? c.local : s(a, c.world, l, i.compose, i.decompose);
|
|
360
|
+
t.settle(o, { from: u });
|
|
302
361
|
}
|
|
303
362
|
}
|
|
304
|
-
function
|
|
363
|
+
function G(e, t) {
|
|
305
364
|
let n = e.deps.nodeAtPoint;
|
|
306
365
|
if (!n) return null;
|
|
307
366
|
let r = /* @__PURE__ */ new Set([...t.ids, ...t.cascadeIds]), i = n(e.world, r);
|
|
@@ -317,21 +376,21 @@ function z(e, t) {
|
|
|
317
376
|
hitSibling: i
|
|
318
377
|
} : null;
|
|
319
378
|
}
|
|
320
|
-
function
|
|
321
|
-
let
|
|
322
|
-
for (let
|
|
323
|
-
if (!
|
|
324
|
-
let
|
|
325
|
-
|
|
326
|
-
let
|
|
327
|
-
if (
|
|
328
|
-
let e = (
|
|
329
|
-
e >= 0 && (
|
|
379
|
+
function re(t, n, r, i, o, c) {
|
|
380
|
+
let l = t.scene, u = V(l);
|
|
381
|
+
for (let d of t.ids) {
|
|
382
|
+
if (!t.startPoses.has(d)) continue;
|
|
383
|
+
let f = a(u, d, c.compose), p = z(t, d, i, o), m = l.get(d).layer, h = E(t.projection, C(f, p.dx, p.dy, t.projection), m === n.newLayer ? null : e(O(t.view, m), O(t.view, n.newLayer))), g = s(u, h, n.newParent, c.compose, c.decompose), _ = l.get(d);
|
|
384
|
+
_.layer !== n.newLayer && (_.parent !== null && l.move(d, null), l.setLayer(d, n.newLayer));
|
|
385
|
+
let v;
|
|
386
|
+
if (r === "above" && n.hitSibling) {
|
|
387
|
+
let e = (n.newParent === null ? l.roots : l.childrenOf(n.newParent)).filter((e) => e !== d).indexOf(n.hitSibling);
|
|
388
|
+
e >= 0 && (v = e + 1);
|
|
330
389
|
}
|
|
331
|
-
|
|
390
|
+
l.move(d, n.newParent, v), l.setPose(d, g);
|
|
332
391
|
}
|
|
333
392
|
}
|
|
334
|
-
var
|
|
393
|
+
var K = D({
|
|
335
394
|
id: "move",
|
|
336
395
|
label: "Move",
|
|
337
396
|
activeCursor: "move",
|
|
@@ -353,126 +412,149 @@ var B = w({
|
|
|
353
412
|
],
|
|
354
413
|
invoker: {
|
|
355
414
|
timing: "ongoing",
|
|
356
|
-
start(
|
|
357
|
-
let
|
|
358
|
-
if (!
|
|
359
|
-
let
|
|
360
|
-
if (
|
|
361
|
-
let
|
|
362
|
-
let n =
|
|
363
|
-
if (!
|
|
364
|
-
|
|
365
|
-
let r =
|
|
366
|
-
|
|
415
|
+
start(e, c) {
|
|
416
|
+
let x = e.deps.selection, S = e.deps.scene, E = w(e.deps.poseDescriptor), D = e.deps.layout, k = e.deps.applyOps, A = e.deps.geometryProjection, F = e.deps.poseComposition ?? i;
|
|
417
|
+
if (!x || !S || j(e.drag?.affordance)) return {};
|
|
418
|
+
let K = N(c?.params), ie = K?.expandIds, ae = [...x.get()], q = ie ? ie(ae) : ae;
|
|
419
|
+
if (q.length === 0) return {};
|
|
420
|
+
let J = /* @__PURE__ */ new Map(), oe = [], Y = /* @__PURE__ */ new Set(), X = [], Z = D?.reflow ?? null, se = /* @__PURE__ */ new Map(), ce = (e, t) => {
|
|
421
|
+
let n = Z?.poseOf(e);
|
|
422
|
+
if (!Z || n === void 0) return;
|
|
423
|
+
Z.glide(e, n, { from: n });
|
|
424
|
+
let r = E.getBounds(n), i = E.getBounds(l(S, t));
|
|
425
|
+
se.set(e, {
|
|
367
426
|
dx: r.x - i.x,
|
|
368
427
|
dy: r.y - i.y
|
|
369
428
|
});
|
|
370
429
|
};
|
|
371
|
-
for (let e of
|
|
372
|
-
let t =
|
|
373
|
-
t && (
|
|
430
|
+
for (let e of q) {
|
|
431
|
+
let t = S.get(e);
|
|
432
|
+
t && (ce(e, t), J.set(e, u(S, t)), Y.add(e), X.push(e));
|
|
374
433
|
}
|
|
375
|
-
for (;
|
|
376
|
-
let e =
|
|
377
|
-
for (let t of
|
|
378
|
-
if (
|
|
379
|
-
|
|
380
|
-
let e =
|
|
381
|
-
e && (
|
|
434
|
+
for (; X.length > 0;) {
|
|
435
|
+
let e = X.shift();
|
|
436
|
+
for (let t of S.childrenOf(e)) {
|
|
437
|
+
if (Y.has(t)) continue;
|
|
438
|
+
Y.add(t);
|
|
439
|
+
let e = S.get(t);
|
|
440
|
+
e && (ce(t, e), J.set(t, u(S, e)), oe.push(t), X.push(t));
|
|
382
441
|
}
|
|
383
442
|
}
|
|
384
|
-
let
|
|
385
|
-
if (
|
|
386
|
-
let e =
|
|
387
|
-
for (let t of
|
|
388
|
-
let n =
|
|
443
|
+
let le = /* @__PURE__ */ new Set(), ue = /* @__PURE__ */ new Map();
|
|
444
|
+
if (F.closure !== "identity") {
|
|
445
|
+
let e = V(S);
|
|
446
|
+
for (let t of J.keys()) {
|
|
447
|
+
let n = o(e, S.get(t)?.parent ?? null);
|
|
389
448
|
if (n !== null) {
|
|
390
|
-
if (
|
|
391
|
-
|
|
449
|
+
if (J.has(_(n))) {
|
|
450
|
+
le.add(t);
|
|
392
451
|
continue;
|
|
393
452
|
}
|
|
394
|
-
|
|
395
|
-
world:
|
|
396
|
-
frameWorld:
|
|
453
|
+
ue.set(t, {
|
|
454
|
+
world: a(e, t, F.compose),
|
|
455
|
+
frameWorld: a(e, n, F.compose)
|
|
397
456
|
});
|
|
398
457
|
}
|
|
399
458
|
}
|
|
400
459
|
}
|
|
401
|
-
let
|
|
402
|
-
for (let [e, t] of
|
|
403
|
-
let
|
|
404
|
-
draggedIds:
|
|
405
|
-
origin:
|
|
406
|
-
current: new Map(
|
|
460
|
+
let de = c?.behaviors ?? [], fe = K?.dragThresholdPx ?? te, Q = m(K, "Move", de), pe = !1, me = T(S), he = /* @__PURE__ */ new Map();
|
|
461
|
+
for (let [e, t] of J) he.set(e, t);
|
|
462
|
+
let ge = f(e.deps), _e = d(e.deps), ve = {
|
|
463
|
+
draggedIds: q,
|
|
464
|
+
origin: he,
|
|
465
|
+
current: new Map(he),
|
|
407
466
|
snap: null,
|
|
408
|
-
modifiers: { ...
|
|
467
|
+
modifiers: { ...e.modifiers },
|
|
409
468
|
pointer: {
|
|
410
|
-
worldX:
|
|
411
|
-
worldY:
|
|
469
|
+
worldX: e.world.x,
|
|
470
|
+
worldY: e.world.y,
|
|
412
471
|
clientX: 0,
|
|
413
472
|
clientY: 0
|
|
414
473
|
},
|
|
415
|
-
view:
|
|
416
|
-
plane:
|
|
417
|
-
adapter:
|
|
474
|
+
view: ge(),
|
|
475
|
+
plane: _e(),
|
|
476
|
+
adapter: me,
|
|
418
477
|
scratch: {}
|
|
419
478
|
};
|
|
420
|
-
for (let e of
|
|
479
|
+
for (let e of de) e.onStart?.(ve);
|
|
421
480
|
let $ = {
|
|
422
|
-
startPoses:
|
|
423
|
-
ids:
|
|
424
|
-
cascadeIds:
|
|
425
|
-
carried:
|
|
426
|
-
frames:
|
|
427
|
-
scene:
|
|
481
|
+
startPoses: J,
|
|
482
|
+
ids: q,
|
|
483
|
+
cascadeIds: oe,
|
|
484
|
+
carried: le,
|
|
485
|
+
frames: ue,
|
|
486
|
+
scene: S,
|
|
428
487
|
currentDelta: {
|
|
429
488
|
dx: 0,
|
|
430
489
|
dy: 0
|
|
431
490
|
},
|
|
491
|
+
view: e.deps.view,
|
|
492
|
+
planeRefs: /* @__PURE__ */ new Map(),
|
|
432
493
|
previews: /* @__PURE__ */ new Map(),
|
|
433
494
|
overrideEntries: /* @__PURE__ */ new Map(),
|
|
434
495
|
reflowTargets: /* @__PURE__ */ new Map(),
|
|
435
496
|
gliding: /* @__PURE__ */ new Set(),
|
|
436
|
-
caught:
|
|
437
|
-
projection:
|
|
438
|
-
behaviors:
|
|
439
|
-
gestureCtx:
|
|
440
|
-
adapter:
|
|
441
|
-
layout:
|
|
497
|
+
caught: se,
|
|
498
|
+
projection: E,
|
|
499
|
+
behaviors: de,
|
|
500
|
+
gestureCtx: ve,
|
|
501
|
+
adapter: me,
|
|
502
|
+
layout: D,
|
|
442
503
|
layoutPass: null,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
504
|
+
dropCenter: null,
|
|
505
|
+
pc: F,
|
|
506
|
+
applyOps: k,
|
|
507
|
+
geometryProjection: A,
|
|
508
|
+
lifecycle: Q
|
|
509
|
+
};
|
|
510
|
+
for (let e of q) {
|
|
511
|
+
let n = S.get(e)?.layer;
|
|
512
|
+
if (n === void 0 || $.planeRefs.has(n)) continue;
|
|
513
|
+
let r = O($.view, n);
|
|
514
|
+
if (r === null) continue;
|
|
515
|
+
let i = ue.get(e)?.world ?? J.get(e);
|
|
516
|
+
if (i === void 0) continue;
|
|
517
|
+
let a = E.getBounds(i), o = {
|
|
518
|
+
x: a.x,
|
|
519
|
+
y: a.y
|
|
520
|
+
};
|
|
521
|
+
$.planeRefs.set(n, {
|
|
522
|
+
own: o,
|
|
523
|
+
edited: t(ee(r), o)
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
let ye = (e) => {
|
|
527
|
+
let { dx: t, dy: n } = $.currentDelta, r = !1, i = (e) => {
|
|
528
|
+
p($, Q, e), r = !0;
|
|
450
529
|
};
|
|
451
530
|
if ($.behaviors.length > 0) {
|
|
452
531
|
let e = $.gestureCtx;
|
|
453
|
-
for (let [r, i] of $.startPoses)
|
|
454
|
-
|
|
532
|
+
for (let [r, i] of $.startPoses) {
|
|
533
|
+
let a = z($, r, t, n);
|
|
534
|
+
e.current.set(r, C(i, a.dx, a.dy, $.projection));
|
|
535
|
+
}
|
|
536
|
+
let r = h($.behaviors, e);
|
|
455
537
|
if (r === null) return !1;
|
|
456
|
-
if (r !== void 0) return
|
|
538
|
+
if (r !== void 0) return i(r), !0;
|
|
457
539
|
}
|
|
458
540
|
if (t === 0 && n === 0) return !1;
|
|
459
541
|
if ($.layout && $.layoutPass) {
|
|
460
|
-
let e = $.layoutPass, t = $.pc, n =
|
|
542
|
+
let e = $.layoutPass, t = $.pc, n = V($.scene), a = e.container.id, o = new Set($.ids.map((e) => e)), c = (e) => {
|
|
461
543
|
if (e.name !== "transform") return e;
|
|
462
|
-
let
|
|
463
|
-
return
|
|
464
|
-
id:
|
|
465
|
-
from:
|
|
466
|
-
to:
|
|
467
|
-
label:
|
|
468
|
-
coalesceKey:
|
|
544
|
+
let r = e.args, i = $.scene.get(_(r.id))?.parent ?? null, c = o.has(r.id) ? a : i;
|
|
545
|
+
return y({
|
|
546
|
+
id: r.id,
|
|
547
|
+
from: s(n, r.from, i, t.compose, t.decompose),
|
|
548
|
+
to: s(n, r.to, c, t.compose, t.decompose),
|
|
549
|
+
label: r.label,
|
|
550
|
+
coalesceKey: r.coalesceKey
|
|
469
551
|
});
|
|
470
552
|
}, l = [], u = [];
|
|
471
553
|
for (let t of e.placements) {
|
|
472
|
-
t.dragged.sourceContainerId !==
|
|
554
|
+
t.dragged.sourceContainerId !== a && l.push(b({
|
|
473
555
|
id: t.dragged.id,
|
|
474
556
|
fromParentId: t.dragged.sourceContainerId,
|
|
475
|
-
toParentId:
|
|
557
|
+
toParentId: a,
|
|
476
558
|
label: "Reparent"
|
|
477
559
|
}));
|
|
478
560
|
let n = e.layout.commitDrop(e.container, t.children, t.dragged, t.target);
|
|
@@ -480,11 +562,11 @@ var B = w({
|
|
|
480
562
|
}
|
|
481
563
|
let d = [];
|
|
482
564
|
for (let [r, i] of e.sourceReflow) {
|
|
483
|
-
let e = $.scene.get(
|
|
484
|
-
d.push(
|
|
565
|
+
let e = $.scene.get(_(r))?.parent ?? null;
|
|
566
|
+
d.push(y({
|
|
485
567
|
id: r,
|
|
486
|
-
from: $.scene.get(
|
|
487
|
-
to:
|
|
568
|
+
from: $.scene.get(_(r)).pose,
|
|
569
|
+
to: s(n, i, e, t.compose, t.decompose),
|
|
488
570
|
label: "Source reflow"
|
|
489
571
|
}));
|
|
490
572
|
}
|
|
@@ -493,153 +575,175 @@ var B = w({
|
|
|
493
575
|
...u,
|
|
494
576
|
...d
|
|
495
577
|
];
|
|
496
|
-
return f.length > 0 &&
|
|
578
|
+
return f.length > 0 && i(f), r;
|
|
497
579
|
}
|
|
498
|
-
let
|
|
580
|
+
let o = /* @__PURE__ */ new Set(), l = [], u = /* @__PURE__ */ new Map(), d = [];
|
|
499
581
|
if ($.layout && !$.layoutPass) {
|
|
500
|
-
let e = $.pc,
|
|
582
|
+
let e = $.pc, r = V($.scene), i = (t) => {
|
|
501
583
|
if (t.name !== "transform") return t;
|
|
502
|
-
let n = t.args,
|
|
503
|
-
return
|
|
584
|
+
let n = t.args, i = $.scene.get(_(n.id))?.parent ?? null;
|
|
585
|
+
return y({
|
|
504
586
|
id: n.id,
|
|
505
|
-
from:
|
|
506
|
-
to:
|
|
587
|
+
from: s(r, n.from, i, e.compose, e.decompose),
|
|
588
|
+
to: s(r, n.to, i, e.compose, e.decompose),
|
|
507
589
|
label: n.label,
|
|
508
590
|
coalesceKey: n.coalesceKey
|
|
509
591
|
});
|
|
510
|
-
},
|
|
592
|
+
}, c = ne($.ids.map((e) => ({
|
|
511
593
|
id: e,
|
|
512
594
|
sourceContainerId: $.scene.get(e)?.parent ?? null
|
|
513
595
|
})), null);
|
|
514
|
-
for (let [
|
|
515
|
-
let
|
|
516
|
-
if (!
|
|
596
|
+
for (let [s, u] of c) {
|
|
597
|
+
let c = $.layout.getLayout(s);
|
|
598
|
+
if (!c?.releaseDrop) continue;
|
|
517
599
|
let d = {
|
|
518
|
-
id:
|
|
519
|
-
bounds: $.projection.getBounds(r
|
|
520
|
-
}, f = $.scene.childrenOf(
|
|
600
|
+
id: s,
|
|
601
|
+
bounds: $.projection.getBounds(a(r, s, e.compose))
|
|
602
|
+
}, f = $.scene.childrenOf(_(s)).filter((e) => !u.has(e)).map((t) => ({
|
|
521
603
|
id: t,
|
|
522
|
-
pose: r
|
|
604
|
+
pose: a(r, t, e.compose)
|
|
523
605
|
}));
|
|
524
606
|
for (let p of u) {
|
|
525
|
-
let u =
|
|
607
|
+
let u = a(H($, r), p, e.compose), m = z($, p, t, n), h = c.releaseDrop(d, f, {
|
|
526
608
|
id: p,
|
|
527
609
|
originPose: u,
|
|
528
|
-
pose:
|
|
529
|
-
sourceContainerId:
|
|
610
|
+
pose: C(u, m.dx, m.dy, $.projection),
|
|
611
|
+
sourceContainerId: s
|
|
530
612
|
});
|
|
531
|
-
if (
|
|
532
|
-
|
|
533
|
-
let
|
|
534
|
-
for (let e of
|
|
613
|
+
if (h === null) continue;
|
|
614
|
+
o.add(p);
|
|
615
|
+
let g = u;
|
|
616
|
+
for (let e of h) {
|
|
535
617
|
let t = e.args;
|
|
536
|
-
e.name === "transform" && t.id === p && (
|
|
618
|
+
e.name === "transform" && t.id === p && (g = t.to), l.push(i(e));
|
|
537
619
|
}
|
|
538
620
|
f = [...f, {
|
|
539
621
|
id: p,
|
|
540
|
-
pose:
|
|
622
|
+
pose: g
|
|
541
623
|
}];
|
|
542
624
|
}
|
|
543
625
|
}
|
|
626
|
+
u = I($, $.ids.filter((e) => !o.has(e)));
|
|
627
|
+
for (let [i, o] of u) {
|
|
628
|
+
let c = $.scene.get(i), l = a(H($, r), i, e.compose), u = z($, i, t, n), f = C(l, u.dx, u.dy, $.projection);
|
|
629
|
+
d.push(b({
|
|
630
|
+
id: i,
|
|
631
|
+
fromParentId: c.parent,
|
|
632
|
+
toParentId: o,
|
|
633
|
+
label: "Reparent"
|
|
634
|
+
})), d.push(y({
|
|
635
|
+
id: i,
|
|
636
|
+
from: c.pose,
|
|
637
|
+
to: s(r, f, o, e.compose, e.decompose),
|
|
638
|
+
label: Q.label
|
|
639
|
+
}));
|
|
640
|
+
}
|
|
544
641
|
}
|
|
545
|
-
if (
|
|
546
|
-
let e = [
|
|
547
|
-
|
|
642
|
+
if (o.size > 0 || u.size > 0) {
|
|
643
|
+
let e = [
|
|
644
|
+
...l,
|
|
645
|
+
...d,
|
|
646
|
+
...L($, B($, o).filter((e) => !u.has(e)), t, n)
|
|
647
|
+
];
|
|
648
|
+
return e.length > 0 && i(e), r;
|
|
548
649
|
}
|
|
549
|
-
let
|
|
550
|
-
if (
|
|
551
|
-
let e = () =>
|
|
650
|
+
let f = N(c?.params)?.reparentOnDrop ?? "off", m = f === "off" ? null : G(e, $);
|
|
651
|
+
if (m) {
|
|
652
|
+
let e = () => re($, m, f, t, n, $.pc);
|
|
552
653
|
try {
|
|
553
|
-
|
|
654
|
+
Q.transient ? $.scene.untracked(e) : $.scene.batch(Q.label, e), r = !0;
|
|
554
655
|
} catch (e) {
|
|
555
|
-
if (!(e instanceof
|
|
656
|
+
if (!(e instanceof v)) throw e;
|
|
556
657
|
}
|
|
557
658
|
} else {
|
|
558
|
-
let e =
|
|
559
|
-
e.length > 0 &&
|
|
659
|
+
let e = L($, [...$.ids, ...$.cascadeIds], t, n);
|
|
660
|
+
e.length > 0 && i(e);
|
|
560
661
|
}
|
|
561
|
-
return
|
|
662
|
+
return r;
|
|
562
663
|
};
|
|
563
664
|
return {
|
|
564
665
|
kind: "move",
|
|
565
666
|
onMove(e) {
|
|
566
667
|
if (!e.drag) return;
|
|
567
|
-
if (!
|
|
668
|
+
if (!pe) {
|
|
568
669
|
let t = e.drag.screenDelta;
|
|
569
|
-
if (t && !
|
|
670
|
+
if (t && !M({
|
|
570
671
|
clientX: 0,
|
|
571
672
|
clientY: 0
|
|
572
673
|
}, {
|
|
573
674
|
clientX: t.x,
|
|
574
675
|
clientY: t.y
|
|
575
|
-
},
|
|
576
|
-
|
|
676
|
+
}, fe)) return;
|
|
677
|
+
pe = !0, Q.start($.ids);
|
|
577
678
|
}
|
|
578
|
-
let
|
|
679
|
+
let t = e.drag.delta.x, n = e.drag.delta.y;
|
|
579
680
|
if ($.behaviors.length > 0) {
|
|
580
|
-
let
|
|
581
|
-
|
|
681
|
+
let r = $.gestureCtx;
|
|
682
|
+
r.modifiers = { ...e.modifiers }, r.pointer = {
|
|
582
683
|
worldX: e.drag.current.x,
|
|
583
684
|
worldY: e.drag.current.y,
|
|
584
685
|
clientX: 0,
|
|
585
686
|
clientY: 0
|
|
586
|
-
},
|
|
587
|
-
for (let [e, i] of $.startPoses)
|
|
687
|
+
}, r.view = ge(), r.plane = _e();
|
|
688
|
+
for (let [e, i] of $.startPoses) {
|
|
689
|
+
let a = z($, e, t, n);
|
|
690
|
+
r.current.set(e, C(i, a.dx, a.dy, $.projection));
|
|
691
|
+
}
|
|
588
692
|
let i = {
|
|
589
693
|
kind: "translate",
|
|
590
|
-
dx:
|
|
591
|
-
dy:
|
|
694
|
+
dx: t,
|
|
695
|
+
dy: n
|
|
592
696
|
}, a = $.ids[0];
|
|
593
697
|
for (let e of $.behaviors) {
|
|
594
|
-
let
|
|
595
|
-
if (
|
|
596
|
-
if (
|
|
597
|
-
else if (
|
|
698
|
+
let t = e.onMove?.(r, i);
|
|
699
|
+
if (t) {
|
|
700
|
+
if (t.transform && t.transform.kind === "translate") i = t.transform;
|
|
701
|
+
else if (t.pose !== void 0 && a !== void 0) {
|
|
598
702
|
let e = $.startPoses.get(a);
|
|
599
703
|
if (e !== void 0) {
|
|
600
|
-
let
|
|
704
|
+
let n = $.projection.getBounds(e), r = $.projection.getBounds(t.pose);
|
|
601
705
|
i = {
|
|
602
706
|
kind: "translate",
|
|
603
|
-
dx: r.x -
|
|
604
|
-
dy: r.y -
|
|
707
|
+
dx: r.x - n.x,
|
|
708
|
+
dy: r.y - n.y
|
|
605
709
|
};
|
|
606
710
|
}
|
|
607
711
|
}
|
|
608
|
-
|
|
712
|
+
t.snap !== void 0 && (r.snap = t.snap);
|
|
609
713
|
}
|
|
610
714
|
}
|
|
611
|
-
i.kind === "translate" && (
|
|
715
|
+
i.kind === "translate" && (t = i.dx, n = i.dy);
|
|
612
716
|
}
|
|
613
717
|
$.currentDelta = {
|
|
614
|
-
dx:
|
|
615
|
-
dy:
|
|
718
|
+
dx: t,
|
|
719
|
+
dy: n
|
|
616
720
|
}, $.previews.clear();
|
|
617
|
-
for (let [e,
|
|
721
|
+
for (let [e, r] of $.startPoses) {
|
|
618
722
|
if ($.carried.has(e)) {
|
|
619
|
-
$.previews.set(e,
|
|
723
|
+
$.previews.set(e, r);
|
|
620
724
|
continue;
|
|
621
725
|
}
|
|
622
|
-
let i =
|
|
623
|
-
$.previews.set(e,
|
|
726
|
+
let i = R($, e, t, n);
|
|
727
|
+
$.previews.set(e, C(r, i.dx, i.dy, $.projection));
|
|
624
728
|
}
|
|
625
|
-
$.layoutPass = null, $.reflowTargets.clear(),
|
|
729
|
+
$.layoutPass = null, $.dropCenter = null, $.reflowTargets.clear(), P($, e);
|
|
626
730
|
let i = $.layout?.reflow;
|
|
627
731
|
if (i) {
|
|
628
732
|
for (let [e, t] of $.reflowTargets) i.glide(e, t), $.gliding.add(e);
|
|
629
733
|
for (let e of $.gliding) $.reflowTargets.has(e) || (i.settle(e), $.gliding.delete(e));
|
|
630
734
|
}
|
|
631
|
-
|
|
735
|
+
r($);
|
|
632
736
|
},
|
|
633
|
-
onEnd(
|
|
634
|
-
let r = !1, i = $.layout?.reflow ?? null, a = i ?
|
|
737
|
+
onEnd(e, t) {
|
|
738
|
+
let r = !1, i = $.layout?.reflow ?? null, a = i ? U($) : null;
|
|
635
739
|
try {
|
|
636
|
-
|
|
740
|
+
t === "commit" ? r = ye(e) : g($.behaviors, $.gestureCtx);
|
|
637
741
|
} finally {
|
|
638
|
-
if (
|
|
742
|
+
if (n($), $.previews.clear(), i && a) {
|
|
639
743
|
for (let e of $.gliding) i.settle(e);
|
|
640
|
-
|
|
744
|
+
W($, i, a);
|
|
641
745
|
}
|
|
642
|
-
$.gliding.clear(),
|
|
746
|
+
$.gliding.clear(), Q.end(r);
|
|
643
747
|
}
|
|
644
748
|
},
|
|
645
749
|
previewIds: () => $.previews.keys(),
|
|
@@ -649,8 +753,8 @@ var B = w({
|
|
|
649
753
|
}
|
|
650
754
|
},
|
|
651
755
|
enabled: () => !0
|
|
652
|
-
},
|
|
756
|
+
}, k);
|
|
653
757
|
//#endregion
|
|
654
|
-
export {
|
|
758
|
+
export { K as moveAction };
|
|
655
759
|
|
|
656
760
|
//# sourceMappingURL=move.js.map
|