@nightshadeui/canvas 2.22.0 → 3.1.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/CanvasController.d.ts +3 -1
- package/dist/CanvasController.d.ts.map +1 -1
- package/dist/canvas.css +1 -1
- package/dist/canvas.mjs +825 -823
- package/package.json +4 -3
- package/src/CanvasBoxSelect.ts +129 -0
- package/src/CanvasConfig.ts +24 -0
- package/src/CanvasController.ts +74 -0
- package/src/CanvasEvents.ts +14 -0
- package/src/CanvasMove.ts +62 -0
- package/src/CanvasObjectController.ts +368 -0
- package/src/CanvasObjectRegistry.ts +23 -0
- package/src/CanvasPan.ts +49 -0
- package/src/CanvasSelection.ts +104 -0
- package/src/CanvasSpace.ts +69 -0
- package/src/CanvasViewport.ts +166 -0
- package/src/CanvasZoom.ts +59 -0
- package/src/components/CanvasBoxSelect.vue +44 -0
- package/src/components/CanvasDebugCoords.vue +85 -0
- package/src/components/CanvasObject.vue +142 -0
- package/src/components/CanvasObjectResize.vue +95 -0
- package/src/components/CanvasView.vue +104 -0
- package/src/index.ts +24 -0
- package/src/types.ts +3 -0
package/dist/canvas.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { openBlock as U, createElementBlock as q, createElementVNode as
|
|
1
|
+
import { openBlock as U, createElementBlock as q, createElementVNode as j, normalizeStyle as Z, createCommentVNode as Me, resolveComponent as ot, createBlock as Kt, withCtx as G, createVNode as F, toDisplayString as X, withModifiers as B, normalizeClass as Oe, renderSlot as it, normalizeProps as Pe, guardReactiveProps as Ce, Fragment as je, renderList as _e, markRaw as Ee, reactive as Ie } from "vue";
|
|
2
2
|
const tt = (r, t) => {
|
|
3
3
|
const e = r.__vccOpts || r;
|
|
4
4
|
for (const [n, o] of t)
|
|
@@ -10,17 +10,17 @@ const tt = (r, t) => {
|
|
|
10
10
|
}
|
|
11
11
|
}, ze = {
|
|
12
12
|
key: 0,
|
|
13
|
-
class: "CanvasBoxSelect"
|
|
13
|
+
class: "CanvasBoxSelect tone-primary"
|
|
14
14
|
};
|
|
15
|
-
function
|
|
15
|
+
function Re(r, t, e, n, o, l) {
|
|
16
16
|
return e.canvas.boxSelect.isSelecting() ? (U(), q("div", ze, [
|
|
17
|
-
|
|
17
|
+
j("div", {
|
|
18
18
|
class: "Box",
|
|
19
19
|
style: Z(e.canvas.boxSelect.getSelectionStyle())
|
|
20
20
|
}, null, 4)
|
|
21
|
-
])) :
|
|
21
|
+
])) : Me("", !0);
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const De = /* @__PURE__ */ tt(Te, [["render", Re], ["__scopeId", "data-v-d6539bbd"]]), ke = {
|
|
24
24
|
props: {
|
|
25
25
|
canvas: { type: Object, required: !0 }
|
|
26
26
|
},
|
|
@@ -46,43 +46,43 @@ const Re = /* @__PURE__ */ tt(Te, [["render", De], ["__scopeId", "data-v-9e8905e
|
|
|
46
46
|
};
|
|
47
47
|
function Be(r, t, e, n, o, l) {
|
|
48
48
|
const g = ot("HGroup"), p = ot("VGroup");
|
|
49
|
-
return U(),
|
|
49
|
+
return U(), Kt(p, {
|
|
50
50
|
class: "CanvasDebugCoords",
|
|
51
51
|
gap: "s"
|
|
52
52
|
}, {
|
|
53
53
|
default: G(() => [
|
|
54
54
|
F(g, { class: "Row" }, {
|
|
55
55
|
default: G(() => [
|
|
56
|
-
t[0] || (t[0] =
|
|
57
|
-
|
|
56
|
+
t[0] || (t[0] = j("strong", null, "page", -1)),
|
|
57
|
+
j("span", null, X(l.format(l.pagePos)), 1)
|
|
58
58
|
]),
|
|
59
59
|
_: 1
|
|
60
60
|
}),
|
|
61
61
|
F(g, { class: "Row" }, {
|
|
62
62
|
default: G(() => [
|
|
63
|
-
t[1] || (t[1] =
|
|
64
|
-
|
|
63
|
+
t[1] || (t[1] = j("strong", null, "viewport", -1)),
|
|
64
|
+
j("span", null, X(l.format(l.viewportPos)), 1)
|
|
65
65
|
]),
|
|
66
66
|
_: 1
|
|
67
67
|
}),
|
|
68
68
|
F(g, { class: "Row" }, {
|
|
69
69
|
default: G(() => [
|
|
70
|
-
t[2] || (t[2] =
|
|
71
|
-
|
|
70
|
+
t[2] || (t[2] = j("strong", null, "canvas", -1)),
|
|
71
|
+
j("span", null, X(l.format(l.canvasPos)), 1)
|
|
72
72
|
]),
|
|
73
73
|
_: 1
|
|
74
74
|
}),
|
|
75
75
|
F(g, { class: "Row" }, {
|
|
76
76
|
default: G(() => [
|
|
77
|
-
t[3] || (t[3] =
|
|
78
|
-
|
|
77
|
+
t[3] || (t[3] = j("strong", null, "local", -1)),
|
|
78
|
+
j("span", null, X(l.format(l.localPos)), 1)
|
|
79
79
|
]),
|
|
80
80
|
_: 1
|
|
81
81
|
}),
|
|
82
82
|
F(g, { class: "Row" }, {
|
|
83
83
|
default: G(() => [
|
|
84
|
-
t[4] || (t[4] =
|
|
85
|
-
|
|
84
|
+
t[4] || (t[4] = j("strong", null, "zoom", -1)),
|
|
85
|
+
j("span", null, X(e.canvas.space.zoom.toFixed(2)), 1)
|
|
86
86
|
]),
|
|
87
87
|
_: 1
|
|
88
88
|
})
|
|
@@ -90,38 +90,183 @@ function Be(r, t, e, n, o, l) {
|
|
|
90
90
|
_: 1
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
const ws = /* @__PURE__ */ tt(ke, [["render", Be], ["__scopeId", "data-v-30d3c083"]]), Ue = {
|
|
94
|
+
props: {
|
|
95
|
+
canvasObject: { type: Object, required: !0 },
|
|
96
|
+
direction: { type: String, required: !0 }
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function Ve(r, t, e, n, o, l) {
|
|
100
|
+
return U(), q("div", {
|
|
101
|
+
class: Oe(["ResizeHandle", `ResizeHandle-${e.direction}`]),
|
|
102
|
+
onUidragstart: t[0] || (t[0] = B((g) => e.canvasObject.startResizing(e.direction), ["stop", "prevent"])),
|
|
103
|
+
onUidragmove: t[1] || (t[1] = B((...g) => e.canvasObject.onResizeMove && e.canvasObject.onResizeMove(...g), ["stop", "prevent"])),
|
|
104
|
+
onUidragend: t[2] || (t[2] = B((...g) => e.canvasObject.onResizeEnd && e.canvasObject.onResizeEnd(...g), ["stop", "prevent"]))
|
|
105
|
+
}, null, 34);
|
|
102
106
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
const Le = /* @__PURE__ */ tt(Ue, [["render", Ve], ["__scopeId", "data-v-8e1eca30"]]), Ae = {
|
|
108
|
+
components: {
|
|
109
|
+
CanvasObjectResize: Le
|
|
110
|
+
},
|
|
111
|
+
props: {
|
|
112
|
+
canvas: { type: Object, required: !0 },
|
|
113
|
+
objectId: { type: String, required: !0 },
|
|
114
|
+
pos: { type: Object, required: !0 },
|
|
115
|
+
isSelected: { type: Boolean, default: !1 },
|
|
116
|
+
selectable: { type: Boolean, default: !0 },
|
|
117
|
+
movable: { type: Boolean, default: !0 },
|
|
118
|
+
snapToGrid: { type: Boolean, default: !0 },
|
|
119
|
+
resizable: { type: String, default: "none" },
|
|
120
|
+
bounds: { type: Array }
|
|
121
|
+
},
|
|
122
|
+
emits: [
|
|
123
|
+
"update:pos",
|
|
124
|
+
"update:isSelected"
|
|
125
|
+
],
|
|
126
|
+
data() {
|
|
127
|
+
return {
|
|
128
|
+
canvasObject: null
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
computed: {
|
|
132
|
+
coords() {
|
|
133
|
+
return this.canvasObject.getCanvasCoords();
|
|
134
|
+
},
|
|
135
|
+
slotProps() {
|
|
136
|
+
return {
|
|
137
|
+
canvas: this.canvas,
|
|
138
|
+
objectId: this.objectId,
|
|
139
|
+
isSelected: this.canvas.selection.isSelected(this.objectId),
|
|
140
|
+
coords: this.coords,
|
|
141
|
+
pos: this.pos
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
resizeDirections() {
|
|
145
|
+
return this.canvasObject.getResizeDirections();
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
watch: {
|
|
149
|
+
pos(r) {
|
|
150
|
+
this.canvasObject.setPos(r);
|
|
151
|
+
},
|
|
152
|
+
isSelected(r) {
|
|
153
|
+
this.canvasObject.setSelected(r);
|
|
154
|
+
},
|
|
155
|
+
selectable(r) {
|
|
156
|
+
this.canvasObject.setSelectable(r);
|
|
157
|
+
},
|
|
158
|
+
movable(r) {
|
|
159
|
+
this.canvasObject.setMovable(r);
|
|
160
|
+
},
|
|
161
|
+
snapToGrid(r) {
|
|
162
|
+
this.canvasObject.setSnapToGrid(r);
|
|
163
|
+
},
|
|
164
|
+
resizable(r) {
|
|
165
|
+
this.canvasObject.setResizable(r);
|
|
166
|
+
},
|
|
167
|
+
bounds(r) {
|
|
168
|
+
this.canvasObject.setBounds(r);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
created() {
|
|
172
|
+
this.canvasObject = this.canvas.createObjectController(this.objectId), this.canvas.events.objectPosUpdated.on(({ objectId: r, pos: t }) => {
|
|
173
|
+
r === this.objectId && this.$emit("update:pos", t);
|
|
174
|
+
}, this), this.canvas.events.selectionChanged.on((r) => {
|
|
175
|
+
const t = r.includes(this.objectId);
|
|
176
|
+
this.isSelected !== t && this.$emit("update:isSelected", t);
|
|
177
|
+
}, this);
|
|
178
|
+
},
|
|
179
|
+
mounted() {
|
|
180
|
+
const r = this.canvasObject;
|
|
181
|
+
this.canvas.objectRegistry.register(r), r.setElement(this.$refs.rootEl), r.setPos(this.pos), r.setSelectable(this.selectable), r.setMovable(this.movable), r.setSnapToGrid(this.snapToGrid), r.setResizable(this.resizable), r.setBounds(this.bounds), r.setSelected(this.isSelected);
|
|
182
|
+
},
|
|
183
|
+
unmounted() {
|
|
184
|
+
this.canvas.objectRegistry.unregister(this.objectId), this.canvasObject.setElement(null), this.canvas.selection.removeFromSelection(this.objectId), this.canvas.events.objectPosUpdated.removeAll(this), this.canvas.events.selectionChanged.removeAll(this);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
function Ge(r, t, e, n, o, l) {
|
|
188
|
+
const g = ot("CanvasObjectResize");
|
|
189
|
+
return U(), q("div", {
|
|
190
|
+
ref: "rootEl",
|
|
191
|
+
class: "CanvasObject",
|
|
192
|
+
style: Z(o.canvasObject.getStyle()),
|
|
193
|
+
onUiclick: t[0] || (t[0] = B((...p) => o.canvasObject.onUiClick && o.canvasObject.onUiClick(...p), ["stop", "prevent"])),
|
|
194
|
+
onUidragstart: t[1] || (t[1] = B((...p) => o.canvasObject.onUiDragStart && o.canvasObject.onUiDragStart(...p), ["stop", "prevent"])),
|
|
195
|
+
onUidragmove: t[2] || (t[2] = B((...p) => o.canvasObject.onUiDragMove && o.canvasObject.onUiDragMove(...p), ["stop", "prevent"])),
|
|
196
|
+
onUidragend: t[3] || (t[3] = B((...p) => o.canvasObject.onUiDragEnd && o.canvasObject.onUiDragEnd(...p), ["stop", "prevent"]))
|
|
197
|
+
}, [
|
|
198
|
+
it(r.$slots, "default", Pe(Ce(l.slotProps))),
|
|
199
|
+
(U(!0), q(je, null, _e(l.resizeDirections, (p) => (U(), Kt(g, {
|
|
200
|
+
key: p,
|
|
201
|
+
canvasObject: o.canvasObject,
|
|
202
|
+
direction: p
|
|
203
|
+
}, null, 8, ["canvasObject", "direction"]))), 128))
|
|
204
|
+
], 36);
|
|
109
205
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
206
|
+
const ms = /* @__PURE__ */ tt(Ae, [["render", Ge]]), $e = {
|
|
207
|
+
components: {
|
|
208
|
+
CanvasBoxSelect: De
|
|
209
|
+
},
|
|
210
|
+
props: {
|
|
211
|
+
canvas: { type: Object, required: !0 }
|
|
212
|
+
},
|
|
213
|
+
mounted() {
|
|
214
|
+
this.canvas.mount(this.$refs.viewport);
|
|
215
|
+
},
|
|
216
|
+
unmounted() {
|
|
217
|
+
this.canvas.unmount();
|
|
218
|
+
},
|
|
219
|
+
methods: {
|
|
220
|
+
onCanvasUiClick() {
|
|
221
|
+
this.canvas.selection.deselectAll();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}, Fe = { class: "CanvasView" };
|
|
225
|
+
function Ke(r, t, e, n, o, l) {
|
|
226
|
+
const g = ot("CanvasBoxSelect");
|
|
227
|
+
return U(), q("div", Fe, [
|
|
228
|
+
j("div", {
|
|
229
|
+
ref: "viewport",
|
|
230
|
+
class: "Viewport",
|
|
231
|
+
onMousedown: t[0] || (t[0] = (...p) => e.canvas.pan.onMouseDown && e.canvas.pan.onMouseDown(...p)),
|
|
232
|
+
onUidragstart: t[1] || (t[1] = (...p) => e.canvas.boxSelect.onUiDragStart && e.canvas.boxSelect.onUiDragStart(...p)),
|
|
233
|
+
onUidragmove: t[2] || (t[2] = (...p) => e.canvas.boxSelect.onUiDragMove && e.canvas.boxSelect.onUiDragMove(...p)),
|
|
234
|
+
onUidragend: t[3] || (t[3] = (...p) => e.canvas.boxSelect.onUiDragEnd && e.canvas.boxSelect.onUiDragEnd(...p)),
|
|
235
|
+
onUiclick: t[4] || (t[4] = (...p) => l.onCanvasUiClick && l.onCanvasUiClick(...p)),
|
|
236
|
+
onScroll: t[5] || (t[5] = (...p) => e.canvas.viewport.onScroll && e.canvas.viewport.onScroll(...p)),
|
|
237
|
+
onWheel: t[6] || (t[6] = (...p) => e.canvas.zoom.onWheel && e.canvas.zoom.onWheel(...p))
|
|
238
|
+
}, [
|
|
239
|
+
j("div", {
|
|
240
|
+
class: "Sizer",
|
|
241
|
+
style: Z(e.canvas.viewport.getSizerStyle())
|
|
242
|
+
}, null, 4),
|
|
243
|
+
j("div", {
|
|
244
|
+
class: "Canvas",
|
|
245
|
+
style: Z(e.canvas.viewport.getCanvasStyle())
|
|
246
|
+
}, [
|
|
247
|
+
it(r.$slots, "default", {}, void 0, !0),
|
|
248
|
+
j("div", {
|
|
249
|
+
class: "Origin",
|
|
250
|
+
style: Z(e.canvas.viewport.getOriginStyle())
|
|
251
|
+
}, [
|
|
252
|
+
it(r.$slots, "origin", {}, void 0, !0)
|
|
253
|
+
], 4)
|
|
254
|
+
], 4),
|
|
255
|
+
F(g, { canvas: e.canvas }, null, 8, ["canvas"])
|
|
256
|
+
], 544),
|
|
257
|
+
it(r.$slots, "overlays", {}, void 0, !0)
|
|
258
|
+
]);
|
|
113
259
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
260
|
+
const bs = /* @__PURE__ */ tt($e, [["render", Ke], ["__scopeId", "data-v-585857be"]]);
|
|
261
|
+
function nt(r, t) {
|
|
262
|
+
const e = { x: Math.min(r.x, t.x), y: Math.min(r.y, t.y) }, n = { x: Math.max(r.x, t.x), y: Math.max(r.y, t.y) };
|
|
263
|
+
return [e, n];
|
|
117
264
|
}
|
|
118
|
-
function Bt(r, t
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
const g = getComputedStyle(l).color.trim();
|
|
122
|
-
return l.remove(), g || e;
|
|
265
|
+
function Bt(r, t) {
|
|
266
|
+
const e = r[1].x >= t[0].x && t[1].x >= r[0].x, n = r[1].y >= t[0].y && t[1].y >= r[0].y;
|
|
267
|
+
return e && n;
|
|
123
268
|
}
|
|
124
|
-
let
|
|
269
|
+
let Ne = class {
|
|
125
270
|
constructor(t) {
|
|
126
271
|
this.target = t, this.entries = [];
|
|
127
272
|
}
|
|
@@ -134,156 +279,206 @@ let Xt = class {
|
|
|
134
279
|
this.entries = [];
|
|
135
280
|
}
|
|
136
281
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
]
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
282
|
+
const Ye = [
|
|
283
|
+
"button",
|
|
284
|
+
"a",
|
|
285
|
+
"input",
|
|
286
|
+
"textarea",
|
|
287
|
+
"select",
|
|
288
|
+
'[role="textbox"]',
|
|
289
|
+
'[role="button"]',
|
|
290
|
+
"[nodrag]"
|
|
291
|
+
];
|
|
292
|
+
class rt {
|
|
293
|
+
constructor() {
|
|
294
|
+
this.lastMousePos = { x: window.innerWidth * 0.5, y: window.innerHeight * 0.5 }, this.lmbPressed = !1, this.mmbPressed = !1, this.rmbPressed = !1, this.altKey = !1, this.ctrlKey = !1, this.metaKey = !1, this.shiftKey = !1, this.dragDistance = 4, this.windowEvents = new Ne(window), this.lastMouseDownPos = { x: window.innerWidth * 0.5, y: window.innerHeight * 0.5 }, this.lastMouseDownTarget = null, this.dragTarget = null, this.inClickVicinity = !1, this.listening = !1;
|
|
295
|
+
}
|
|
296
|
+
get ctrlOrMetaKey() {
|
|
297
|
+
return this.ctrlKey || this.metaKey;
|
|
298
|
+
}
|
|
299
|
+
mount() {
|
|
300
|
+
this.listening || (this.listening = !0, this.windowEvents.add("mousedown", (t) => this.onMouseDown(t)), this.windowEvents.add("mousemove", (t) => this.onMouseMove(t)), this.windowEvents.add("mouseup", (t) => this.onMouseUp(t)), this.windowEvents.add("keydown", (t) => this.onKeyDown(t)), this.windowEvents.add("keyup", (t) => this.onKeyUp(t)));
|
|
301
|
+
}
|
|
302
|
+
unmount() {
|
|
303
|
+
this.listening && (this.listening = !1, this.windowEvents.removeAll(), this.dragTarget = null, this.inClickVicinity = !1, this.lastMouseDownTarget = null);
|
|
304
|
+
}
|
|
305
|
+
onMouseDown(t) {
|
|
306
|
+
this.lastMousePos = { x: t.pageX, y: t.pageY }, this.lmbPressed = t.button === 0, this.mmbPressed = t.button === 1, this.rmbPressed = t.button === 2, t.button === 0 && (this.lastMouseDownPos = { x: t.pageX, y: t.pageY }, this.lastMouseDownTarget = t.target, this.inClickVicinity = !0);
|
|
307
|
+
}
|
|
308
|
+
onMouseMove(t) {
|
|
309
|
+
if (this.lastMousePos = { x: t.pageX, y: t.pageY }, !this.lmbPressed)
|
|
310
|
+
return;
|
|
311
|
+
if (this.dragTarget) {
|
|
312
|
+
this.dragTarget.dispatchEvent(this.cloneMouseEvent("uidragmove", t));
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
if (!this.inClickVicinity || !this.lastMouseDownTarget)
|
|
316
|
+
return;
|
|
317
|
+
const e = t.pageX - this.lastMouseDownPos.x, n = t.pageY - this.lastMouseDownPos.y;
|
|
318
|
+
Math.hypot(e, n) < this.dragDistance || (this.inClickVicinity = !1, this.isDragAllowed(this.lastMouseDownTarget) && (this.dragTarget = this.lastMouseDownTarget, this.dragTarget.dispatchEvent(this.cloneMouseEvent("uidragstart", t))));
|
|
319
|
+
}
|
|
320
|
+
onMouseUp(t) {
|
|
321
|
+
if (t.button === 0) {
|
|
322
|
+
const e = this.dragTarget, n = this.inClickVicinity, o = this.lastMouseDownTarget;
|
|
323
|
+
this.dragTarget = null, this.inClickVicinity = !1, this.lastMouseDownTarget = null, e && e.dispatchEvent(this.cloneMouseEvent("uidragend", t)), n && o && (o.dispatchEvent(this.cloneMouseEvent("uiclick", t)), this.dispatchActivate(o, t));
|
|
324
|
+
}
|
|
325
|
+
this.lastMousePos = { x: t.pageX, y: t.pageY }, this.lmbPressed = !1, this.mmbPressed = !1, this.rmbPressed = !1;
|
|
326
|
+
}
|
|
327
|
+
onKeyDown(t) {
|
|
328
|
+
this.updateModifiers(t), (t.key === "Enter" || t.key === " ") && t.target && (t.target === document.body && t.key === " " && t.preventDefault(), this.dispatchActivate(t.target, t));
|
|
329
|
+
}
|
|
330
|
+
onKeyUp(t) {
|
|
331
|
+
this.updateModifiers(t);
|
|
332
|
+
}
|
|
333
|
+
updateModifiers(t) {
|
|
334
|
+
this.altKey = t.altKey, this.ctrlKey = t.ctrlKey, this.metaKey = t.metaKey, this.shiftKey = t.shiftKey;
|
|
335
|
+
}
|
|
336
|
+
dispatchActivate(t, e) {
|
|
337
|
+
t.closest(":disabled") || t.dispatchEvent(new CustomEvent("uiactivate", { detail: e }));
|
|
338
|
+
}
|
|
339
|
+
isDragAllowed(t) {
|
|
340
|
+
return t instanceof Element ? !t.closest(Ye.join(",")) : !1;
|
|
341
|
+
}
|
|
342
|
+
cloneMouseEvent(t, e) {
|
|
343
|
+
return new MouseEvent(t, {
|
|
344
|
+
bubbles: !0,
|
|
345
|
+
cancelable: !0,
|
|
346
|
+
clientX: e.clientX,
|
|
347
|
+
clientY: e.clientY,
|
|
348
|
+
screenX: e.screenX,
|
|
349
|
+
screenY: e.screenY,
|
|
350
|
+
button: e.button,
|
|
351
|
+
buttons: e.buttons,
|
|
352
|
+
ctrlKey: e.ctrlKey,
|
|
353
|
+
shiftKey: e.shiftKey,
|
|
354
|
+
altKey: e.altKey,
|
|
355
|
+
metaKey: e.metaKey
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
var Ut = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Vt = {};
|
|
360
|
+
var Lt;
|
|
361
|
+
function He() {
|
|
362
|
+
if (Lt) return Vt;
|
|
363
|
+
Lt = 1;
|
|
364
|
+
var r;
|
|
365
|
+
return (function(t) {
|
|
366
|
+
(function(e) {
|
|
367
|
+
var n = typeof globalThis == "object" ? globalThis : typeof Ut == "object" ? Ut : typeof self == "object" ? self : typeof this == "object" ? this : S(), o = l(t);
|
|
368
|
+
typeof n.Reflect < "u" && (o = l(n.Reflect, o)), e(o, n), typeof n.Reflect > "u" && (n.Reflect = t);
|
|
369
|
+
function l(_, E) {
|
|
370
|
+
return function(D, N) {
|
|
371
|
+
Object.defineProperty(_, D, { configurable: !0, writable: !0, value: N }), E && E(D, N);
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function g() {
|
|
375
|
+
try {
|
|
376
|
+
return Function("return this;")();
|
|
377
|
+
} catch {
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function p() {
|
|
381
|
+
try {
|
|
382
|
+
return (0, eval)("(function() { return this; })()");
|
|
383
|
+
} catch {
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
function S() {
|
|
387
|
+
return g() || p();
|
|
388
|
+
}
|
|
389
|
+
})(function(e, n) {
|
|
390
|
+
var o = Object.prototype.hasOwnProperty, l = typeof Symbol == "function", g = l && typeof Symbol.toPrimitive < "u" ? Symbol.toPrimitive : "@@toPrimitive", p = l && typeof Symbol.iterator < "u" ? Symbol.iterator : "@@iterator", S = typeof Object.create == "function", _ = { __proto__: [] } instanceof Array, E = !S && !_, D = {
|
|
391
|
+
// create an object in dictionary mode (a.k.a. "slow" mode in v8)
|
|
392
|
+
create: S ? function() {
|
|
393
|
+
return pt(/* @__PURE__ */ Object.create(null));
|
|
394
|
+
} : _ ? function() {
|
|
395
|
+
return pt({ __proto__: null });
|
|
396
|
+
} : function() {
|
|
397
|
+
return pt({});
|
|
398
|
+
},
|
|
399
|
+
has: E ? function(s, i) {
|
|
400
|
+
return o.call(s, i);
|
|
401
|
+
} : function(s, i) {
|
|
402
|
+
return i in s;
|
|
403
|
+
},
|
|
404
|
+
get: E ? function(s, i) {
|
|
405
|
+
return o.call(s, i) ? s[i] : void 0;
|
|
406
|
+
} : function(s, i) {
|
|
407
|
+
return s[i];
|
|
408
|
+
}
|
|
409
|
+
}, N = Object.getPrototypeOf(Function), Y = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : we(), ut = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : me(), ht = typeof WeakMap == "function" ? WeakMap : be(), L = l ? /* @__PURE__ */ Symbol.for("@reflect-metadata:registry") : void 0, et = pe(), mt = ye(et);
|
|
410
|
+
function qt(s, i, a, c) {
|
|
411
|
+
if (y(a)) {
|
|
412
|
+
if (!_t(s))
|
|
413
|
+
throw new TypeError();
|
|
414
|
+
if (!Et(i))
|
|
415
|
+
throw new TypeError();
|
|
416
|
+
return ae(s, i);
|
|
417
|
+
} else {
|
|
418
|
+
if (!_t(s))
|
|
419
|
+
throw new TypeError();
|
|
420
|
+
if (!O(i))
|
|
421
|
+
throw new TypeError();
|
|
422
|
+
if (!O(c) && !y(c) && !A(c))
|
|
423
|
+
throw new TypeError();
|
|
424
|
+
return A(c) && (c = void 0), a = T(a), ce(s, i, a, c);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
e("decorate", qt);
|
|
428
|
+
function Jt(s, i) {
|
|
429
|
+
function a(c, v) {
|
|
430
|
+
if (!O(c))
|
|
236
431
|
throw new TypeError();
|
|
237
|
-
if (!y(v) && !
|
|
432
|
+
if (!y(v) && !fe(v))
|
|
238
433
|
throw new TypeError();
|
|
239
434
|
Mt(s, i, c, v);
|
|
240
435
|
}
|
|
241
436
|
return a;
|
|
242
437
|
}
|
|
243
|
-
e("metadata",
|
|
244
|
-
function
|
|
438
|
+
e("metadata", Jt);
|
|
439
|
+
function Qt(s, i, a, c) {
|
|
245
440
|
if (!O(a))
|
|
246
441
|
throw new TypeError();
|
|
247
442
|
return y(c) || (c = T(c)), Mt(s, i, a, c);
|
|
248
443
|
}
|
|
249
|
-
e("defineMetadata",
|
|
250
|
-
function
|
|
444
|
+
e("defineMetadata", Qt);
|
|
445
|
+
function te(s, i, a) {
|
|
251
446
|
if (!O(i))
|
|
252
447
|
throw new TypeError();
|
|
253
448
|
return y(a) || (a = T(a)), bt(s, i, a);
|
|
254
449
|
}
|
|
255
|
-
e("hasMetadata",
|
|
256
|
-
function
|
|
450
|
+
e("hasMetadata", te);
|
|
451
|
+
function ee(s, i, a) {
|
|
257
452
|
if (!O(i))
|
|
258
453
|
throw new TypeError();
|
|
259
454
|
return y(a) || (a = T(a)), dt(s, i, a);
|
|
260
455
|
}
|
|
261
|
-
e("hasOwnMetadata",
|
|
262
|
-
function
|
|
456
|
+
e("hasOwnMetadata", ee);
|
|
457
|
+
function se(s, i, a) {
|
|
263
458
|
if (!O(i))
|
|
264
459
|
throw new TypeError();
|
|
265
460
|
return y(a) || (a = T(a)), xt(s, i, a);
|
|
266
461
|
}
|
|
267
|
-
e("getMetadata",
|
|
268
|
-
function
|
|
462
|
+
e("getMetadata", se);
|
|
463
|
+
function ne(s, i, a) {
|
|
269
464
|
if (!O(i))
|
|
270
465
|
throw new TypeError();
|
|
271
466
|
return y(a) || (a = T(a)), St(s, i, a);
|
|
272
467
|
}
|
|
273
|
-
e("getOwnMetadata",
|
|
274
|
-
function
|
|
468
|
+
e("getOwnMetadata", ne);
|
|
469
|
+
function ie(s, i) {
|
|
275
470
|
if (!O(s))
|
|
276
471
|
throw new TypeError();
|
|
277
472
|
return y(i) || (i = T(i)), Ot(s, i);
|
|
278
473
|
}
|
|
279
|
-
e("getMetadataKeys",
|
|
280
|
-
function
|
|
474
|
+
e("getMetadataKeys", ie);
|
|
475
|
+
function re(s, i) {
|
|
281
476
|
if (!O(s))
|
|
282
477
|
throw new TypeError();
|
|
283
478
|
return y(i) || (i = T(i)), Pt(s, i);
|
|
284
479
|
}
|
|
285
|
-
e("getOwnMetadataKeys",
|
|
286
|
-
function
|
|
480
|
+
e("getOwnMetadataKeys", re);
|
|
481
|
+
function oe(s, i, a) {
|
|
287
482
|
if (!O(i))
|
|
288
483
|
throw new TypeError();
|
|
289
484
|
if (y(a) || (a = T(a)), !O(i))
|
|
@@ -297,8 +492,8 @@ function Ae() {
|
|
|
297
492
|
);
|
|
298
493
|
return y(c) ? !1 : c.OrdinaryDeleteMetadata(s, i, a);
|
|
299
494
|
}
|
|
300
|
-
e("deleteMetadata",
|
|
301
|
-
function
|
|
495
|
+
e("deleteMetadata", oe);
|
|
496
|
+
function ae(s, i) {
|
|
302
497
|
for (var a = s.length - 1; a >= 0; --a) {
|
|
303
498
|
var c = s[a], v = c(i);
|
|
304
499
|
if (!y(v) && !A(v)) {
|
|
@@ -309,9 +504,9 @@ function Ae() {
|
|
|
309
504
|
}
|
|
310
505
|
return i;
|
|
311
506
|
}
|
|
312
|
-
function
|
|
507
|
+
function ce(s, i, a, c) {
|
|
313
508
|
for (var v = s.length - 1; v >= 0; --v) {
|
|
314
|
-
var
|
|
509
|
+
var C = s[v], P = C(i, a, c);
|
|
315
510
|
if (!y(P) && !A(P)) {
|
|
316
511
|
if (!O(P))
|
|
317
512
|
throw new TypeError();
|
|
@@ -334,7 +529,7 @@ function Ae() {
|
|
|
334
529
|
/*Create*/
|
|
335
530
|
!1
|
|
336
531
|
);
|
|
337
|
-
return y(c) ? !1 :
|
|
532
|
+
return y(c) ? !1 : jt(c.OrdinaryHasOwnMetadata(s, i, a));
|
|
338
533
|
}
|
|
339
534
|
function xt(s, i, a) {
|
|
340
535
|
var c = dt(s, i, a);
|
|
@@ -372,13 +567,13 @@ function Ae() {
|
|
|
372
567
|
return a;
|
|
373
568
|
if (a.length <= 0)
|
|
374
569
|
return v;
|
|
375
|
-
for (var
|
|
376
|
-
var h = u[w], d =
|
|
377
|
-
d || (
|
|
570
|
+
for (var C = new ut(), P = [], w = 0, u = a; w < u.length; w++) {
|
|
571
|
+
var h = u[w], d = C.has(h);
|
|
572
|
+
d || (C.add(h), P.push(h));
|
|
378
573
|
}
|
|
379
574
|
for (var f = 0, m = v; f < m.length; f++) {
|
|
380
|
-
var h = m[f], d =
|
|
381
|
-
d || (
|
|
575
|
+
var h = m[f], d = C.has(h);
|
|
576
|
+
d || (C.add(h), P.push(h));
|
|
382
577
|
}
|
|
383
578
|
return P;
|
|
384
579
|
}
|
|
@@ -391,7 +586,7 @@ function Ae() {
|
|
|
391
586
|
);
|
|
392
587
|
return a ? a.OrdinaryOwnMetadataKeys(s, i) : [];
|
|
393
588
|
}
|
|
394
|
-
function
|
|
589
|
+
function Ct(s) {
|
|
395
590
|
if (s === null)
|
|
396
591
|
return 1;
|
|
397
592
|
switch (typeof s) {
|
|
@@ -417,14 +612,14 @@ function Ae() {
|
|
|
417
612
|
function A(s) {
|
|
418
613
|
return s === null;
|
|
419
614
|
}
|
|
420
|
-
function
|
|
615
|
+
function le(s) {
|
|
421
616
|
return typeof s == "symbol";
|
|
422
617
|
}
|
|
423
618
|
function O(s) {
|
|
424
619
|
return typeof s == "object" ? s !== null : typeof s == "function";
|
|
425
620
|
}
|
|
426
|
-
function
|
|
427
|
-
switch (
|
|
621
|
+
function ue(s, i) {
|
|
622
|
+
switch (Ct(s)) {
|
|
428
623
|
case 0:
|
|
429
624
|
return s;
|
|
430
625
|
case 1:
|
|
@@ -445,9 +640,9 @@ function Ae() {
|
|
|
445
640
|
throw new TypeError();
|
|
446
641
|
return v;
|
|
447
642
|
}
|
|
448
|
-
return
|
|
643
|
+
return he(s);
|
|
449
644
|
}
|
|
450
|
-
function
|
|
645
|
+
function he(s, i) {
|
|
451
646
|
var a, c;
|
|
452
647
|
{
|
|
453
648
|
var v = s.toString;
|
|
@@ -465,15 +660,15 @@ function Ae() {
|
|
|
465
660
|
}
|
|
466
661
|
throw new TypeError();
|
|
467
662
|
}
|
|
468
|
-
function
|
|
663
|
+
function jt(s) {
|
|
469
664
|
return !!s;
|
|
470
665
|
}
|
|
471
|
-
function
|
|
666
|
+
function de(s) {
|
|
472
667
|
return "" + s;
|
|
473
668
|
}
|
|
474
669
|
function T(s) {
|
|
475
|
-
var i =
|
|
476
|
-
return
|
|
670
|
+
var i = ue(s);
|
|
671
|
+
return le(i) ? i : de(i);
|
|
477
672
|
}
|
|
478
673
|
function _t(s) {
|
|
479
674
|
return Array.isArray ? Array.isArray(s) : s instanceof Object ? s instanceof Array : Object.prototype.toString.call(s) === "[object Array]";
|
|
@@ -484,8 +679,8 @@ function Ae() {
|
|
|
484
679
|
function Et(s) {
|
|
485
680
|
return typeof s == "function";
|
|
486
681
|
}
|
|
487
|
-
function
|
|
488
|
-
switch (
|
|
682
|
+
function fe(s) {
|
|
683
|
+
switch (Ct(s)) {
|
|
489
684
|
case 3:
|
|
490
685
|
return !0;
|
|
491
686
|
case 4:
|
|
@@ -517,11 +712,11 @@ function Ae() {
|
|
|
517
712
|
function zt(s) {
|
|
518
713
|
return s.value;
|
|
519
714
|
}
|
|
520
|
-
function
|
|
715
|
+
function Rt(s) {
|
|
521
716
|
var i = s.next();
|
|
522
717
|
return i.done ? !1 : i;
|
|
523
718
|
}
|
|
524
|
-
function
|
|
719
|
+
function Dt(s) {
|
|
525
720
|
var i = s.return;
|
|
526
721
|
i && i.call(s);
|
|
527
722
|
}
|
|
@@ -535,17 +730,17 @@ function Ae() {
|
|
|
535
730
|
var v = c.constructor;
|
|
536
731
|
return typeof v != "function" || v === s ? i : v;
|
|
537
732
|
}
|
|
538
|
-
function
|
|
733
|
+
function ve() {
|
|
539
734
|
var s;
|
|
540
|
-
!y(L) && typeof n.Reflect < "u" && !(L in n.Reflect) && typeof n.Reflect.defineMetadata == "function" && (s =
|
|
541
|
-
var i, a, c, v = new ht(),
|
|
735
|
+
!y(L) && typeof n.Reflect < "u" && !(L in n.Reflect) && typeof n.Reflect.defineMetadata == "function" && (s = ge(n.Reflect));
|
|
736
|
+
var i, a, c, v = new ht(), C = {
|
|
542
737
|
registerProvider: P,
|
|
543
738
|
getProvider: u,
|
|
544
739
|
setProvider: d
|
|
545
740
|
};
|
|
546
|
-
return
|
|
741
|
+
return C;
|
|
547
742
|
function P(f) {
|
|
548
|
-
if (!Object.isExtensible(
|
|
743
|
+
if (!Object.isExtensible(C))
|
|
549
744
|
throw new Error("Cannot add provider to a frozen registry.");
|
|
550
745
|
switch (!0) {
|
|
551
746
|
case s === f:
|
|
@@ -574,12 +769,12 @@ function Ae() {
|
|
|
574
769
|
return i;
|
|
575
770
|
if (!y(c))
|
|
576
771
|
for (var x = Tt(c); ; ) {
|
|
577
|
-
var M =
|
|
772
|
+
var M = Rt(x);
|
|
578
773
|
if (!M)
|
|
579
774
|
return;
|
|
580
775
|
var I = zt(M);
|
|
581
776
|
if (I.isProviderFor(f, m))
|
|
582
|
-
return
|
|
777
|
+
return Dt(x), I;
|
|
583
778
|
}
|
|
584
779
|
}
|
|
585
780
|
}
|
|
@@ -608,16 +803,16 @@ function Ae() {
|
|
|
608
803
|
return !0;
|
|
609
804
|
}
|
|
610
805
|
}
|
|
611
|
-
function
|
|
806
|
+
function pe() {
|
|
612
807
|
var s;
|
|
613
|
-
return !y(L) && O(n.Reflect) && Object.isExtensible(n.Reflect) && (s = n.Reflect[L]), y(s) && (s =
|
|
808
|
+
return !y(L) && O(n.Reflect) && Object.isExtensible(n.Reflect) && (s = n.Reflect[L]), y(s) && (s = ve()), !y(L) && O(n.Reflect) && Object.isExtensible(n.Reflect) && Object.defineProperty(n.Reflect, L, {
|
|
614
809
|
enumerable: !1,
|
|
615
810
|
configurable: !1,
|
|
616
811
|
writable: !1,
|
|
617
812
|
value: s
|
|
618
813
|
}), s;
|
|
619
814
|
}
|
|
620
|
-
function
|
|
815
|
+
function ye(s) {
|
|
621
816
|
var i = new ht(), a = {
|
|
622
817
|
isProviderFor: function(h, d) {
|
|
623
818
|
var f = i.get(h);
|
|
@@ -625,7 +820,7 @@ function Ae() {
|
|
|
625
820
|
},
|
|
626
821
|
OrdinaryDefineOwnMetadata: P,
|
|
627
822
|
OrdinaryHasOwnMetadata: v,
|
|
628
|
-
OrdinaryGetOwnMetadata:
|
|
823
|
+
OrdinaryGetOwnMetadata: C,
|
|
629
824
|
OrdinaryOwnMetadataKeys: w,
|
|
630
825
|
OrdinaryDeleteMetadata: u
|
|
631
826
|
};
|
|
@@ -653,9 +848,9 @@ function Ae() {
|
|
|
653
848
|
/*Create*/
|
|
654
849
|
!1
|
|
655
850
|
);
|
|
656
|
-
return y(m) ? !1 :
|
|
851
|
+
return y(m) ? !1 : jt(m.has(h));
|
|
657
852
|
}
|
|
658
|
-
function
|
|
853
|
+
function C(h, d, f) {
|
|
659
854
|
var m = c(
|
|
660
855
|
d,
|
|
661
856
|
f,
|
|
@@ -684,17 +879,17 @@ function Ae() {
|
|
|
684
879
|
if (y(m))
|
|
685
880
|
return f;
|
|
686
881
|
for (var x = m.keys(), M = Tt(x), I = 0; ; ) {
|
|
687
|
-
var kt =
|
|
882
|
+
var kt = Rt(M);
|
|
688
883
|
if (!kt)
|
|
689
884
|
return f.length = I, f;
|
|
690
|
-
var
|
|
885
|
+
var xe = zt(kt);
|
|
691
886
|
try {
|
|
692
|
-
f[I] =
|
|
693
|
-
} catch (
|
|
887
|
+
f[I] = xe;
|
|
888
|
+
} catch (Se) {
|
|
694
889
|
try {
|
|
695
|
-
|
|
890
|
+
Dt(M);
|
|
696
891
|
} finally {
|
|
697
|
-
throw
|
|
892
|
+
throw Se;
|
|
698
893
|
}
|
|
699
894
|
}
|
|
700
895
|
I++;
|
|
@@ -716,8 +911,8 @@ function Ae() {
|
|
|
716
911
|
return !0;
|
|
717
912
|
}
|
|
718
913
|
}
|
|
719
|
-
function
|
|
720
|
-
var i = s.defineMetadata, a = s.hasOwnMetadata, c = s.getOwnMetadata, v = s.getOwnMetadataKeys,
|
|
914
|
+
function ge(s) {
|
|
915
|
+
var i = s.defineMetadata, a = s.hasOwnMetadata, c = s.getOwnMetadata, v = s.getOwnMetadataKeys, C = s.deleteMetadata, P = new ht(), w = {
|
|
721
916
|
isProviderFor: function(u, h) {
|
|
722
917
|
var d = P.get(u);
|
|
723
918
|
return !y(d) && d.has(h) ? !0 : v(u, h).length ? (y(d) && (d = new ut(), P.set(u, d)), d.add(h), !0) : !1;
|
|
@@ -726,7 +921,7 @@ function Ae() {
|
|
|
726
921
|
OrdinaryHasOwnMetadata: a,
|
|
727
922
|
OrdinaryGetOwnMetadata: c,
|
|
728
923
|
OrdinaryOwnMetadataKeys: v,
|
|
729
|
-
OrdinaryDeleteMetadata:
|
|
924
|
+
OrdinaryDeleteMetadata: C
|
|
730
925
|
};
|
|
731
926
|
return w;
|
|
732
927
|
}
|
|
@@ -740,7 +935,7 @@ function Ae() {
|
|
|
740
935
|
throw new Error("Illegal state.");
|
|
741
936
|
}
|
|
742
937
|
}
|
|
743
|
-
function
|
|
938
|
+
function we() {
|
|
744
939
|
var s = {}, i = [], a = (
|
|
745
940
|
/** @class */
|
|
746
941
|
(function() {
|
|
@@ -813,7 +1008,7 @@ function Ae() {
|
|
|
813
1008
|
}, w.prototype.keys = function() {
|
|
814
1009
|
return new a(this._keys, this._values, v);
|
|
815
1010
|
}, w.prototype.values = function() {
|
|
816
|
-
return new a(this._keys, this._values,
|
|
1011
|
+
return new a(this._keys, this._values, C);
|
|
817
1012
|
}, w.prototype.entries = function() {
|
|
818
1013
|
return new a(this._keys, this._values, P);
|
|
819
1014
|
}, w.prototype["@@iterator"] = function() {
|
|
@@ -837,14 +1032,14 @@ function Ae() {
|
|
|
837
1032
|
function v(w, u) {
|
|
838
1033
|
return w;
|
|
839
1034
|
}
|
|
840
|
-
function
|
|
1035
|
+
function C(w, u) {
|
|
841
1036
|
return u;
|
|
842
1037
|
}
|
|
843
1038
|
function P(w, u) {
|
|
844
1039
|
return [w, u];
|
|
845
1040
|
}
|
|
846
1041
|
}
|
|
847
|
-
function
|
|
1042
|
+
function me() {
|
|
848
1043
|
var s = (
|
|
849
1044
|
/** @class */
|
|
850
1045
|
(function() {
|
|
@@ -880,8 +1075,8 @@ function Ae() {
|
|
|
880
1075
|
);
|
|
881
1076
|
return s;
|
|
882
1077
|
}
|
|
883
|
-
function
|
|
884
|
-
var s = 16, i =
|
|
1078
|
+
function be() {
|
|
1079
|
+
var s = 16, i = D.create(), a = c();
|
|
885
1080
|
return (
|
|
886
1081
|
/** @class */
|
|
887
1082
|
(function() {
|
|
@@ -894,14 +1089,14 @@ function Ae() {
|
|
|
894
1089
|
/*create*/
|
|
895
1090
|
!1
|
|
896
1091
|
);
|
|
897
|
-
return d !== void 0 ?
|
|
1092
|
+
return d !== void 0 ? D.has(d, this._key) : !1;
|
|
898
1093
|
}, u.prototype.get = function(h) {
|
|
899
1094
|
var d = v(
|
|
900
1095
|
h,
|
|
901
1096
|
/*create*/
|
|
902
1097
|
!1
|
|
903
1098
|
);
|
|
904
|
-
return d !== void 0 ?
|
|
1099
|
+
return d !== void 0 ? D.get(d, this._key) : void 0;
|
|
905
1100
|
}, u.prototype.set = function(h, d) {
|
|
906
1101
|
var f = v(
|
|
907
1102
|
h,
|
|
@@ -925,18 +1120,18 @@ function Ae() {
|
|
|
925
1120
|
var u;
|
|
926
1121
|
do
|
|
927
1122
|
u = "@@WeakMap@@" + w();
|
|
928
|
-
while (
|
|
1123
|
+
while (D.has(i, u));
|
|
929
1124
|
return i[u] = !0, u;
|
|
930
1125
|
}
|
|
931
1126
|
function v(u, h) {
|
|
932
1127
|
if (!o.call(u, a)) {
|
|
933
1128
|
if (!h)
|
|
934
1129
|
return;
|
|
935
|
-
Object.defineProperty(u, a, { value:
|
|
1130
|
+
Object.defineProperty(u, a, { value: D.create() });
|
|
936
1131
|
}
|
|
937
1132
|
return u[a];
|
|
938
1133
|
}
|
|
939
|
-
function
|
|
1134
|
+
function C(u, h) {
|
|
940
1135
|
for (var d = 0; d < h; ++d)
|
|
941
1136
|
u[d] = Math.random() * 255 | 0;
|
|
942
1137
|
return u;
|
|
@@ -944,9 +1139,9 @@ function Ae() {
|
|
|
944
1139
|
function P(u) {
|
|
945
1140
|
if (typeof Uint8Array == "function") {
|
|
946
1141
|
var h = new Uint8Array(u);
|
|
947
|
-
return typeof crypto < "u" ? crypto.getRandomValues(h) : typeof msCrypto < "u" ? msCrypto.getRandomValues(h) :
|
|
1142
|
+
return typeof crypto < "u" ? crypto.getRandomValues(h) : typeof msCrypto < "u" ? msCrypto.getRandomValues(h) : C(h, u), h;
|
|
948
1143
|
}
|
|
949
|
-
return
|
|
1144
|
+
return C(new Array(u), u);
|
|
950
1145
|
}
|
|
951
1146
|
function w() {
|
|
952
1147
|
var u = P(s);
|
|
@@ -964,32 +1159,32 @@ function Ae() {
|
|
|
964
1159
|
});
|
|
965
1160
|
})(r || (r = {})), Vt;
|
|
966
1161
|
}
|
|
967
|
-
|
|
968
|
-
class
|
|
1162
|
+
He();
|
|
1163
|
+
class Nt extends Error {
|
|
969
1164
|
constructor() {
|
|
970
1165
|
super(...arguments), this.name = this.constructor.name;
|
|
971
1166
|
}
|
|
972
1167
|
}
|
|
973
|
-
class
|
|
1168
|
+
class Xe extends Nt {
|
|
974
1169
|
constructor(t, e) {
|
|
975
1170
|
super(`"${e}" not found in Mesh "${t}"`);
|
|
976
1171
|
}
|
|
977
1172
|
}
|
|
978
|
-
class At extends
|
|
1173
|
+
class At extends Nt {
|
|
979
1174
|
constructor(t) {
|
|
980
1175
|
super(`Invalid binding "${t}". Valid bindings are: string to constructor e.g. ("MyService", MyService) or abstract class to constructor e.g. (MyService, MyServiceImpl) orconstructor to self e.g. (MyService)`);
|
|
981
1176
|
}
|
|
982
1177
|
}
|
|
983
|
-
function
|
|
1178
|
+
function R(r) {
|
|
984
1179
|
return typeof r == "string" ? r : r.name;
|
|
985
1180
|
}
|
|
986
|
-
function
|
|
1181
|
+
function We(r) {
|
|
987
1182
|
return typeof r == "function" && r.prototype != null;
|
|
988
1183
|
}
|
|
989
|
-
function
|
|
990
|
-
return
|
|
1184
|
+
function Ze(r, ...t) {
|
|
1185
|
+
return We(r) ? new r(...t) : r(...t);
|
|
991
1186
|
}
|
|
992
|
-
const
|
|
1187
|
+
const Yt = /* @__PURE__ */ Symbol.for("MESH_REF");
|
|
993
1188
|
class at {
|
|
994
1189
|
constructor(t = "default", e = void 0) {
|
|
995
1190
|
this.name = t, this.parent = e, this.bindings = /* @__PURE__ */ new Map(), this.instances = /* @__PURE__ */ new Map(), this.middlewares = [], this.constant(at, this), this.injectRef(this);
|
|
@@ -1009,7 +1204,7 @@ class at {
|
|
|
1009
1204
|
return this.middlewares.push(t), this;
|
|
1010
1205
|
}
|
|
1011
1206
|
service(t, e) {
|
|
1012
|
-
const n =
|
|
1207
|
+
const n = R(t);
|
|
1013
1208
|
if (typeof e == "function")
|
|
1014
1209
|
return this.bindings.set(n, { type: "service", class: e }), this;
|
|
1015
1210
|
if (typeof t == "function")
|
|
@@ -1017,7 +1212,7 @@ class at {
|
|
|
1017
1212
|
throw new At(String(t));
|
|
1018
1213
|
}
|
|
1019
1214
|
scope(t, e) {
|
|
1020
|
-
const n =
|
|
1215
|
+
const n = R(t);
|
|
1021
1216
|
if (typeof e == "function")
|
|
1022
1217
|
return this.bindings.set(n, { type: "scope", factory: e }), this;
|
|
1023
1218
|
if (typeof t == "function")
|
|
@@ -1025,27 +1220,27 @@ class at {
|
|
|
1025
1220
|
throw new At(String(t));
|
|
1026
1221
|
}
|
|
1027
1222
|
constant(t, e) {
|
|
1028
|
-
const n =
|
|
1223
|
+
const n = R(t);
|
|
1029
1224
|
return this.bindings.set(n, { type: "constant", value: e }), this;
|
|
1030
1225
|
}
|
|
1031
1226
|
alias(t, e) {
|
|
1032
|
-
const n =
|
|
1227
|
+
const n = R(t), o = R(e);
|
|
1033
1228
|
return this.bindings.set(n, { type: "alias", key: o }), this;
|
|
1034
1229
|
}
|
|
1035
1230
|
delete(t) {
|
|
1036
|
-
const e =
|
|
1231
|
+
const e = R(t);
|
|
1037
1232
|
return this.bindings.delete(e), this;
|
|
1038
1233
|
}
|
|
1039
1234
|
resolve(t, e = !0) {
|
|
1040
1235
|
const n = this.tryResolve(t, e);
|
|
1041
1236
|
if (n === void 0) {
|
|
1042
|
-
const o =
|
|
1043
|
-
throw new
|
|
1237
|
+
const o = R(t);
|
|
1238
|
+
throw new Xe(this.name, o);
|
|
1044
1239
|
}
|
|
1045
1240
|
return n;
|
|
1046
1241
|
}
|
|
1047
1242
|
tryResolve(t, e = !0) {
|
|
1048
|
-
const n =
|
|
1243
|
+
const n = R(t);
|
|
1049
1244
|
let o = this.instances.get(n);
|
|
1050
1245
|
if (o)
|
|
1051
1246
|
return o;
|
|
@@ -1056,7 +1251,7 @@ class at {
|
|
|
1056
1251
|
return this.parent.tryResolve(t);
|
|
1057
1252
|
}
|
|
1058
1253
|
getBinding(t, e = !0) {
|
|
1059
|
-
const n =
|
|
1254
|
+
const n = R(t), o = this.bindings.get(n);
|
|
1060
1255
|
if (o)
|
|
1061
1256
|
return o;
|
|
1062
1257
|
if (e && this.parent)
|
|
@@ -1075,7 +1270,7 @@ class at {
|
|
|
1075
1270
|
e.type === "service" && (yield* this.traverseClassDeps(e.class, t));
|
|
1076
1271
|
}
|
|
1077
1272
|
*traverseClassDeps(t, e = /* @__PURE__ */ new Set()) {
|
|
1078
|
-
const n =
|
|
1273
|
+
const n = Je(t);
|
|
1079
1274
|
for (const o of n) {
|
|
1080
1275
|
if (e.has(o.key))
|
|
1081
1276
|
continue;
|
|
@@ -1096,7 +1291,7 @@ class at {
|
|
|
1096
1291
|
case "constant":
|
|
1097
1292
|
return t.value;
|
|
1098
1293
|
case "scope":
|
|
1099
|
-
return (n) =>
|
|
1294
|
+
return (n) => Ze(t.factory, n ?? this);
|
|
1100
1295
|
}
|
|
1101
1296
|
}
|
|
1102
1297
|
applyMiddleware(t) {
|
|
@@ -1106,31 +1301,31 @@ class at {
|
|
|
1106
1301
|
return this.parent && (e = this.parent.applyMiddleware(e)), e;
|
|
1107
1302
|
}
|
|
1108
1303
|
injectRef(t) {
|
|
1109
|
-
typeof t == "object" && Object.defineProperty(t,
|
|
1304
|
+
typeof t == "object" && Object.defineProperty(t, Yt, {
|
|
1110
1305
|
get: () => this,
|
|
1111
1306
|
enumerable: !1,
|
|
1112
1307
|
configurable: !0
|
|
1113
1308
|
});
|
|
1114
1309
|
}
|
|
1115
1310
|
}
|
|
1116
|
-
const
|
|
1117
|
-
function
|
|
1311
|
+
const qe = [];
|
|
1312
|
+
function Je(r) {
|
|
1118
1313
|
const t = [];
|
|
1119
1314
|
let e = r;
|
|
1120
1315
|
for (; e !== Object.prototype; ) {
|
|
1121
|
-
const n =
|
|
1316
|
+
const n = qe.filter((o) => o.class === e);
|
|
1122
1317
|
t.push(...n), e = Object.getPrototypeOf(e);
|
|
1123
1318
|
}
|
|
1124
1319
|
return t;
|
|
1125
1320
|
}
|
|
1126
|
-
const
|
|
1321
|
+
const Qe = Object.getOwnPropertyNames(Reflect);
|
|
1127
1322
|
function b(r, t, e = !0) {
|
|
1128
1323
|
let n;
|
|
1129
1324
|
const o = {};
|
|
1130
|
-
for (const l of
|
|
1325
|
+
for (const l of Qe)
|
|
1131
1326
|
o[l] = function(g, ...p) {
|
|
1132
1327
|
let S = n;
|
|
1133
|
-
return S || (S = r[
|
|
1328
|
+
return S || (S = r[Yt].resolve(t)), e && (n = S), Reflect[l](S, ...p);
|
|
1134
1329
|
};
|
|
1135
1330
|
return new Proxy(r, o);
|
|
1136
1331
|
}
|
|
@@ -1142,6 +1337,23 @@ class J {
|
|
|
1142
1337
|
Object.assign(this, t);
|
|
1143
1338
|
}
|
|
1144
1339
|
}
|
|
1340
|
+
class ct {
|
|
1341
|
+
constructor() {
|
|
1342
|
+
this.objects = /* @__PURE__ */ new Map();
|
|
1343
|
+
}
|
|
1344
|
+
register(t) {
|
|
1345
|
+
this.objects.set(t.objectId, t);
|
|
1346
|
+
}
|
|
1347
|
+
unregister(t) {
|
|
1348
|
+
this.objects.delete(t);
|
|
1349
|
+
}
|
|
1350
|
+
get(t) {
|
|
1351
|
+
return this.objects.get(t) ?? null;
|
|
1352
|
+
}
|
|
1353
|
+
getAll() {
|
|
1354
|
+
return [...this.objects.values()];
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1145
1357
|
class $ {
|
|
1146
1358
|
constructor() {
|
|
1147
1359
|
this._groups = /* @__PURE__ */ new Map();
|
|
@@ -1174,59 +1386,6 @@ class K {
|
|
|
1174
1386
|
this.mounted = new $(), this.unmounted = new $(), this.selectionChanged = new $(), this.dragMove = new $(), this.dragEnd = new $(), this.objectPosUpdated = new $();
|
|
1175
1387
|
}
|
|
1176
1388
|
}
|
|
1177
|
-
const yt = /* @__PURE__ */ new Map();
|
|
1178
|
-
function He(r) {
|
|
1179
|
-
return function(e) {
|
|
1180
|
-
return (n, o) => {
|
|
1181
|
-
const l = yt.get(r) || [];
|
|
1182
|
-
yt.set(r, l), l.push({
|
|
1183
|
-
target: n.constructor,
|
|
1184
|
-
memberName: o,
|
|
1185
|
-
metadata: e
|
|
1186
|
-
});
|
|
1187
|
-
};
|
|
1188
|
-
};
|
|
1189
|
-
}
|
|
1190
|
-
function Xe(r) {
|
|
1191
|
-
return yt.get(r) || [];
|
|
1192
|
-
}
|
|
1193
|
-
function We(r, t, e = !0) {
|
|
1194
|
-
const n = [], o = Xe(r), l = e ? t.allBindings() : t.bindings.entries();
|
|
1195
|
-
for (const [g, p] of l)
|
|
1196
|
-
if (p.type === "service")
|
|
1197
|
-
for (const { target: S, memberName: _, metadata: E } of o)
|
|
1198
|
-
(S === p.class || Object.prototype.isPrototypeOf.call(S, p.class)) && n.push({
|
|
1199
|
-
target: t.resolve(g),
|
|
1200
|
-
memberName: _,
|
|
1201
|
-
metadata: E
|
|
1202
|
-
});
|
|
1203
|
-
return n;
|
|
1204
|
-
}
|
|
1205
|
-
function Ze(r, t, e = !0, ...n) {
|
|
1206
|
-
return We(r, t, e).map((g) => g.target[g.memberName](...n));
|
|
1207
|
-
}
|
|
1208
|
-
const qt = He("init");
|
|
1209
|
-
async function Gt(r, t = !0) {
|
|
1210
|
-
const e = Ze("init", r, t);
|
|
1211
|
-
await Promise.all(e);
|
|
1212
|
-
}
|
|
1213
|
-
class ct {
|
|
1214
|
-
constructor() {
|
|
1215
|
-
this.objects = /* @__PURE__ */ new Map();
|
|
1216
|
-
}
|
|
1217
|
-
register(t) {
|
|
1218
|
-
this.objects.set(t.objectId, t);
|
|
1219
|
-
}
|
|
1220
|
-
unregister(t) {
|
|
1221
|
-
this.objects.delete(t);
|
|
1222
|
-
}
|
|
1223
|
-
get(t) {
|
|
1224
|
-
return this.objects.get(t) ?? null;
|
|
1225
|
-
}
|
|
1226
|
-
getAll() {
|
|
1227
|
-
return [...this.objects.values()];
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
1389
|
class Q {
|
|
1231
1390
|
constructor() {
|
|
1232
1391
|
this.selectedIds = /* @__PURE__ */ new Set(), this.events = b(this, K);
|
|
@@ -1302,12 +1461,82 @@ class Q {
|
|
|
1302
1461
|
this.removeFromSelection(t);
|
|
1303
1462
|
}
|
|
1304
1463
|
}
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1464
|
+
function z(r, t, e) {
|
|
1465
|
+
return Math.max(t, Math.min(e, r));
|
|
1466
|
+
}
|
|
1467
|
+
function Ht(r, t) {
|
|
1468
|
+
return {
|
|
1469
|
+
x: r.x - t.x,
|
|
1470
|
+
y: r.y - t.y
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
function ts(r) {
|
|
1474
|
+
const [t, e] = r;
|
|
1475
|
+
return {
|
|
1476
|
+
x: (e.x - t.x) * 0.5 + t.x,
|
|
1477
|
+
y: (e.y - t.y) * 0.5 + t.y
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
function Xt(r, t, e) {
|
|
1481
|
+
const n = r ?? document.documentElement;
|
|
1482
|
+
return getComputedStyle(n).getPropertyValue(t).trim() || e;
|
|
1483
|
+
}
|
|
1484
|
+
function W(r, t, e) {
|
|
1485
|
+
const n = Xt(r, t, String(e)), o = Number(n.replace(/px|em|%|vh|vw/g, ""));
|
|
1486
|
+
return Number.isFinite(o) ? o : e;
|
|
1487
|
+
}
|
|
1488
|
+
function Gt(r, t, e) {
|
|
1489
|
+
const n = r ?? document.documentElement, o = Xt(r, t, e), l = document.createElement("span");
|
|
1490
|
+
l.style.position = "absolute", l.style.visibility = "hidden", l.style.pointerEvents = "none", l.style.color = e, l.style.color = o, n.appendChild(l);
|
|
1491
|
+
const g = getComputedStyle(l).color.trim();
|
|
1492
|
+
return l.remove(), g || e;
|
|
1493
|
+
}
|
|
1494
|
+
class Wt {
|
|
1495
|
+
constructor(t) {
|
|
1496
|
+
this.target = t, this.entries = [];
|
|
1308
1497
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1498
|
+
add(t, e, n) {
|
|
1499
|
+
this.target.addEventListener(t, e, n), this.entries.push({ type: t, listener: e, options: n });
|
|
1500
|
+
}
|
|
1501
|
+
removeAll() {
|
|
1502
|
+
for (const t of this.entries)
|
|
1503
|
+
this.target.removeEventListener(t.type, t.listener, t.options);
|
|
1504
|
+
this.entries = [];
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
function es(r, t, e, n = 2, o, l = 1) {
|
|
1508
|
+
const g = [0, ...ss(r, t), r], p = [0, r], S = [
|
|
1509
|
+
`<svg xmlns="http://www.w3.org/2000/svg"
|
|
1510
|
+
width="${r}"
|
|
1511
|
+
height="${r}"
|
|
1512
|
+
viewBox="0 0 ${r} ${r}">`
|
|
1513
|
+
];
|
|
1514
|
+
if (l)
|
|
1515
|
+
for (const _ of g)
|
|
1516
|
+
for (const E of g)
|
|
1517
|
+
S.push(
|
|
1518
|
+
`<circle cx="${_}" cy="${E}" r="${l}" fill="${o}"/>`
|
|
1519
|
+
);
|
|
1520
|
+
if (n)
|
|
1521
|
+
for (const _ of p)
|
|
1522
|
+
for (const E of p)
|
|
1523
|
+
S.push(
|
|
1524
|
+
`<circle cx="${_}" cy="${E}" r="${n}" fill="${e}"/>`
|
|
1525
|
+
);
|
|
1526
|
+
return S.push("</svg>"), S.join("");
|
|
1527
|
+
}
|
|
1528
|
+
function ss(r, t) {
|
|
1529
|
+
const e = [], n = Math.round(r / t);
|
|
1530
|
+
for (let o = 1; o < t; o++)
|
|
1531
|
+
e.push(n * o);
|
|
1532
|
+
return e;
|
|
1533
|
+
}
|
|
1534
|
+
class V {
|
|
1535
|
+
constructor() {
|
|
1536
|
+
this.zoom = 1, this.cellSize = 32, this.scrollPos = { x: 0, y: 0 }, this.viewportBox = [{ x: 0, y: 0 }, { x: 0, y: 0 }], this.canvasOrigin = { x: 0, y: 0 }, this.canvasSize = { x: 0, y: 0 };
|
|
1537
|
+
}
|
|
1538
|
+
localToCanvas(t) {
|
|
1539
|
+
return {
|
|
1311
1540
|
x: t.x * this.cellSize + this.canvasOrigin.x,
|
|
1312
1541
|
y: t.y * this.cellSize + this.canvasOrigin.y
|
|
1313
1542
|
};
|
|
@@ -1349,14 +1578,118 @@ class V {
|
|
|
1349
1578
|
return this.canvasToLocal(this.pageToCanvas(t));
|
|
1350
1579
|
}
|
|
1351
1580
|
getViewportCenterInLocal() {
|
|
1352
|
-
const t =
|
|
1581
|
+
const t = ts(this.viewportBox), e = this.pageToViewport(t);
|
|
1353
1582
|
return this.viewportToLocal(e);
|
|
1354
1583
|
}
|
|
1355
1584
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1585
|
+
class $t {
|
|
1586
|
+
constructor() {
|
|
1587
|
+
this.config = b(this, J), this.inputStateManager = b(this, rt), this.objectRegistry = b(this, ct), this.selection = b(this, Q), this.space = b(this, V), this.selectionOriginPos = null, this.initialSelectionIds = /* @__PURE__ */ new Set(), this.objectBoxes = [];
|
|
1588
|
+
}
|
|
1589
|
+
isSelecting() {
|
|
1590
|
+
return this.selectionOriginPos != null;
|
|
1591
|
+
}
|
|
1592
|
+
onUiDragStart(t) {
|
|
1593
|
+
this.config.allowMultiSelect && (this.isSelecting() || (this.selectionOriginPos = { x: t.pageX, y: t.pageY }, t.shiftKey ? this.initialSelectionIds = new Set(this.selection.getSelectedIds()) : (this.initialSelectionIds.clear(), this.selection.deselectAll()), this.captureObjectBoxes()));
|
|
1594
|
+
}
|
|
1595
|
+
onUiDragMove(t) {
|
|
1596
|
+
this.isSelecting() && (t.preventDefault(), this.updateSelection(t));
|
|
1597
|
+
}
|
|
1598
|
+
onUiDragEnd(t) {
|
|
1599
|
+
this.isSelecting() && this.updateSelection(t), this.stopSelecting();
|
|
1600
|
+
}
|
|
1601
|
+
getSelectionBox() {
|
|
1602
|
+
return this.selectionOriginPos ? nt(
|
|
1603
|
+
this.space.pageToLocal(this.selectionOriginPos),
|
|
1604
|
+
this.space.pageToLocal(this.inputStateManager.lastMousePos)
|
|
1605
|
+
) : null;
|
|
1606
|
+
}
|
|
1607
|
+
getSelectionStyle() {
|
|
1608
|
+
if (!this.selectionOriginPos)
|
|
1609
|
+
return null;
|
|
1610
|
+
const t = nt(this.selectionOriginPos, this.inputStateManager.lastMousePos), e = this.space.pageToCanvas(t[0]), n = this.space.pageToCanvas(t[1]);
|
|
1611
|
+
return {
|
|
1612
|
+
left: `${e.x}px`,
|
|
1613
|
+
top: `${e.y}px`,
|
|
1614
|
+
width: `${n.x - e.x}px`,
|
|
1615
|
+
height: `${n.y - e.y}px`
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
stopSelecting() {
|
|
1619
|
+
this.selectionOriginPos = null, this.initialSelectionIds.clear(), this.objectBoxes = [];
|
|
1620
|
+
}
|
|
1621
|
+
captureObjectBoxes() {
|
|
1622
|
+
this.objectBoxes = [];
|
|
1623
|
+
const t = this.space.viewportBox;
|
|
1624
|
+
for (const e of this.objectRegistry.getAll()) {
|
|
1625
|
+
if (!e.isSelectable())
|
|
1626
|
+
continue;
|
|
1627
|
+
const n = e.element;
|
|
1628
|
+
if (!n)
|
|
1629
|
+
continue;
|
|
1630
|
+
const o = n.getBoundingClientRect(), l = nt(
|
|
1631
|
+
{ x: o.left, y: o.top },
|
|
1632
|
+
{ x: o.right, y: o.bottom }
|
|
1633
|
+
);
|
|
1634
|
+
if (!Bt(l, t))
|
|
1635
|
+
continue;
|
|
1636
|
+
const g = nt(
|
|
1637
|
+
this.space.pageToLocal(l[0]),
|
|
1638
|
+
this.space.pageToLocal(l[1])
|
|
1639
|
+
);
|
|
1640
|
+
this.objectBoxes.push([e.objectId, g]);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
updateSelection(t) {
|
|
1644
|
+
const e = this.getSelectionBox();
|
|
1645
|
+
if (!e)
|
|
1646
|
+
return;
|
|
1647
|
+
const n = new Set(this.initialSelectionIds);
|
|
1648
|
+
for (const [o, l] of this.objectBoxes)
|
|
1649
|
+
Bt(e, l) && n.add(o);
|
|
1650
|
+
this.selection.setSelectedIds(n);
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
const yt = /* @__PURE__ */ new Map();
|
|
1654
|
+
function ns(r) {
|
|
1655
|
+
return function(e) {
|
|
1656
|
+
return (n, o) => {
|
|
1657
|
+
const l = yt.get(r) || [];
|
|
1658
|
+
yt.set(r, l), l.push({
|
|
1659
|
+
target: n.constructor,
|
|
1660
|
+
memberName: o,
|
|
1661
|
+
metadata: e
|
|
1662
|
+
});
|
|
1663
|
+
};
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
function is(r) {
|
|
1667
|
+
return yt.get(r) || [];
|
|
1668
|
+
}
|
|
1669
|
+
function rs(r, t, e = !0) {
|
|
1670
|
+
const n = [], o = is(r), l = e ? t.allBindings() : t.bindings.entries();
|
|
1671
|
+
for (const [g, p] of l)
|
|
1672
|
+
if (p.type === "service")
|
|
1673
|
+
for (const { target: S, memberName: _, metadata: E } of o)
|
|
1674
|
+
(S === p.class || Object.prototype.isPrototypeOf.call(S, p.class)) && n.push({
|
|
1675
|
+
target: t.resolve(g),
|
|
1676
|
+
memberName: _,
|
|
1677
|
+
metadata: E
|
|
1678
|
+
});
|
|
1679
|
+
return n;
|
|
1680
|
+
}
|
|
1681
|
+
function os(r, t, e = !0, ...n) {
|
|
1682
|
+
return rs(r, t, e).map((g) => g.target[g.memberName](...n));
|
|
1683
|
+
}
|
|
1684
|
+
const Zt = ns("init");
|
|
1685
|
+
async function as(r, t = !0) {
|
|
1686
|
+
const e = os("init", r, t);
|
|
1687
|
+
await Promise.all(e);
|
|
1688
|
+
}
|
|
1689
|
+
var cs = Object.defineProperty, ls = Object.getOwnPropertyDescriptor, us = (r, t, e, n) => {
|
|
1690
|
+
for (var o = ls(t, e), l = r.length - 1, g; l >= 0; l--)
|
|
1358
1691
|
(g = r[l]) && (o = g(t, e, o) || o);
|
|
1359
|
-
return o &&
|
|
1692
|
+
return o && cs(t, e, o), o;
|
|
1360
1693
|
};
|
|
1361
1694
|
class wt {
|
|
1362
1695
|
constructor() {
|
|
@@ -1376,7 +1709,7 @@ class wt {
|
|
|
1376
1709
|
onDragMove(t) {
|
|
1377
1710
|
if (!this.moveOriginPos)
|
|
1378
1711
|
return;
|
|
1379
|
-
const e = this.space.pageToLocal(this.moveOriginPos), n = this.space.pageToLocal({ x: t.pageX, y: t.pageY }), o =
|
|
1712
|
+
const e = this.space.pageToLocal(this.moveOriginPos), n = this.space.pageToLocal({ x: t.pageX, y: t.pageY }), o = Ht(n, e);
|
|
1380
1713
|
for (const l of this.movingIds)
|
|
1381
1714
|
this.objectRegistry.get(l)?.onMoveOffset(o);
|
|
1382
1715
|
}
|
|
@@ -1386,10 +1719,10 @@ class wt {
|
|
|
1386
1719
|
this.movingIds.clear(), this.moveOriginPos = null;
|
|
1387
1720
|
}
|
|
1388
1721
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1722
|
+
us([
|
|
1723
|
+
Zt()
|
|
1391
1724
|
], wt.prototype, "init");
|
|
1392
|
-
class
|
|
1725
|
+
class hs {
|
|
1393
1726
|
constructor(t) {
|
|
1394
1727
|
this.config = b(this, J), this.events = b(this, K), this.selection = b(this, Q), this.move = b(this, wt), this.space = b(this, V), this.element = null, this.selectable = !0, this.movable = !0, this.snapToGrid = !0, this.resizable = "none", this.bounds = [{ x: 1, y: 1 }, { x: 10, y: 10 }], this.pos = { x: 0, y: 0 }, this.localPos = { x: 0, y: 0, w: 1, h: 1 }, this.prevLocalPos = { x: 0, y: 0, w: 1, h: 1 }, this.resizingDirection = null, this.resizingBounds = [{ x: 0, y: 0 }, { x: 0, y: 0 }], this.objectId = t;
|
|
1395
1728
|
}
|
|
@@ -1438,525 +1771,191 @@ class ts {
|
|
|
1438
1771
|
setResizable(t) {
|
|
1439
1772
|
this.resizable = t;
|
|
1440
1773
|
}
|
|
1441
|
-
/* Render state */
|
|
1442
|
-
getCanvasCoords() {
|
|
1443
|
-
const t = this.space.localToCanvas({ x: this.localPos.x, y: this.localPos.y }), e = this.space.localToCanvas({
|
|
1444
|
-
x: this.localPos.x + this.localPos.w,
|
|
1445
|
-
y: this.localPos.y + this.localPos.h
|
|
1446
|
-
}), n =
|
|
1447
|
-
return {
|
|
1448
|
-
x: t.x,
|
|
1449
|
-
y: t.y,
|
|
1450
|
-
w: o,
|
|
1451
|
-
h: l
|
|
1452
|
-
};
|
|
1453
|
-
}
|
|
1454
|
-
getStyle() {
|
|
1455
|
-
const t = this.getCanvasCoords();
|
|
1456
|
-
return {
|
|
1457
|
-
position: "absolute",
|
|
1458
|
-
left: `${t.x}px`,
|
|
1459
|
-
top: `${t.y}px`,
|
|
1460
|
-
width: t.w === void 0 ? void 0 : `${t.w}px`,
|
|
1461
|
-
height: t.h === void 0 ? void 0 : `${t.h}px`
|
|
1462
|
-
};
|
|
1463
|
-
}
|
|
1464
|
-
isMoving() {
|
|
1465
|
-
return this.move.isMoving(this.objectId);
|
|
1466
|
-
}
|
|
1467
|
-
isResizing() {
|
|
1468
|
-
return this.resizingDirection != null;
|
|
1469
|
-
}
|
|
1470
|
-
commitNewPos(t) {
|
|
1471
|
-
Object.assign(this.pos, t), this.events.objectPosUpdated.emit({
|
|
1472
|
-
objectId: this.objectId,
|
|
1473
|
-
pos: { ...this.pos }
|
|
1474
|
-
});
|
|
1475
|
-
}
|
|
1476
|
-
// Event handlers
|
|
1477
|
-
/**
|
|
1478
|
-
* Click handles selection
|
|
1479
|
-
* Shift/Ctrl/Meta key allows multi-select, if allowed by canvas config
|
|
1480
|
-
*/
|
|
1481
|
-
onUiClick(t) {
|
|
1482
|
-
if (!this.selectable)
|
|
1483
|
-
return;
|
|
1484
|
-
const e = t.shiftKey || t.ctrlKey || t.metaKey;
|
|
1485
|
-
if (this.config.allowMultiSelect && e) {
|
|
1486
|
-
this.selection.toggleSelection(this.objectId);
|
|
1487
|
-
return;
|
|
1488
|
-
}
|
|
1489
|
-
this.selection.selectSingle(this.objectId);
|
|
1490
|
-
}
|
|
1491
|
-
/**
|
|
1492
|
-
* Dragging starts moving selected objects, if allowed.
|
|
1493
|
-
* If not selected, single selection is performed first, then dragging starts.
|
|
1494
|
-
*/
|
|
1495
|
-
onUiDragStart(t) {
|
|
1496
|
-
this.movable && (this.isSelected() || (t.shiftKey ? this.selection.addToSelection(this.objectId) : this.selection.selectSingle(this.objectId)), !this.isResizing() && !this.isMoving() && this.move.startMovingSelection(t));
|
|
1497
|
-
}
|
|
1498
|
-
/**
|
|
1499
|
-
* Drag move is re-emitted to global canvas events, so that each selected object moves.
|
|
1500
|
-
* CanvasMove will call onMoveOffset on objects that are currently moving.
|
|
1501
|
-
*/
|
|
1502
|
-
onUiDragMove(t) {
|
|
1503
|
-
this.events.dragMove.emit(t);
|
|
1504
|
-
}
|
|
1505
|
-
/**
|
|
1506
|
-
* Drag end is re-emitted to global canvas events, so that each selected object stops moving.
|
|
1507
|
-
* CanvasMove will call onMoveEnd on objects that are currently moving.
|
|
1508
|
-
*/
|
|
1509
|
-
onUiDragEnd(t) {
|
|
1510
|
-
this.events.dragEnd.emit(t);
|
|
1511
|
-
}
|
|
1512
|
-
/* Moving */
|
|
1513
|
-
/**
|
|
1514
|
-
* Move start is called by CanvasMove when selected objects starts moving.
|
|
1515
|
-
* It saves the previous local position, so that the offset can be calculated.
|
|
1516
|
-
*/
|
|
1517
|
-
onMoveStart() {
|
|
1518
|
-
this.prevLocalPos = { ...this.localPos };
|
|
1519
|
-
}
|
|
1520
|
-
/**
|
|
1521
|
-
* Move offset is called by CanvasMove when selected objects moves.
|
|
1522
|
-
* It calculates the new local position based on the previous local position and the offset.
|
|
1523
|
-
*/
|
|
1524
|
-
onMoveOffset(t) {
|
|
1525
|
-
this.movable && (this.localPos = {
|
|
1526
|
-
x: this.prevLocalPos.x + t.x,
|
|
1527
|
-
y: this.prevLocalPos.y + t.y,
|
|
1528
|
-
w: this.prevLocalPos.w,
|
|
1529
|
-
h: this.prevLocalPos.h
|
|
1530
|
-
});
|
|
1531
|
-
}
|
|
1532
|
-
/**
|
|
1533
|
-
* Move end is called by CanvasMove when selected objects stops moving.
|
|
1534
|
-
* It commits the new local position to the object.
|
|
1535
|
-
*/
|
|
1536
|
-
onMoveEnd() {
|
|
1537
|
-
this.commitNewPos({
|
|
1538
|
-
x: this.maybeRound(this.localPos.x),
|
|
1539
|
-
y: this.maybeRound(this.localPos.y)
|
|
1540
|
-
});
|
|
1541
|
-
}
|
|
1542
|
-
/* Resizing */
|
|
1543
|
-
startResizing(t) {
|
|
1544
|
-
this.resizable === "none" || !this.canResizeInDirection(t) || (this.resizingDirection = t, this.resizingBounds = this.getObjectBounds(), this.selection.selectSingle(this.objectId));
|
|
1545
|
-
}
|
|
1546
|
-
onResizeMove(t) {
|
|
1547
|
-
if (!this.resizingDirection)
|
|
1548
|
-
return;
|
|
1549
|
-
const e = { x: t.pageX, y: t.pageY }, n = this.space.pageToLocal(e), [o, l] = this.getResizingUpdates(this.resizingDirection, n);
|
|
1550
|
-
this.localPos = {
|
|
1551
|
-
x: o.x,
|
|
1552
|
-
y: o.y,
|
|
1553
|
-
w: l.x - o.x,
|
|
1554
|
-
h: l.y - o.y
|
|
1555
|
-
};
|
|
1556
|
-
}
|
|
1557
|
-
onResizeEnd() {
|
|
1558
|
-
this.resizingDirection && (this.commitNewPos({
|
|
1559
|
-
x: this.maybeRound(this.localPos.x),
|
|
1560
|
-
y: this.maybeRound(this.localPos.y),
|
|
1561
|
-
w: z(this.maybeRound(this.localPos.w), this.bounds[0].x, this.bounds[1].x),
|
|
1562
|
-
h: z(this.maybeRound(this.localPos.h), this.bounds[0].y, this.bounds[1].y)
|
|
1563
|
-
}), this.resizingDirection = null);
|
|
1564
|
-
}
|
|
1565
|
-
getResizeDirections() {
|
|
1566
|
-
switch (this.resizable) {
|
|
1567
|
-
case "both":
|
|
1568
|
-
return ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
|
|
1569
|
-
case "horizontal":
|
|
1570
|
-
return ["e", "w"];
|
|
1571
|
-
case "vertical":
|
|
1572
|
-
return ["n", "s"];
|
|
1573
|
-
default:
|
|
1574
|
-
return [];
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
getObjectBounds() {
|
|
1578
|
-
const t = { x: this.localPos.x, y: this.localPos.y }, e = {
|
|
1579
|
-
x: this.localPos.x + this.localPos.w,
|
|
1580
|
-
y: this.localPos.y + this.localPos.h
|
|
1581
|
-
};
|
|
1582
|
-
return [t, e];
|
|
1583
|
-
}
|
|
1584
|
-
canResizeInDirection(t) {
|
|
1585
|
-
return this.getResizeDirections().includes(t);
|
|
1586
|
-
}
|
|
1587
|
-
recalcLocalPos() {
|
|
1588
|
-
const t = this.pos.w ?? this.localPos.w, e = this.pos.h ?? this.localPos.h;
|
|
1589
|
-
this.localPos = {
|
|
1590
|
-
x: this.pos.x,
|
|
1591
|
-
y: this.pos.y,
|
|
1592
|
-
w: z(t, this.bounds[0].x, this.bounds[1].x),
|
|
1593
|
-
h: z(e, this.bounds[0].y, this.bounds[1].y)
|
|
1594
|
-
};
|
|
1595
|
-
}
|
|
1596
|
-
maybeRound(t) {
|
|
1597
|
-
return this.snapToGrid ? Math.round(t) : t;
|
|
1598
|
-
}
|
|
1599
|
-
getResizingUpdates(t, e) {
|
|
1600
|
-
const [n, o] = this.resizingBounds, l = z(e.x, o.x - this.bounds[1].x, o.x - this.bounds[0].x), g = z(e.x, n.x + this.bounds[0].x, n.x + this.bounds[1].x), p = z(e.y, o.y - this.bounds[1].y, o.y - this.bounds[0].y), S = z(e.y, n.y + this.bounds[0].y, n.y + this.bounds[1].y);
|
|
1601
|
-
switch (t) {
|
|
1602
|
-
case "n":
|
|
1603
|
-
return [{ x: n.x, y: p }, { x: o.x, y: o.y }];
|
|
1604
|
-
case "s":
|
|
1605
|
-
return [{ x: n.x, y: n.y }, { x: o.x, y: S }];
|
|
1606
|
-
case "w":
|
|
1607
|
-
return [{ x: l, y: n.y }, { x: o.x, y: o.y }];
|
|
1608
|
-
case "e":
|
|
1609
|
-
return [{ x: n.x, y: n.y }, { x: g, y: o.y }];
|
|
1610
|
-
case "ne":
|
|
1611
|
-
return [{ x: n.x, y: p }, { x: g, y: o.y }];
|
|
1612
|
-
case "nw":
|
|
1613
|
-
return [{ x: l, y: p }, { x: o.x, y: o.y }];
|
|
1614
|
-
case "se":
|
|
1615
|
-
return [{ x: n.x, y: n.y }, { x: g, y: S }];
|
|
1616
|
-
case "sw":
|
|
1617
|
-
return [{ x: l, y: n.y }, { x: o.x, y: S }];
|
|
1618
|
-
default:
|
|
1619
|
-
return [{ x: n.x, y: n.y }, { x: o.x, y: o.y }];
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
const es = {
|
|
1624
|
-
props: {
|
|
1625
|
-
canvasObject: { type: Object, required: !0 },
|
|
1626
|
-
direction: { type: String, required: !0 }
|
|
1627
|
-
}
|
|
1628
|
-
};
|
|
1629
|
-
function ss(r, t, e, n, o, l) {
|
|
1630
|
-
return U(), q("div", {
|
|
1631
|
-
class: Pe(["ResizeHandle", `ResizeHandle-${e.direction}`]),
|
|
1632
|
-
onUidragstart: t[0] || (t[0] = B((g) => e.canvasObject.startResizing(e.direction), ["stop", "prevent"])),
|
|
1633
|
-
onUidragmove: t[1] || (t[1] = B((...g) => e.canvasObject.onResizeMove && e.canvasObject.onResizeMove(...g), ["stop", "prevent"])),
|
|
1634
|
-
onUidragend: t[2] || (t[2] = B((...g) => e.canvasObject.onResizeEnd && e.canvasObject.onResizeEnd(...g), ["stop", "prevent"]))
|
|
1635
|
-
}, null, 34);
|
|
1636
|
-
}
|
|
1637
|
-
const ns = /* @__PURE__ */ tt(es, [["render", ss], ["__scopeId", "data-v-c83350e5"]]), is = {
|
|
1638
|
-
components: {
|
|
1639
|
-
CanvasObjectResize: ns
|
|
1640
|
-
},
|
|
1641
|
-
props: {
|
|
1642
|
-
canvas: { type: Object, required: !0 },
|
|
1643
|
-
objectId: { type: String, required: !0 },
|
|
1644
|
-
pos: { type: Object, required: !0 },
|
|
1645
|
-
isSelected: { type: Boolean, default: !1 },
|
|
1646
|
-
selectable: { type: Boolean, default: !0 },
|
|
1647
|
-
movable: { type: Boolean, default: !0 },
|
|
1648
|
-
snapToGrid: { type: Boolean, default: !0 },
|
|
1649
|
-
resizable: { type: String, default: "none" },
|
|
1650
|
-
bounds: { type: Array }
|
|
1651
|
-
},
|
|
1652
|
-
emits: [
|
|
1653
|
-
"update:pos",
|
|
1654
|
-
"update:isSelected"
|
|
1655
|
-
],
|
|
1656
|
-
data() {
|
|
1657
|
-
return {
|
|
1658
|
-
canvasObject: null
|
|
1659
|
-
};
|
|
1660
|
-
},
|
|
1661
|
-
computed: {
|
|
1662
|
-
coords() {
|
|
1663
|
-
return this.canvasObject.getCanvasCoords();
|
|
1664
|
-
},
|
|
1665
|
-
slotProps() {
|
|
1666
|
-
return {
|
|
1667
|
-
canvas: this.canvas,
|
|
1668
|
-
objectId: this.objectId,
|
|
1669
|
-
isSelected: this.canvas.selection.isSelected(this.objectId),
|
|
1670
|
-
coords: this.coords,
|
|
1671
|
-
pos: this.pos
|
|
1672
|
-
};
|
|
1673
|
-
},
|
|
1674
|
-
resizeDirections() {
|
|
1675
|
-
return this.canvasObject.getResizeDirections();
|
|
1676
|
-
}
|
|
1677
|
-
},
|
|
1678
|
-
watch: {
|
|
1679
|
-
pos(r) {
|
|
1680
|
-
this.canvasObject.setPos(r);
|
|
1681
|
-
},
|
|
1682
|
-
isSelected(r) {
|
|
1683
|
-
this.canvasObject.setSelected(r);
|
|
1684
|
-
},
|
|
1685
|
-
selectable(r) {
|
|
1686
|
-
this.canvasObject.setSelectable(r);
|
|
1687
|
-
},
|
|
1688
|
-
movable(r) {
|
|
1689
|
-
this.canvasObject.setMovable(r);
|
|
1690
|
-
},
|
|
1691
|
-
snapToGrid(r) {
|
|
1692
|
-
this.canvasObject.setSnapToGrid(r);
|
|
1693
|
-
},
|
|
1694
|
-
resizable(r) {
|
|
1695
|
-
this.canvasObject.setResizable(r);
|
|
1696
|
-
},
|
|
1697
|
-
bounds(r) {
|
|
1698
|
-
this.canvasObject.setBounds(r);
|
|
1699
|
-
}
|
|
1700
|
-
},
|
|
1701
|
-
created() {
|
|
1702
|
-
this.canvasObject = new ts(this.objectId), this.canvas.mesh.connect(this.canvasObject), this.canvas.events.objectPosUpdated.on(({ objectId: r, pos: t }) => {
|
|
1703
|
-
r === this.objectId && this.$emit("update:pos", t);
|
|
1704
|
-
}, this), this.canvas.events.selectionChanged.on((r) => {
|
|
1705
|
-
const t = r.includes(this.objectId);
|
|
1706
|
-
this.isSelected !== t && this.$emit("update:isSelected", t);
|
|
1707
|
-
}, this);
|
|
1708
|
-
},
|
|
1709
|
-
mounted() {
|
|
1710
|
-
const r = this.canvasObject;
|
|
1711
|
-
this.canvas.objectRegistry.register(r), r.setElement(this.$refs.rootEl), r.setPos(this.pos), r.setSelectable(this.selectable), r.setMovable(this.movable), r.setSnapToGrid(this.snapToGrid), r.setResizable(this.resizable), r.setBounds(this.bounds), r.setSelected(this.isSelected);
|
|
1712
|
-
},
|
|
1713
|
-
unmounted() {
|
|
1714
|
-
this.canvas.objectRegistry.unregister(this.objectId), this.canvasObject.setElement(null), this.canvas.selection.removeFromSelection(this.objectId), this.canvas.events.objectPosUpdated.removeAll(this), this.canvas.events.selectionChanged.removeAll(this);
|
|
1715
|
-
}
|
|
1716
|
-
};
|
|
1717
|
-
function rs(r, t, e, n, o, l) {
|
|
1718
|
-
const g = ot("CanvasObjectResize");
|
|
1719
|
-
return U(), q("div", {
|
|
1720
|
-
ref: "rootEl",
|
|
1721
|
-
class: "CanvasObject",
|
|
1722
|
-
style: Z(o.canvasObject.getStyle()),
|
|
1723
|
-
onUiclick: t[0] || (t[0] = B((...p) => o.canvasObject.onUiClick && o.canvasObject.onUiClick(...p), ["stop", "prevent"])),
|
|
1724
|
-
onUidragstart: t[1] || (t[1] = B((...p) => o.canvasObject.onUiDragStart && o.canvasObject.onUiDragStart(...p), ["stop", "prevent"])),
|
|
1725
|
-
onUidragmove: t[2] || (t[2] = B((...p) => o.canvasObject.onUiDragMove && o.canvasObject.onUiDragMove(...p), ["stop", "prevent"])),
|
|
1726
|
-
onUidragend: t[3] || (t[3] = B((...p) => o.canvasObject.onUiDragEnd && o.canvasObject.onUiDragEnd(...p), ["stop", "prevent"]))
|
|
1727
|
-
}, [
|
|
1728
|
-
it(r.$slots, "default", je(Ce(l.slotProps))),
|
|
1729
|
-
(U(!0), q(_e, null, Ee(l.resizeDirections, (p) => (U(), Nt(g, {
|
|
1730
|
-
key: p,
|
|
1731
|
-
canvasObject: o.canvasObject,
|
|
1732
|
-
direction: p
|
|
1733
|
-
}, null, 8, ["canvasObject", "direction"]))), 128))
|
|
1734
|
-
], 36);
|
|
1735
|
-
}
|
|
1736
|
-
const ms = /* @__PURE__ */ tt(is, [["render", rs]]), os = {
|
|
1737
|
-
components: {
|
|
1738
|
-
CanvasBoxSelect: Re
|
|
1739
|
-
},
|
|
1740
|
-
props: {
|
|
1741
|
-
canvas: { type: Object, required: !0 }
|
|
1742
|
-
},
|
|
1743
|
-
mounted() {
|
|
1744
|
-
this.canvas.mount(this.$refs.viewport);
|
|
1745
|
-
},
|
|
1746
|
-
unmounted() {
|
|
1747
|
-
this.canvas.unmount();
|
|
1748
|
-
},
|
|
1749
|
-
methods: {
|
|
1750
|
-
onCanvasUiClick() {
|
|
1751
|
-
this.canvas.selection.deselectAll();
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
}, as = { class: "CanvasView" };
|
|
1755
|
-
function cs(r, t, e, n, o, l) {
|
|
1756
|
-
const g = ot("CanvasBoxSelect");
|
|
1757
|
-
return U(), q("div", as, [
|
|
1758
|
-
C("div", {
|
|
1759
|
-
ref: "viewport",
|
|
1760
|
-
class: "Viewport",
|
|
1761
|
-
onMousedown: t[0] || (t[0] = (...p) => e.canvas.pan.onMouseDown && e.canvas.pan.onMouseDown(...p)),
|
|
1762
|
-
onUidragstart: t[1] || (t[1] = (...p) => e.canvas.boxSelect.onUiDragStart && e.canvas.boxSelect.onUiDragStart(...p)),
|
|
1763
|
-
onUidragmove: t[2] || (t[2] = (...p) => e.canvas.boxSelect.onUiDragMove && e.canvas.boxSelect.onUiDragMove(...p)),
|
|
1764
|
-
onUidragend: t[3] || (t[3] = (...p) => e.canvas.boxSelect.onUiDragEnd && e.canvas.boxSelect.onUiDragEnd(...p)),
|
|
1765
|
-
onUiclick: t[4] || (t[4] = (...p) => l.onCanvasUiClick && l.onCanvasUiClick(...p)),
|
|
1766
|
-
onScroll: t[5] || (t[5] = (...p) => e.canvas.viewport.onScroll && e.canvas.viewport.onScroll(...p)),
|
|
1767
|
-
onWheel: t[6] || (t[6] = (...p) => e.canvas.zoom.onWheel && e.canvas.zoom.onWheel(...p))
|
|
1768
|
-
}, [
|
|
1769
|
-
C("div", {
|
|
1770
|
-
class: "Sizer",
|
|
1771
|
-
style: Z(e.canvas.viewport.getSizerStyle())
|
|
1772
|
-
}, null, 4),
|
|
1773
|
-
C("div", {
|
|
1774
|
-
class: "Canvas",
|
|
1775
|
-
style: Z(e.canvas.viewport.getCanvasStyle())
|
|
1776
|
-
}, [
|
|
1777
|
-
it(r.$slots, "default", {}, void 0, !0),
|
|
1778
|
-
C("div", {
|
|
1779
|
-
class: "Origin",
|
|
1780
|
-
style: Z(e.canvas.viewport.getOriginStyle())
|
|
1781
|
-
}, [
|
|
1782
|
-
it(r.$slots, "origin", {}, void 0, !0)
|
|
1783
|
-
], 4)
|
|
1784
|
-
], 4),
|
|
1785
|
-
F(g, { canvas: e.canvas }, null, 8, ["canvas"])
|
|
1786
|
-
], 544),
|
|
1787
|
-
it(r.$slots, "overlays", {}, void 0, !0)
|
|
1788
|
-
]);
|
|
1789
|
-
}
|
|
1790
|
-
const bs = /* @__PURE__ */ tt(os, [["render", cs], ["__scopeId", "data-v-5b37630f"]]);
|
|
1791
|
-
function nt(r, t) {
|
|
1792
|
-
const e = { x: Math.min(r.x, t.x), y: Math.min(r.y, t.y) }, n = { x: Math.max(r.x, t.x), y: Math.max(r.y, t.y) };
|
|
1793
|
-
return [e, n];
|
|
1794
|
-
}
|
|
1795
|
-
function $t(r, t) {
|
|
1796
|
-
const e = r[1].x >= t[0].x && t[1].x >= r[0].x, n = r[1].y >= t[0].y && t[1].y >= r[0].y;
|
|
1797
|
-
return e && n;
|
|
1798
|
-
}
|
|
1799
|
-
class ls {
|
|
1800
|
-
constructor(t) {
|
|
1801
|
-
this.target = t, this.entries = [];
|
|
1802
|
-
}
|
|
1803
|
-
add(t, e, n) {
|
|
1804
|
-
this.target.addEventListener(t, e, n), this.entries.push({ type: t, listener: e, options: n });
|
|
1805
|
-
}
|
|
1806
|
-
removeAll() {
|
|
1807
|
-
for (const t of this.entries)
|
|
1808
|
-
this.target.removeEventListener(t.type, t.listener, t.options);
|
|
1809
|
-
this.entries = [];
|
|
1810
|
-
}
|
|
1811
|
-
}
|
|
1812
|
-
const us = [
|
|
1813
|
-
"button",
|
|
1814
|
-
"a",
|
|
1815
|
-
"input",
|
|
1816
|
-
"textarea",
|
|
1817
|
-
"select",
|
|
1818
|
-
'[role="textbox"]',
|
|
1819
|
-
'[role="button"]',
|
|
1820
|
-
"[nodrag]"
|
|
1821
|
-
];
|
|
1822
|
-
class rt {
|
|
1823
|
-
constructor() {
|
|
1824
|
-
this.lastMousePos = { x: window.innerWidth * 0.5, y: window.innerHeight * 0.5 }, this.lmbPressed = !1, this.mmbPressed = !1, this.rmbPressed = !1, this.altKey = !1, this.ctrlKey = !1, this.metaKey = !1, this.shiftKey = !1, this.dragDistance = 4, this.windowEvents = new ls(window), this.lastMouseDownPos = { x: window.innerWidth * 0.5, y: window.innerHeight * 0.5 }, this.lastMouseDownTarget = null, this.dragTarget = null, this.inClickVicinity = !1, this.listening = !1;
|
|
1774
|
+
/* Render state */
|
|
1775
|
+
getCanvasCoords() {
|
|
1776
|
+
const t = this.space.localToCanvas({ x: this.localPos.x, y: this.localPos.y }), e = this.space.localToCanvas({
|
|
1777
|
+
x: this.localPos.x + this.localPos.w,
|
|
1778
|
+
y: this.localPos.y + this.localPos.h
|
|
1779
|
+
}), n = Ht(e, t), o = this.pos.w === void 0 ? void 0 : n.x, l = this.pos.h === void 0 ? void 0 : n.y;
|
|
1780
|
+
return {
|
|
1781
|
+
x: t.x,
|
|
1782
|
+
y: t.y,
|
|
1783
|
+
w: o,
|
|
1784
|
+
h: l
|
|
1785
|
+
};
|
|
1825
1786
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1787
|
+
getStyle() {
|
|
1788
|
+
const t = this.getCanvasCoords();
|
|
1789
|
+
return {
|
|
1790
|
+
position: "absolute",
|
|
1791
|
+
left: `${t.x}px`,
|
|
1792
|
+
top: `${t.y}px`,
|
|
1793
|
+
width: t.w === void 0 ? void 0 : `${t.w}px`,
|
|
1794
|
+
height: t.h === void 0 ? void 0 : `${t.h}px`
|
|
1795
|
+
};
|
|
1828
1796
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1797
|
+
isMoving() {
|
|
1798
|
+
return this.move.isMoving(this.objectId);
|
|
1831
1799
|
}
|
|
1832
|
-
|
|
1833
|
-
|
|
1800
|
+
isResizing() {
|
|
1801
|
+
return this.resizingDirection != null;
|
|
1834
1802
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1803
|
+
commitNewPos(t) {
|
|
1804
|
+
Object.assign(this.pos, t), this.events.objectPosUpdated.emit({
|
|
1805
|
+
objectId: this.objectId,
|
|
1806
|
+
pos: { ...this.pos }
|
|
1807
|
+
});
|
|
1837
1808
|
}
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1809
|
+
// Event handlers
|
|
1810
|
+
/**
|
|
1811
|
+
* Click handles selection
|
|
1812
|
+
* Shift/Ctrl/Meta key allows multi-select, if allowed by canvas config
|
|
1813
|
+
*/
|
|
1814
|
+
onUiClick(t) {
|
|
1815
|
+
if (!this.selectable)
|
|
1843
1816
|
return;
|
|
1844
|
-
|
|
1845
|
-
if (
|
|
1817
|
+
const e = t.shiftKey || t.ctrlKey || t.metaKey;
|
|
1818
|
+
if (this.config.allowMultiSelect && e) {
|
|
1819
|
+
this.selection.toggleSelection(this.objectId);
|
|
1846
1820
|
return;
|
|
1847
|
-
const e = t.pageX - this.lastMouseDownPos.x, n = t.pageY - this.lastMouseDownPos.y;
|
|
1848
|
-
Math.hypot(e, n) < this.dragDistance || (this.inClickVicinity = !1, this.isDragAllowed(this.lastMouseDownTarget) && (this.dragTarget = this.lastMouseDownTarget, this.dragTarget.dispatchEvent(this.cloneMouseEvent("uidragstart", t))));
|
|
1849
|
-
}
|
|
1850
|
-
onMouseUp(t) {
|
|
1851
|
-
if (t.button === 0) {
|
|
1852
|
-
const e = this.dragTarget, n = this.inClickVicinity, o = this.lastMouseDownTarget;
|
|
1853
|
-
this.dragTarget = null, this.inClickVicinity = !1, this.lastMouseDownTarget = null, e && e.dispatchEvent(this.cloneMouseEvent("uidragend", t)), n && o && (o.dispatchEvent(this.cloneMouseEvent("uiclick", t)), this.dispatchActivate(o, t));
|
|
1854
1821
|
}
|
|
1855
|
-
this.
|
|
1822
|
+
this.selection.selectSingle(this.objectId);
|
|
1856
1823
|
}
|
|
1857
|
-
|
|
1858
|
-
|
|
1824
|
+
/**
|
|
1825
|
+
* Dragging starts moving selected objects, if allowed.
|
|
1826
|
+
* If not selected, single selection is performed first, then dragging starts.
|
|
1827
|
+
*/
|
|
1828
|
+
onUiDragStart(t) {
|
|
1829
|
+
this.movable && (this.isSelected() || (t.shiftKey ? this.selection.addToSelection(this.objectId) : this.selection.selectSingle(this.objectId)), !this.isResizing() && !this.isMoving() && this.move.startMovingSelection(t));
|
|
1859
1830
|
}
|
|
1860
|
-
|
|
1861
|
-
|
|
1831
|
+
/**
|
|
1832
|
+
* Drag move is re-emitted to global canvas events, so that each selected object moves.
|
|
1833
|
+
* CanvasMove will call onMoveOffset on objects that are currently moving.
|
|
1834
|
+
*/
|
|
1835
|
+
onUiDragMove(t) {
|
|
1836
|
+
this.events.dragMove.emit(t);
|
|
1862
1837
|
}
|
|
1863
|
-
|
|
1864
|
-
|
|
1838
|
+
/**
|
|
1839
|
+
* Drag end is re-emitted to global canvas events, so that each selected object stops moving.
|
|
1840
|
+
* CanvasMove will call onMoveEnd on objects that are currently moving.
|
|
1841
|
+
*/
|
|
1842
|
+
onUiDragEnd(t) {
|
|
1843
|
+
this.events.dragEnd.emit(t);
|
|
1865
1844
|
}
|
|
1866
|
-
|
|
1867
|
-
|
|
1845
|
+
/* Moving */
|
|
1846
|
+
/**
|
|
1847
|
+
* Move start is called by CanvasMove when selected objects starts moving.
|
|
1848
|
+
* It saves the previous local position, so that the offset can be calculated.
|
|
1849
|
+
*/
|
|
1850
|
+
onMoveStart() {
|
|
1851
|
+
this.prevLocalPos = { ...this.localPos };
|
|
1868
1852
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1853
|
+
/**
|
|
1854
|
+
* Move offset is called by CanvasMove when selected objects moves.
|
|
1855
|
+
* It calculates the new local position based on the previous local position and the offset.
|
|
1856
|
+
*/
|
|
1857
|
+
onMoveOffset(t) {
|
|
1858
|
+
this.movable && (this.localPos = {
|
|
1859
|
+
x: this.prevLocalPos.x + t.x,
|
|
1860
|
+
y: this.prevLocalPos.y + t.y,
|
|
1861
|
+
w: this.prevLocalPos.w,
|
|
1862
|
+
h: this.prevLocalPos.h
|
|
1863
|
+
});
|
|
1871
1864
|
}
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
button: e.button,
|
|
1881
|
-
buttons: e.buttons,
|
|
1882
|
-
ctrlKey: e.ctrlKey,
|
|
1883
|
-
shiftKey: e.shiftKey,
|
|
1884
|
-
altKey: e.altKey,
|
|
1885
|
-
metaKey: e.metaKey
|
|
1865
|
+
/**
|
|
1866
|
+
* Move end is called by CanvasMove when selected objects stops moving.
|
|
1867
|
+
* It commits the new local position to the object.
|
|
1868
|
+
*/
|
|
1869
|
+
onMoveEnd() {
|
|
1870
|
+
this.commitNewPos({
|
|
1871
|
+
x: this.maybeRound(this.localPos.x),
|
|
1872
|
+
y: this.maybeRound(this.localPos.y)
|
|
1886
1873
|
});
|
|
1887
1874
|
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
this.config = b(this, J), this.inputStateManager = b(this, rt), this.objectRegistry = b(this, ct), this.selection = b(this, Q), this.space = b(this, V), this.selectionOriginPos = null, this.initialSelectionIds = /* @__PURE__ */ new Set(), this.objectBoxes = [];
|
|
1875
|
+
/* Resizing */
|
|
1876
|
+
startResizing(t) {
|
|
1877
|
+
this.resizable === "none" || !this.canResizeInDirection(t) || (this.resizingDirection = t, this.resizingBounds = this.getObjectBounds(), this.selection.selectSingle(this.objectId));
|
|
1892
1878
|
}
|
|
1893
|
-
|
|
1894
|
-
|
|
1879
|
+
onResizeMove(t) {
|
|
1880
|
+
if (!this.resizingDirection)
|
|
1881
|
+
return;
|
|
1882
|
+
const e = { x: t.pageX, y: t.pageY }, n = this.space.pageToLocal(e), [o, l] = this.getResizingUpdates(this.resizingDirection, n);
|
|
1883
|
+
this.localPos = {
|
|
1884
|
+
x: o.x,
|
|
1885
|
+
y: o.y,
|
|
1886
|
+
w: l.x - o.x,
|
|
1887
|
+
h: l.y - o.y
|
|
1888
|
+
};
|
|
1895
1889
|
}
|
|
1896
|
-
|
|
1897
|
-
this.
|
|
1890
|
+
onResizeEnd() {
|
|
1891
|
+
this.resizingDirection && (this.commitNewPos({
|
|
1892
|
+
x: this.maybeRound(this.localPos.x),
|
|
1893
|
+
y: this.maybeRound(this.localPos.y),
|
|
1894
|
+
w: z(this.maybeRound(this.localPos.w), this.bounds[0].x, this.bounds[1].x),
|
|
1895
|
+
h: z(this.maybeRound(this.localPos.h), this.bounds[0].y, this.bounds[1].y)
|
|
1896
|
+
}), this.resizingDirection = null);
|
|
1898
1897
|
}
|
|
1899
|
-
|
|
1900
|
-
|
|
1898
|
+
getResizeDirections() {
|
|
1899
|
+
switch (this.resizable) {
|
|
1900
|
+
case "both":
|
|
1901
|
+
return ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
|
|
1902
|
+
case "horizontal":
|
|
1903
|
+
return ["e", "w"];
|
|
1904
|
+
case "vertical":
|
|
1905
|
+
return ["n", "s"];
|
|
1906
|
+
default:
|
|
1907
|
+
return [];
|
|
1908
|
+
}
|
|
1901
1909
|
}
|
|
1902
|
-
|
|
1903
|
-
this.
|
|
1910
|
+
getObjectBounds() {
|
|
1911
|
+
const t = { x: this.localPos.x, y: this.localPos.y }, e = {
|
|
1912
|
+
x: this.localPos.x + this.localPos.w,
|
|
1913
|
+
y: this.localPos.y + this.localPos.h
|
|
1914
|
+
};
|
|
1915
|
+
return [t, e];
|
|
1904
1916
|
}
|
|
1905
|
-
|
|
1906
|
-
return this.
|
|
1907
|
-
this.space.pageToLocal(this.selectionOriginPos),
|
|
1908
|
-
this.space.pageToLocal(this.inputStateManager.lastMousePos)
|
|
1909
|
-
) : null;
|
|
1917
|
+
canResizeInDirection(t) {
|
|
1918
|
+
return this.getResizeDirections().includes(t);
|
|
1910
1919
|
}
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
width: `${n.x - e.x}px`,
|
|
1919
|
-
height: `${n.y - e.y}px`
|
|
1920
|
+
recalcLocalPos() {
|
|
1921
|
+
const t = this.pos.w ?? this.localPos.w, e = this.pos.h ?? this.localPos.h;
|
|
1922
|
+
this.localPos = {
|
|
1923
|
+
x: this.pos.x,
|
|
1924
|
+
y: this.pos.y,
|
|
1925
|
+
w: z(t, this.bounds[0].x, this.bounds[1].x),
|
|
1926
|
+
h: z(e, this.bounds[0].y, this.bounds[1].y)
|
|
1920
1927
|
};
|
|
1921
1928
|
}
|
|
1922
|
-
|
|
1923
|
-
this.
|
|
1929
|
+
maybeRound(t) {
|
|
1930
|
+
return this.snapToGrid ? Math.round(t) : t;
|
|
1924
1931
|
}
|
|
1925
|
-
|
|
1926
|
-
this.
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
{ x:
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1932
|
+
getResizingUpdates(t, e) {
|
|
1933
|
+
const [n, o] = this.resizingBounds, l = z(e.x, o.x - this.bounds[1].x, o.x - this.bounds[0].x), g = z(e.x, n.x + this.bounds[0].x, n.x + this.bounds[1].x), p = z(e.y, o.y - this.bounds[1].y, o.y - this.bounds[0].y), S = z(e.y, n.y + this.bounds[0].y, n.y + this.bounds[1].y);
|
|
1934
|
+
switch (t) {
|
|
1935
|
+
case "n":
|
|
1936
|
+
return [{ x: n.x, y: p }, { x: o.x, y: o.y }];
|
|
1937
|
+
case "s":
|
|
1938
|
+
return [{ x: n.x, y: n.y }, { x: o.x, y: S }];
|
|
1939
|
+
case "w":
|
|
1940
|
+
return [{ x: l, y: n.y }, { x: o.x, y: o.y }];
|
|
1941
|
+
case "e":
|
|
1942
|
+
return [{ x: n.x, y: n.y }, { x: g, y: o.y }];
|
|
1943
|
+
case "ne":
|
|
1944
|
+
return [{ x: n.x, y: p }, { x: g, y: o.y }];
|
|
1945
|
+
case "nw":
|
|
1946
|
+
return [{ x: l, y: p }, { x: o.x, y: o.y }];
|
|
1947
|
+
case "se":
|
|
1948
|
+
return [{ x: n.x, y: n.y }, { x: g, y: S }];
|
|
1949
|
+
case "sw":
|
|
1950
|
+
return [{ x: l, y: n.y }, { x: o.x, y: S }];
|
|
1951
|
+
default:
|
|
1952
|
+
return [{ x: n.x, y: n.y }, { x: o.x, y: o.y }];
|
|
1945
1953
|
}
|
|
1946
1954
|
}
|
|
1947
|
-
updateSelection(t) {
|
|
1948
|
-
const e = this.getSelectionBox();
|
|
1949
|
-
if (!e)
|
|
1950
|
-
return;
|
|
1951
|
-
const n = new Set(this.initialSelectionIds);
|
|
1952
|
-
for (const [o, l] of this.objectBoxes)
|
|
1953
|
-
$t(e, l) && n.add(o);
|
|
1954
|
-
this.selection.setSelectedIds(n);
|
|
1955
|
-
}
|
|
1956
1955
|
}
|
|
1957
1956
|
class lt {
|
|
1958
1957
|
constructor() {
|
|
1959
|
-
this.viewportEl = null, this.windowEvents = new
|
|
1958
|
+
this.viewportEl = null, this.windowEvents = new Wt(window), this.config = b(this, J), this.space = b(this, V);
|
|
1960
1959
|
}
|
|
1961
1960
|
mount(t) {
|
|
1962
1961
|
this.viewportEl = t, this.recalcCanvasMetrics(), this.updateViewportBox(), this.centerOnOrigin(), this.onScroll(), this.windowEvents.add("resize", () => this.updateViewportBox()), this.windowEvents.add("scroll", () => this.updateViewportBox()), this.config.autoCenter && requestAnimationFrame(() => this.centerOnOrigin());
|
|
@@ -1965,7 +1964,7 @@ class lt {
|
|
|
1965
1964
|
this.windowEvents.removeAll(), this.viewportEl = null, this.space.viewportBox = [{ x: 0, y: 0 }, { x: 0, y: 0 }];
|
|
1966
1965
|
}
|
|
1967
1966
|
getCanvasStyle() {
|
|
1968
|
-
const t =
|
|
1967
|
+
const t = Gt(this.viewportEl, "--CanvasView-grid-major-fill", "var(--border-deep)"), e = Gt(this.viewportEl, "--CanvasView-grid-minor-fill", "var(--border-base)"), n = W(this.viewportEl, "--CanvasView-grid-subdivisions", 4), o = W(this.viewportEl, "--CanvasView-grid-major-radius", 2), l = W(this.viewportEl, "--CanvasView-grid-minor-radius", 1), g = es(
|
|
1969
1968
|
this.space.cellSize,
|
|
1970
1969
|
n,
|
|
1971
1970
|
t,
|
|
@@ -2046,20 +2045,20 @@ class lt {
|
|
|
2046
2045
|
};
|
|
2047
2046
|
}
|
|
2048
2047
|
recalcCanvasMetrics() {
|
|
2049
|
-
const t = W(this.viewportEl, "--
|
|
2050
|
-
this.space.cellSize = W(this.viewportEl, "--
|
|
2048
|
+
const t = W(this.viewportEl, "--CanvasView-margin-cells", 64);
|
|
2049
|
+
this.space.cellSize = W(this.viewportEl, "--CanvasView-grid-cell-size", 32);
|
|
2051
2050
|
const e = t * this.space.cellSize;
|
|
2052
2051
|
this.space.canvasSize = { x: e * 2, y: e * 2 }, this.space.canvasOrigin = { x: e, y: e };
|
|
2053
2052
|
}
|
|
2054
2053
|
}
|
|
2055
|
-
var
|
|
2056
|
-
for (var o =
|
|
2054
|
+
var ds = Object.defineProperty, fs = Object.getOwnPropertyDescriptor, vs = (r, t, e, n) => {
|
|
2055
|
+
for (var o = fs(t, e), l = r.length - 1, g; l >= 0; l--)
|
|
2057
2056
|
(g = r[l]) && (o = g(t, e, o) || o);
|
|
2058
|
-
return o &&
|
|
2057
|
+
return o && ds(t, e, o), o;
|
|
2059
2058
|
};
|
|
2060
2059
|
class gt {
|
|
2061
2060
|
constructor() {
|
|
2062
|
-
this.viewport = b(this, lt), this.events = b(this, K), this.windowEvents = new
|
|
2061
|
+
this.viewport = b(this, lt), this.events = b(this, K), this.windowEvents = new Wt(window), this.isPanning = !1;
|
|
2063
2062
|
}
|
|
2064
2063
|
init() {
|
|
2065
2064
|
this.events.unmounted.on(() => this.stopPanning());
|
|
@@ -2077,11 +2076,11 @@ class gt {
|
|
|
2077
2076
|
t.button === 1 && this.stopPanning();
|
|
2078
2077
|
}
|
|
2079
2078
|
}
|
|
2080
|
-
|
|
2081
|
-
|
|
2079
|
+
vs([
|
|
2080
|
+
Zt()
|
|
2082
2081
|
], gt.prototype, "init");
|
|
2083
|
-
const k = [0.33, 0.5, 0.6, 0.75, 0.85, 1, 1.15, 1.25, 1.5, 1.75, 2],
|
|
2084
|
-
class
|
|
2082
|
+
const k = [0.33, 0.5, 0.6, 0.75, 0.85, 1, 1.15, 1.25, 1.5, 1.75, 2], ps = Math.min(...k), ys = Math.max(...k);
|
|
2083
|
+
class Ft {
|
|
2085
2084
|
constructor() {
|
|
2086
2085
|
this.viewport = b(this, lt), this.space = b(this, V);
|
|
2087
2086
|
}
|
|
@@ -2094,7 +2093,7 @@ class Kt {
|
|
|
2094
2093
|
}
|
|
2095
2094
|
setZoom(t) {
|
|
2096
2095
|
const e = this.space.getViewportCenterInLocal();
|
|
2097
|
-
this.space.zoom = z(t,
|
|
2096
|
+
this.space.zoom = z(t, ps, ys), this.viewport.scrollToLocalPoint(e);
|
|
2098
2097
|
}
|
|
2099
2098
|
zoomIn() {
|
|
2100
2099
|
const t = this.getClosestZoomStepIndex();
|
|
@@ -2113,33 +2112,36 @@ class Kt {
|
|
|
2113
2112
|
return t;
|
|
2114
2113
|
}
|
|
2115
2114
|
}
|
|
2116
|
-
class
|
|
2115
|
+
class Ss {
|
|
2117
2116
|
constructor(t = {}) {
|
|
2118
|
-
this.mesh = new at(), this.boxSelect = b(this,
|
|
2117
|
+
this.mesh = Ee(new at()), this.boxSelect = b(this, $t), this.config = b(this, J), this.space = b(this, V), this.viewport = b(this, lt), this.pan = b(this, gt), this.events = b(this, K), this.inputStateManager = b(this, rt), this.objectRegistry = b(this, ct), this.selection = b(this, Q), this.zoom = b(this, Ft);
|
|
2119
2118
|
const e = t.inputStateManager ?? new rt();
|
|
2120
|
-
this.ownsInputStateManager = t.inputStateManager == null, this.mesh.connect(this), this.mesh.use((n) => Ie(n)), this.mesh.constant(rt, e), this.mesh.service(
|
|
2119
|
+
this.ownsInputStateManager = t.inputStateManager == null, this.mesh.connect(this), this.mesh.use((n) => Ie(n)), this.mesh.constant(rt, e), this.mesh.service($t), this.mesh.service(lt), this.mesh.service(gt), this.mesh.service(J), this.mesh.service(V), this.mesh.service(K), this.mesh.service(wt), this.mesh.service(ct), this.mesh.service(Q), this.mesh.service(Ft), this.config.set(t), as(this.mesh);
|
|
2120
|
+
}
|
|
2121
|
+
createObjectController(t) {
|
|
2122
|
+
return this.mesh.connect(new hs(t));
|
|
2121
2123
|
}
|
|
2122
2124
|
mount(t) {
|
|
2123
|
-
|
|
2125
|
+
this.viewport.mount(t), this.events.mounted.emit(), this.ownsInputStateManager && this.inputStateManager.mount();
|
|
2124
2126
|
}
|
|
2125
2127
|
unmount() {
|
|
2126
|
-
|
|
2128
|
+
this.viewport.destroy(), this.ownsInputStateManager && this.inputStateManager.unmount(), this.events.unmounted.emit();
|
|
2127
2129
|
}
|
|
2128
2130
|
}
|
|
2129
2131
|
export {
|
|
2130
|
-
|
|
2132
|
+
De as CanvasBoxSelect,
|
|
2131
2133
|
J as CanvasConfig,
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
+
Ss as CanvasController,
|
|
2135
|
+
ws as CanvasDebugCoords,
|
|
2134
2136
|
K as CanvasEvents,
|
|
2135
2137
|
ms as CanvasObject,
|
|
2136
|
-
|
|
2138
|
+
hs as CanvasObjectController,
|
|
2137
2139
|
ct as CanvasObjectRegistry,
|
|
2138
2140
|
gt as CanvasPan,
|
|
2139
2141
|
Q as CanvasSelection,
|
|
2140
2142
|
V as CanvasSpace,
|
|
2141
2143
|
bs as CanvasView,
|
|
2142
2144
|
lt as CanvasViewport,
|
|
2143
|
-
|
|
2145
|
+
Ft as CanvasZoom,
|
|
2144
2146
|
rt as InputStateManager
|
|
2145
2147
|
};
|