build-dxf 0.0.34 → 0.0.36
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/package.json +1 -1
- package/src/build.js +1240 -1091
- package/src/index3.js +539 -580
- package/src/utils/DxfSystem/components/Dxf.d.ts +12 -2
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/MergeLine.d.ts +0 -2
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorrection.d.ts +0 -5
- package/src/utils/Quadtree/LineSegment.d.ts +22 -0
- package/src/utils/Quadtree/Quadtree.d.ts +8 -3
- package/src/utils/DxfSystem/components/Dxf copy.d.ts +0 -276
package/src/index3.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
import * as m from "three";
|
|
2
|
-
import { i as
|
|
3
|
-
import { C as Se, P as
|
|
2
|
+
import { i as ut, n as pt, r as Ue, t as qe, c as De, d as gt, e as vt, f as Ae, g as Q, _ as Ze, u as ft, h as fe, j as Be, w as wt, k as yt, l as bt, p as xt, m as Ct, o as Et, T as Ne, q as Re, s as Mt, v as Lt, x as Oe, y as Pe, z as Le, A as kt, B as It, L as we, D as Pt, b as Fe, E as re, S as Dt } from "./selectLocalFile.js";
|
|
3
|
+
import { C as Se, P as _, L as B, B as Ye, E as Xe, b as Ke, Q as ze, u as At, c as ke, W as St, T as _t } from "./build.js";
|
|
4
4
|
import "clipper-lib";
|
|
5
5
|
import "dxf-writer";
|
|
6
6
|
import "three/addons/controls/OrbitControls.js";
|
|
7
|
-
import { watch as J, ref as
|
|
8
|
-
function
|
|
7
|
+
import { watch as J, ref as S, defineComponent as me, computed as D, createElementBlock as R, openBlock as P, normalizeClass as V, unref as v, renderSlot as be, createVNode as K, Transition as xe, withCtx as j, withDirectives as $e, createElementVNode as I, normalizeStyle as _e, createTextVNode as X, toDisplayString as de, vShow as et, shallowReactive as Bt, onMounted as tt, createBlock as ge, createCommentVNode as q, resolveDynamicComponent as Nt, Fragment as ve, withModifiers as Rt, nextTick as ye, isVNode as nt, render as Te, toRaw as Ot, onUnmounted as Ft, renderList as Ie, createStaticVNode as Kt, TransitionGroup as zt, createApp as Tt } from "vue";
|
|
8
|
+
function st(l) {
|
|
9
9
|
var e;
|
|
10
|
-
const t =
|
|
10
|
+
const t = Ue(l);
|
|
11
11
|
return (e = t?.$el) != null ? e : t;
|
|
12
12
|
}
|
|
13
13
|
const ot = De ? window : void 0;
|
|
14
|
-
function jt(...
|
|
15
|
-
let e, t, n,
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
14
|
+
function jt(...l) {
|
|
15
|
+
let e, t, n, s;
|
|
16
|
+
if (ut(l[0]) || Array.isArray(l[0]) ? ([t, n, s] = l, e = ot) : [e, t, n, s] = l, !e)
|
|
17
|
+
return pt;
|
|
18
18
|
Array.isArray(t) || (t = [t]), Array.isArray(n) || (n = [n]);
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
a(), r &&
|
|
19
|
+
const o = [], a = () => {
|
|
20
|
+
o.forEach((r) => r()), o.length = 0;
|
|
21
|
+
}, c = (r, h, y, f) => (r.addEventListener(h, y, f), () => r.removeEventListener(h, y, f)), d = J(() => [st(e), Ue(s)], ([r, h]) => {
|
|
22
|
+
a(), r && o.push(...t.flatMap((y) => n.map((f) => c(r, y, f, h))));
|
|
23
23
|
}, { immediate: !0, flush: "post" }), i = () => {
|
|
24
|
-
|
|
24
|
+
d(), a();
|
|
25
25
|
};
|
|
26
|
-
return
|
|
26
|
+
return qe(i), i;
|
|
27
27
|
}
|
|
28
|
-
function Vt(
|
|
29
|
-
const t =
|
|
30
|
-
return n(),
|
|
28
|
+
function Vt(l, e = !1) {
|
|
29
|
+
const t = S(), n = () => t.value = !!l();
|
|
30
|
+
return n(), gt(n, e), t;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
var
|
|
32
|
+
const je = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ve = "__vueuse_ssr_handlers__";
|
|
33
|
+
je[Ve] = je[Ve] || {};
|
|
34
|
+
var Ge = Object.getOwnPropertySymbols, Gt = Object.prototype.hasOwnProperty, Qt = Object.prototype.propertyIsEnumerable, Ht = (l, e) => {
|
|
35
35
|
var t = {};
|
|
36
|
-
for (var n in
|
|
37
|
-
Gt.call(
|
|
38
|
-
if (
|
|
39
|
-
for (var n of
|
|
40
|
-
e.indexOf(n) < 0 && Qt.call(
|
|
36
|
+
for (var n in l)
|
|
37
|
+
Gt.call(l, n) && e.indexOf(n) < 0 && (t[n] = l[n]);
|
|
38
|
+
if (l != null && Ge)
|
|
39
|
+
for (var n of Ge(l))
|
|
40
|
+
e.indexOf(n) < 0 && Qt.call(l, n) && (t[n] = l[n]);
|
|
41
41
|
return t;
|
|
42
42
|
};
|
|
43
|
-
function Wt(
|
|
44
|
-
const n = t, { window:
|
|
43
|
+
function Wt(l, e, t = {}) {
|
|
44
|
+
const n = t, { window: s = ot } = n, o = Ht(n, ["window"]);
|
|
45
45
|
let a;
|
|
46
|
-
const
|
|
46
|
+
const c = Vt(() => s && "ResizeObserver" in s), d = () => {
|
|
47
47
|
a && (a.disconnect(), a = void 0);
|
|
48
|
-
}, i = J(() =>
|
|
49
|
-
|
|
48
|
+
}, i = J(() => st(l), (h) => {
|
|
49
|
+
d(), c.value && s && h && (a = new ResizeObserver(e), a.observe(h, o));
|
|
50
50
|
}, { immediate: !0, flush: "post" }), r = () => {
|
|
51
|
-
|
|
51
|
+
d(), i();
|
|
52
52
|
};
|
|
53
|
-
return
|
|
54
|
-
isSupported:
|
|
53
|
+
return qe(r), {
|
|
54
|
+
isSupported: c,
|
|
55
55
|
stop: r
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
var
|
|
59
|
-
(function(
|
|
60
|
-
|
|
61
|
-
})(
|
|
62
|
-
var Jt = Object.defineProperty,
|
|
58
|
+
var Qe;
|
|
59
|
+
(function(l) {
|
|
60
|
+
l.UP = "UP", l.RIGHT = "RIGHT", l.DOWN = "DOWN", l.LEFT = "LEFT", l.NONE = "NONE";
|
|
61
|
+
})(Qe || (Qe = {}));
|
|
62
|
+
var Jt = Object.defineProperty, He = Object.getOwnPropertySymbols, Ut = Object.prototype.hasOwnProperty, qt = Object.prototype.propertyIsEnumerable, We = (l, e, t) => e in l ? Jt(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, Zt = (l, e) => {
|
|
63
63
|
for (var t in e || (e = {}))
|
|
64
|
-
Ut.call(e, t) &&
|
|
65
|
-
if (
|
|
66
|
-
for (var t of
|
|
67
|
-
qt.call(e, t) &&
|
|
68
|
-
return
|
|
64
|
+
Ut.call(e, t) && We(l, t, e[t]);
|
|
65
|
+
if (He)
|
|
66
|
+
for (var t of He(e))
|
|
67
|
+
qt.call(e, t) && We(l, t, e[t]);
|
|
68
|
+
return l;
|
|
69
69
|
};
|
|
70
70
|
const Yt = {
|
|
71
71
|
easeInSine: [0.12, 0, 0.39, 0],
|
|
@@ -94,9 +94,9 @@ const Yt = {
|
|
|
94
94
|
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
95
95
|
};
|
|
96
96
|
Zt({
|
|
97
|
-
linear:
|
|
97
|
+
linear: vt
|
|
98
98
|
}, Yt);
|
|
99
|
-
const Xt = (
|
|
99
|
+
const Xt = (l) => l, $t = {
|
|
100
100
|
esc: "Escape"
|
|
101
101
|
}, en = Ae({
|
|
102
102
|
value: {
|
|
@@ -134,45 +134,45 @@ const Xt = (c) => c, $t = {
|
|
|
134
134
|
}), nn = /* @__PURE__ */ me({
|
|
135
135
|
...tn,
|
|
136
136
|
props: en,
|
|
137
|
-
setup(
|
|
138
|
-
const t =
|
|
139
|
-
var a,
|
|
137
|
+
setup(l, { expose: e }) {
|
|
138
|
+
const t = l, n = ft("badge"), s = D(() => t.isDot ? "" : fe(t.value) && fe(t.max) ? t.max < t.value ? `${t.max}+` : `${t.value}` : `${t.value}`), o = D(() => {
|
|
139
|
+
var a, c, d, i, r;
|
|
140
140
|
return [
|
|
141
141
|
{
|
|
142
142
|
backgroundColor: t.color,
|
|
143
|
-
marginRight: Be(-((
|
|
144
|
-
marginTop: Be((i = (
|
|
143
|
+
marginRight: Be(-((c = (a = t.offset) == null ? void 0 : a[0]) != null ? c : 0)),
|
|
144
|
+
marginTop: Be((i = (d = t.offset) == null ? void 0 : d[1]) != null ? i : 0)
|
|
145
145
|
},
|
|
146
146
|
(r = t.badgeStyle) != null ? r : {}
|
|
147
147
|
];
|
|
148
148
|
});
|
|
149
149
|
return e({
|
|
150
|
-
content:
|
|
151
|
-
}), (a,
|
|
152
|
-
class: V(
|
|
150
|
+
content: s
|
|
151
|
+
}), (a, c) => (P(), R("div", {
|
|
152
|
+
class: V(v(n).b())
|
|
153
153
|
}, [
|
|
154
154
|
be(a.$slots, "default"),
|
|
155
|
-
|
|
156
|
-
name: `${
|
|
155
|
+
K(xe, {
|
|
156
|
+
name: `${v(n).namespace.value}-zoom-in-center`,
|
|
157
157
|
persisted: ""
|
|
158
158
|
}, {
|
|
159
159
|
default: j(() => [
|
|
160
|
-
|
|
160
|
+
$e(I("sup", {
|
|
161
161
|
class: V([
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
v(n).e("content"),
|
|
163
|
+
v(n).em("content", a.type),
|
|
164
|
+
v(n).is("fixed", !!a.$slots.default),
|
|
165
|
+
v(n).is("dot", a.isDot),
|
|
166
|
+
v(n).is("hide-zero", !a.showZero && t.value === 0),
|
|
167
167
|
a.badgeClass
|
|
168
168
|
]),
|
|
169
|
-
style: _e(
|
|
169
|
+
style: _e(v(o))
|
|
170
170
|
}, [
|
|
171
|
-
be(a.$slots, "content", { value:
|
|
172
|
-
X(de(
|
|
171
|
+
be(a.$slots, "content", { value: v(s) }, () => [
|
|
172
|
+
X(de(v(s)), 1)
|
|
173
173
|
])
|
|
174
174
|
], 6), [
|
|
175
|
-
[
|
|
175
|
+
[et, !a.hidden && (v(s) || a.isDot || a.$slots.content)]
|
|
176
176
|
])
|
|
177
177
|
]),
|
|
178
178
|
_: 3
|
|
@@ -180,8 +180,8 @@ const Xt = (c) => c, $t = {
|
|
|
180
180
|
], 2));
|
|
181
181
|
}
|
|
182
182
|
});
|
|
183
|
-
var
|
|
184
|
-
const
|
|
183
|
+
var sn = /* @__PURE__ */ Ze(nn, [["__file", "badge.vue"]]);
|
|
184
|
+
const on = wt(sn), an = Ae({
|
|
185
185
|
a11y: {
|
|
186
186
|
type: Boolean,
|
|
187
187
|
default: !0
|
|
@@ -189,7 +189,7 @@ const sn = ft(on), an = Ae({
|
|
|
189
189
|
locale: {
|
|
190
190
|
type: Q(Object)
|
|
191
191
|
},
|
|
192
|
-
size:
|
|
192
|
+
size: bt,
|
|
193
193
|
button: {
|
|
194
194
|
type: Q(Object)
|
|
195
195
|
},
|
|
@@ -217,20 +217,20 @@ const sn = ft(on), an = Ae({
|
|
|
217
217
|
type: String,
|
|
218
218
|
default: "el"
|
|
219
219
|
},
|
|
220
|
-
...
|
|
220
|
+
...yt
|
|
221
221
|
}), T = {};
|
|
222
222
|
me({
|
|
223
223
|
name: "ElConfigProvider",
|
|
224
224
|
props: an,
|
|
225
|
-
setup(
|
|
226
|
-
const t =
|
|
227
|
-
return J(() =>
|
|
228
|
-
var
|
|
229
|
-
Object.assign(T, (
|
|
225
|
+
setup(l, { slots: e }) {
|
|
226
|
+
const t = xt(l);
|
|
227
|
+
return J(() => l.message, (n) => {
|
|
228
|
+
var s, o;
|
|
229
|
+
Object.assign(T, (o = (s = t?.value) == null ? void 0 : s.message) != null ? o : {}, n ?? {});
|
|
230
230
|
}, { immediate: !0, deep: !0 }), () => be(e, "default", { config: t?.value });
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
|
-
const
|
|
233
|
+
const at = [
|
|
234
234
|
"primary",
|
|
235
235
|
"success",
|
|
236
236
|
"info",
|
|
@@ -266,7 +266,7 @@ const st = [
|
|
|
266
266
|
default: N.duration
|
|
267
267
|
},
|
|
268
268
|
icon: {
|
|
269
|
-
type:
|
|
269
|
+
type: Ct,
|
|
270
270
|
default: N.icon
|
|
271
271
|
},
|
|
272
272
|
id: {
|
|
@@ -291,7 +291,7 @@ const st = [
|
|
|
291
291
|
},
|
|
292
292
|
type: {
|
|
293
293
|
type: String,
|
|
294
|
-
values:
|
|
294
|
+
values: at,
|
|
295
295
|
default: N.type
|
|
296
296
|
},
|
|
297
297
|
plain: {
|
|
@@ -316,92 +316,92 @@ const st = [
|
|
|
316
316
|
}
|
|
317
317
|
}), dn = {
|
|
318
318
|
destroy: () => !0
|
|
319
|
-
}, H = Bt([]), ln = (
|
|
320
|
-
const e = H.findIndex((
|
|
319
|
+
}, H = Bt([]), ln = (l) => {
|
|
320
|
+
const e = H.findIndex((s) => s.id === l), t = H[e];
|
|
321
321
|
let n;
|
|
322
322
|
return e > 0 && (n = H[e - 1]), { current: t, prev: n };
|
|
323
|
-
}, cn = (
|
|
324
|
-
const { prev: e } = ln(
|
|
323
|
+
}, cn = (l) => {
|
|
324
|
+
const { prev: e } = ln(l);
|
|
325
325
|
return e ? e.vm.exposed.bottom.value : 0;
|
|
326
|
-
}, mn = (
|
|
326
|
+
}, mn = (l, e) => H.findIndex((n) => n.id === l) > 0 ? 16 : e, hn = me({
|
|
327
327
|
name: "ElMessage"
|
|
328
328
|
}), un = /* @__PURE__ */ me({
|
|
329
329
|
...hn,
|
|
330
330
|
props: rn,
|
|
331
331
|
emits: dn,
|
|
332
|
-
setup(
|
|
333
|
-
const n =
|
|
332
|
+
setup(l, { expose: e, emit: t }) {
|
|
333
|
+
const n = l, { Close: s } = Mt, o = S(!1), { ns: a, zIndex: c } = Et("message"), { currentZIndex: d, nextZIndex: i } = c, r = S(), h = S(!1), y = S(0);
|
|
334
334
|
let f;
|
|
335
335
|
const p = D(() => n.type ? n.type === "error" ? "danger" : n.type : "info"), u = D(() => {
|
|
336
336
|
const b = n.type;
|
|
337
337
|
return { [a.bm("icon", b)]: b && Ne[b] };
|
|
338
|
-
}), E = D(() => n.icon || Ne[n.type] || ""), x = D(() => cn(n.id)), k = D(() => mn(n.id, n.offset) + x.value),
|
|
338
|
+
}), E = D(() => n.icon || Ne[n.type] || ""), x = D(() => cn(n.id)), k = D(() => mn(n.id, n.offset) + x.value), z = D(() => y.value + k.value), Y = D(() => ({
|
|
339
339
|
top: `${k.value}px`,
|
|
340
|
-
zIndex:
|
|
340
|
+
zIndex: d.value
|
|
341
341
|
}));
|
|
342
342
|
function Z() {
|
|
343
|
-
n.duration !== 0 && ({ stop: f } =
|
|
344
|
-
|
|
343
|
+
n.duration !== 0 && ({ stop: f } = Lt(() => {
|
|
344
|
+
A();
|
|
345
345
|
}, n.duration));
|
|
346
346
|
}
|
|
347
347
|
function G() {
|
|
348
348
|
f?.();
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function A() {
|
|
351
351
|
h.value = !1, ye(() => {
|
|
352
352
|
var b;
|
|
353
|
-
|
|
353
|
+
o.value || ((b = n.onClose) == null || b.call(n), t("destroy"));
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
function M({ code: b }) {
|
|
357
|
-
b === $t.esc &&
|
|
357
|
+
b === $t.esc && A();
|
|
358
358
|
}
|
|
359
|
-
return
|
|
359
|
+
return tt(() => {
|
|
360
360
|
Z(), i(), h.value = !0;
|
|
361
361
|
}), J(() => n.repeatNum, () => {
|
|
362
362
|
G(), Z();
|
|
363
363
|
}), jt(document, "keydown", M), Wt(r, () => {
|
|
364
|
-
|
|
364
|
+
y.value = r.value.getBoundingClientRect().height;
|
|
365
365
|
}), e({
|
|
366
366
|
visible: h,
|
|
367
|
-
bottom:
|
|
368
|
-
close:
|
|
367
|
+
bottom: z,
|
|
368
|
+
close: A
|
|
369
369
|
}), (b, F) => (P(), ge(xe, {
|
|
370
|
-
name:
|
|
371
|
-
onBeforeEnter: (W) =>
|
|
370
|
+
name: v(a).b("fade"),
|
|
371
|
+
onBeforeEnter: (W) => o.value = !0,
|
|
372
372
|
onBeforeLeave: b.onClose,
|
|
373
373
|
onAfterLeave: (W) => b.$emit("destroy"),
|
|
374
374
|
persisted: ""
|
|
375
375
|
}, {
|
|
376
376
|
default: j(() => [
|
|
377
|
-
|
|
377
|
+
$e(I("div", {
|
|
378
378
|
id: b.id,
|
|
379
379
|
ref_key: "messageRef",
|
|
380
380
|
ref: r,
|
|
381
381
|
class: V([
|
|
382
|
-
|
|
383
|
-
{ [
|
|
384
|
-
|
|
385
|
-
|
|
382
|
+
v(a).b(),
|
|
383
|
+
{ [v(a).m(b.type)]: b.type },
|
|
384
|
+
v(a).is("closable", b.showClose),
|
|
385
|
+
v(a).is("plain", b.plain),
|
|
386
386
|
b.customClass
|
|
387
387
|
]),
|
|
388
|
-
style: _e(
|
|
388
|
+
style: _e(v(Y)),
|
|
389
389
|
role: "alert",
|
|
390
390
|
onMouseenter: G,
|
|
391
391
|
onMouseleave: Z
|
|
392
392
|
}, [
|
|
393
|
-
b.repeatNum > 1 ? (P(), ge(
|
|
393
|
+
b.repeatNum > 1 ? (P(), ge(v(on), {
|
|
394
394
|
key: 0,
|
|
395
395
|
value: b.repeatNum,
|
|
396
|
-
type:
|
|
397
|
-
class: V(
|
|
396
|
+
type: v(p),
|
|
397
|
+
class: V(v(a).e("badge"))
|
|
398
398
|
}, null, 8, ["value", "type", "class"])) : q("v-if", !0),
|
|
399
|
-
|
|
399
|
+
v(E) ? (P(), ge(v(Re), {
|
|
400
400
|
key: 1,
|
|
401
|
-
class: V([
|
|
401
|
+
class: V([v(a).e("icon"), v(u)])
|
|
402
402
|
}, {
|
|
403
403
|
default: j(() => [
|
|
404
|
-
(P(), ge(Nt(
|
|
404
|
+
(P(), ge(Nt(v(E))))
|
|
405
405
|
]),
|
|
406
406
|
_: 1
|
|
407
407
|
}, 8, ["class"])) : q("v-if", !0),
|
|
@@ -409,36 +409,36 @@ const st = [
|
|
|
409
409
|
b.dangerouslyUseHTMLString ? (P(), R(ve, { key: 1 }, [
|
|
410
410
|
q(" Caution here, message could've been compromised, never use user's input as message "),
|
|
411
411
|
I("p", {
|
|
412
|
-
class: V(
|
|
412
|
+
class: V(v(a).e("content")),
|
|
413
413
|
innerHTML: b.message
|
|
414
414
|
}, null, 10, ["innerHTML"])
|
|
415
415
|
], 2112)) : (P(), R("p", {
|
|
416
416
|
key: 0,
|
|
417
|
-
class: V(
|
|
417
|
+
class: V(v(a).e("content"))
|
|
418
418
|
}, de(b.message), 3))
|
|
419
419
|
]),
|
|
420
|
-
b.showClose ? (P(), ge(
|
|
420
|
+
b.showClose ? (P(), ge(v(Re), {
|
|
421
421
|
key: 2,
|
|
422
|
-
class: V(
|
|
423
|
-
onClick: Rt(
|
|
422
|
+
class: V(v(a).e("closeBtn")),
|
|
423
|
+
onClick: Rt(A, ["stop"])
|
|
424
424
|
}, {
|
|
425
425
|
default: j(() => [
|
|
426
|
-
|
|
426
|
+
K(v(s))
|
|
427
427
|
]),
|
|
428
428
|
_: 1
|
|
429
429
|
}, 8, ["class", "onClick"])) : q("v-if", !0)
|
|
430
430
|
], 46, ["id"]), [
|
|
431
|
-
[
|
|
431
|
+
[et, h.value]
|
|
432
432
|
])
|
|
433
433
|
]),
|
|
434
434
|
_: 3
|
|
435
435
|
}, 8, ["name", "onBeforeEnter", "onBeforeLeave", "onAfterLeave"]));
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
|
-
var pn = /* @__PURE__ */
|
|
438
|
+
var pn = /* @__PURE__ */ Ze(un, [["__file", "message.vue"]]);
|
|
439
439
|
let gn = 1;
|
|
440
|
-
const
|
|
441
|
-
const e = !
|
|
440
|
+
const it = (l) => {
|
|
441
|
+
const e = !l || Oe(l) || nt(l) || Pe(l) ? { message: l } : l, t = {
|
|
442
442
|
...N,
|
|
443
443
|
...e
|
|
444
444
|
};
|
|
@@ -446,54 +446,54 @@ const at = (c) => {
|
|
|
446
446
|
t.appendTo = document.body;
|
|
447
447
|
else if (Oe(t.appendTo)) {
|
|
448
448
|
let n = document.querySelector(t.appendTo);
|
|
449
|
-
|
|
449
|
+
kt(n) || (n = document.body), t.appendTo = n;
|
|
450
450
|
}
|
|
451
451
|
return Le(T.grouping) && !t.grouping && (t.grouping = T.grouping), fe(T.duration) && t.duration === 3e3 && (t.duration = T.duration), fe(T.offset) && t.offset === 16 && (t.offset = T.offset), Le(T.showClose) && !t.showClose && (t.showClose = T.showClose), Le(T.plain) && !t.plain && (t.plain = T.plain), t;
|
|
452
|
-
}, vn = (
|
|
453
|
-
const e = H.indexOf(
|
|
452
|
+
}, vn = (l) => {
|
|
453
|
+
const e = H.indexOf(l);
|
|
454
454
|
if (e === -1)
|
|
455
455
|
return;
|
|
456
456
|
H.splice(e, 1);
|
|
457
|
-
const { handler: t } =
|
|
457
|
+
const { handler: t } = l;
|
|
458
458
|
t.close();
|
|
459
|
-
}, fn = ({ appendTo:
|
|
460
|
-
const n = `message_${gn++}`,
|
|
459
|
+
}, fn = ({ appendTo: l, ...e }, t) => {
|
|
460
|
+
const n = `message_${gn++}`, s = e.onClose, o = document.createElement("div"), a = {
|
|
461
461
|
...e,
|
|
462
462
|
id: n,
|
|
463
463
|
onClose: () => {
|
|
464
|
-
|
|
464
|
+
s?.(), vn(r);
|
|
465
465
|
},
|
|
466
466
|
onDestroy: () => {
|
|
467
|
-
|
|
467
|
+
Te(null, o);
|
|
468
468
|
}
|
|
469
|
-
},
|
|
470
|
-
default:
|
|
469
|
+
}, c = K(pn, a, Pe(a.message) || nt(a.message) ? {
|
|
470
|
+
default: Pe(a.message) ? a.message : () => a.message
|
|
471
471
|
} : null);
|
|
472
|
-
|
|
473
|
-
const
|
|
472
|
+
c.appContext = t || ce._context, Te(c, o), l.appendChild(o.firstElementChild);
|
|
473
|
+
const d = c.component, r = {
|
|
474
474
|
id: n,
|
|
475
|
-
vnode:
|
|
476
|
-
vm:
|
|
475
|
+
vnode: c,
|
|
476
|
+
vm: d,
|
|
477
477
|
handler: {
|
|
478
478
|
close: () => {
|
|
479
|
-
|
|
479
|
+
d.exposed.close();
|
|
480
480
|
}
|
|
481
481
|
},
|
|
482
|
-
props:
|
|
482
|
+
props: c.component.props
|
|
483
483
|
};
|
|
484
484
|
return r;
|
|
485
|
-
}, ce = (
|
|
485
|
+
}, ce = (l = {}, e) => {
|
|
486
486
|
if (!De)
|
|
487
487
|
return { close: () => {
|
|
488
488
|
} };
|
|
489
|
-
const t =
|
|
489
|
+
const t = it(l);
|
|
490
490
|
if (t.grouping && H.length) {
|
|
491
|
-
const
|
|
491
|
+
const s = H.find(({ vnode: o }) => {
|
|
492
492
|
var a;
|
|
493
|
-
return ((a =
|
|
493
|
+
return ((a = o.props) == null ? void 0 : a.message) === t.message;
|
|
494
494
|
});
|
|
495
|
-
if (
|
|
496
|
-
return
|
|
495
|
+
if (s)
|
|
496
|
+
return s.props.repeatNum += 1, s.props.type = t.type, s.handler;
|
|
497
497
|
}
|
|
498
498
|
if (fe(T.max) && H.length >= T.max)
|
|
499
499
|
return { close: () => {
|
|
@@ -501,20 +501,20 @@ const at = (c) => {
|
|
|
501
501
|
const n = fn(t, e);
|
|
502
502
|
return H.push(n), n.handler;
|
|
503
503
|
};
|
|
504
|
-
|
|
505
|
-
ce[
|
|
506
|
-
const n =
|
|
507
|
-
return ce({ ...n, type:
|
|
504
|
+
at.forEach((l) => {
|
|
505
|
+
ce[l] = (e = {}, t) => {
|
|
506
|
+
const n = it(e);
|
|
507
|
+
return ce({ ...n, type: l }, t);
|
|
508
508
|
};
|
|
509
509
|
});
|
|
510
|
-
function wn(
|
|
510
|
+
function wn(l) {
|
|
511
511
|
const e = [...H];
|
|
512
512
|
for (const t of e)
|
|
513
|
-
(!
|
|
513
|
+
(!l || l === t.props.type) && t.handler.close();
|
|
514
514
|
}
|
|
515
515
|
ce.closeAll = wn;
|
|
516
516
|
ce._context = null;
|
|
517
|
-
const L =
|
|
517
|
+
const L = It(ce, "$message");
|
|
518
518
|
class O extends Se {
|
|
519
519
|
_renderer;
|
|
520
520
|
get renderer() {
|
|
@@ -582,9 +582,9 @@ class O extends Se {
|
|
|
582
582
|
*/
|
|
583
583
|
createCursor(e) {
|
|
584
584
|
return (t, n) => {
|
|
585
|
-
const
|
|
585
|
+
const s = this.domElement.style.cursor;
|
|
586
586
|
this.domElement.style.cursor = e, this.addEventRecord("clear", () => {
|
|
587
|
-
this.domElement.style.cursor =
|
|
587
|
+
this.domElement.style.cursor = s ?? "default";
|
|
588
588
|
}), t(n);
|
|
589
589
|
};
|
|
590
590
|
}
|
|
@@ -603,16 +603,16 @@ class O extends Se {
|
|
|
603
603
|
* @returns
|
|
604
604
|
*/
|
|
605
605
|
createPointerMove(e) {
|
|
606
|
-
const t = this.editor, n = new
|
|
607
|
-
let
|
|
608
|
-
const
|
|
609
|
-
const
|
|
610
|
-
if (
|
|
611
|
-
const i = Math.abs(
|
|
612
|
-
i > r ? n.set(
|
|
613
|
-
} else if (
|
|
614
|
-
const i =
|
|
615
|
-
i && r ?
|
|
606
|
+
const t = this.editor, n = new _();
|
|
607
|
+
let s = null, o = null, a = null;
|
|
608
|
+
const c = t.addEventListener("pointerPositionChange", () => {
|
|
609
|
+
const d = _.from(t.pointerPosition);
|
|
610
|
+
if (s && t.eventInput.isKeyDown("shift")) {
|
|
611
|
+
const i = Math.abs(d.x - s.x), r = Math.abs(d.y - s.y);
|
|
612
|
+
i > r ? n.set(d.x, s.y) : n.set(s.x, d.y), e(n, !1);
|
|
613
|
+
} else if (o && a && t.eventInput.isKeyDown("alt")) {
|
|
614
|
+
const i = o.projectPoint(d, !1), r = a.projectPoint(d, !1);
|
|
615
|
+
i && r ? d.distance(i) < d.distance(r) ? n.copy(i) : n.copy(r) : i ? n.copy(i) : r && n.copy(r), e(n, !1);
|
|
616
616
|
} else {
|
|
617
617
|
const { point: i, find: r, line: h } = t.renderManager.adsorption();
|
|
618
618
|
n.copy(i), e(n, r, h);
|
|
@@ -620,11 +620,11 @@ class O extends Se {
|
|
|
620
620
|
});
|
|
621
621
|
return {
|
|
622
622
|
destroy() {
|
|
623
|
-
|
|
623
|
+
c();
|
|
624
624
|
},
|
|
625
|
-
setBaseLine(
|
|
626
|
-
if (
|
|
627
|
-
const r =
|
|
625
|
+
setBaseLine(d, i) {
|
|
626
|
+
if (o = d, s = i, d && i) {
|
|
627
|
+
const r = d.normal();
|
|
628
628
|
a = new B(
|
|
629
629
|
i.clone().add(r.clone().multiplyScalar(10)),
|
|
630
630
|
i.clone().add(r.multiplyScalar(-10))
|
|
@@ -651,7 +651,7 @@ class yn extends O {
|
|
|
651
651
|
* @param next
|
|
652
652
|
*/
|
|
653
653
|
selectPoint(e) {
|
|
654
|
-
let t = this.parent?.findComponentByName("Editor"), n = null,
|
|
654
|
+
let t = this.parent?.findComponentByName("Editor"), n = null, s = null, o = [], a = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 65280 })), c = t.domContainer.domElement, d = new we([], 16711935), i = new we([
|
|
655
655
|
new m.Vector3(-1e4, 0, 0),
|
|
656
656
|
new m.Vector3(1e4, 0, 0),
|
|
657
657
|
new m.Vector3(0, -1e4, 0),
|
|
@@ -662,13 +662,13 @@ class yn extends O {
|
|
|
662
662
|
dashSize: 0.1,
|
|
663
663
|
gapSize: 0.1,
|
|
664
664
|
linewidth: 0.1
|
|
665
|
-
}), this.container.add(
|
|
665
|
+
}), this.container.add(d);
|
|
666
666
|
const r = () => {
|
|
667
|
-
|
|
667
|
+
d.setPoint(...o, n, s), i.position.copy(s), this.container.add(i), i.computeLineDistances();
|
|
668
668
|
}, h = new m.Vector3();
|
|
669
|
-
let
|
|
669
|
+
let y;
|
|
670
670
|
const f = this.createPointerMove((p, u, E) => {
|
|
671
|
-
h.set(p.x, p.y, 0), this.dispatchEvent({ type: "pointerMove", point: h }),
|
|
671
|
+
h.set(p.x, p.y, 0), this.dispatchEvent({ type: "pointerMove", point: h }), y = E, u ? (a.position.set(p.x, p.y, 0), this.container.add(a), c.style.cursor = "none") : (a.removeFromParent(), c.style.cursor = "crosshair"), n && s && (r(), s.copy(h));
|
|
672
672
|
});
|
|
673
673
|
this.addEventRecord(
|
|
674
674
|
"clear",
|
|
@@ -676,24 +676,24 @@ class yn extends O {
|
|
|
676
676
|
t.eventInput.addEventListener("codeChange", async () => {
|
|
677
677
|
if (t.eventInput.isKeyDown("mouse_0")) {
|
|
678
678
|
if (!n) {
|
|
679
|
-
n = h.clone(),
|
|
679
|
+
n = h.clone(), s = h.clone(), r(), f.setBaseLine(y ?? null, _.from(n));
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
682
|
-
|
|
683
|
-
const p = new B(
|
|
684
|
-
f.setBaseLine(p, p.end), n.copy(
|
|
682
|
+
s = h.clone(), o.push(n.clone(), s.clone());
|
|
683
|
+
const p = new B(_.from(n), _.from(s));
|
|
684
|
+
f.setBaseLine(p, p.end), n.copy(s), r();
|
|
685
685
|
} else if (t.eventInput.isOnlyKeyDowns(this.withdrawalKeys)) {
|
|
686
|
-
if (
|
|
686
|
+
if (o.length) {
|
|
687
687
|
const { point: p } = t.renderManager.adsorption();
|
|
688
|
-
if (
|
|
689
|
-
const u = new B(
|
|
688
|
+
if (o.pop(), s?.copy(p), n?.copy(o.pop()), r(), o.length >= 2) {
|
|
689
|
+
const u = new B(_.from(o[o.length - 2]), _.from(o[o.length - 1]));
|
|
690
690
|
f.setBaseLine(u, u.end);
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
|
-
} else t.eventInput.isKeyDowns(this.confirmKeys) && e(
|
|
693
|
+
} else t.eventInput.isKeyDowns(this.confirmKeys) && e(o);
|
|
694
694
|
}),
|
|
695
695
|
function() {
|
|
696
|
-
|
|
696
|
+
d.removeFromParent(), a.removeFromParent(), i.removeFromParent();
|
|
697
697
|
}
|
|
698
698
|
);
|
|
699
699
|
}
|
|
@@ -702,8 +702,8 @@ class yn extends O {
|
|
|
702
702
|
*/
|
|
703
703
|
end(e, t) {
|
|
704
704
|
const n = [];
|
|
705
|
-
for (let
|
|
706
|
-
n.push(new B(
|
|
705
|
+
for (let s = 0; s < t.length; s += 2)
|
|
706
|
+
n.push(new B(_.from(t[s]), _.from(t[s + 1])));
|
|
707
707
|
e(n);
|
|
708
708
|
}
|
|
709
709
|
/** 执行完成
|
|
@@ -725,7 +725,7 @@ class yn extends O {
|
|
|
725
725
|
return this.completed(e), e;
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
|
-
class
|
|
728
|
+
class rt extends O {
|
|
729
729
|
static name = "Default";
|
|
730
730
|
container = new m.Group();
|
|
731
731
|
onAddFromParent() {
|
|
@@ -778,18 +778,18 @@ class it extends O {
|
|
|
778
778
|
* @param next
|
|
779
779
|
*/
|
|
780
780
|
start() {
|
|
781
|
-
const e = this.editor, t = e.eventInput, n = new m.Mesh(),
|
|
782
|
-
let
|
|
781
|
+
const e = this.editor, t = e.eventInput, n = new m.Mesh(), s = e.domContainer.domElement;
|
|
782
|
+
let o = null;
|
|
783
783
|
n.position.z = 1e-3, this.selectLineObject3D.position.z = n.position.z + 1e-3, n.material = new m.MeshBasicMaterial({ color: 55561 });
|
|
784
784
|
const a = () => {
|
|
785
|
-
const
|
|
785
|
+
const d = e.pointerPosition.clone(), i = e.pointerPosition.clone(), r = new m.Mesh();
|
|
786
786
|
this.container.add(r), r.position.z = 0.05, r.material = new m.MeshBasicMaterial({
|
|
787
787
|
color: 16777215,
|
|
788
788
|
transparent: !0,
|
|
789
789
|
opacity: 0.5
|
|
790
790
|
});
|
|
791
791
|
const h = () => {
|
|
792
|
-
const p = Math.min(
|
|
792
|
+
const p = Math.min(d.x, i.x), u = Math.max(d.x, i.x), E = Math.min(d.y, i.y), x = Math.max(d.y, i.y), k = [
|
|
793
793
|
p,
|
|
794
794
|
x,
|
|
795
795
|
0,
|
|
@@ -810,48 +810,48 @@ class it extends O {
|
|
|
810
810
|
0
|
|
811
811
|
];
|
|
812
812
|
r.geometry = e.renderManager.createGeometry({ position: k }, k.length / 3);
|
|
813
|
-
},
|
|
813
|
+
}, y = () => {
|
|
814
814
|
i.copy(e.pointerPosition), h();
|
|
815
815
|
}, f = () => {
|
|
816
|
-
document.removeEventListener("mousemove",
|
|
817
|
-
const p = Math.min(
|
|
818
|
-
this.removeSelectLineAll(),
|
|
816
|
+
document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", f), r.removeFromParent();
|
|
817
|
+
const p = Math.min(d.x, i.x), u = Math.max(d.x, i.x), E = Math.min(d.y, i.y), x = Math.max(d.y, i.y), k = new Ye(p, u, E, x), z = e.renderManager.quadtree.queryBox(k);
|
|
818
|
+
this.removeSelectLineAll(), z.forEach((Y) => this.addSelectLine(Y.line)), this.updateSelectLinesGeometry();
|
|
819
819
|
};
|
|
820
|
-
document.addEventListener("mousemove",
|
|
821
|
-
},
|
|
820
|
+
document.addEventListener("mousemove", y), document.addEventListener("mouseup", f);
|
|
821
|
+
}, c = this.renderer.createText("", new m.Vector3(0, 0, 0), {
|
|
822
822
|
background: "rgba(0,0,0,0.5)",
|
|
823
823
|
padding: "2px",
|
|
824
824
|
borderRadius: "2px"
|
|
825
825
|
}, this.container);
|
|
826
|
-
|
|
826
|
+
c.visible = !1, this.addEventRecord(
|
|
827
827
|
"clear",
|
|
828
828
|
// 注册鼠标指针位置变化事件
|
|
829
829
|
e.addEventListener("pointerPositionChange", () => {
|
|
830
|
-
const { line:
|
|
831
|
-
if (
|
|
832
|
-
const i =
|
|
833
|
-
n.geometry = e.renderManager.createGeometry({ position: i.createGeometry() }, 6), this.container.add(n),
|
|
834
|
-
const r =
|
|
835
|
-
|
|
830
|
+
const { line: d } = e.renderManager.adsorption();
|
|
831
|
+
if (d) {
|
|
832
|
+
const i = d.expandToRectangle(0.025, "bothSides");
|
|
833
|
+
n.geometry = e.renderManager.createGeometry({ position: i.createGeometry() }, 6), this.container.add(n), s.style.cursor = "pointer", o = d;
|
|
834
|
+
const r = d.center;
|
|
835
|
+
c.element.innerText = parseInt(d.length() * 1e3 + "") + " mm", c.position.set(r.x, r.y, 0), c.visible = !0;
|
|
836
836
|
} else
|
|
837
|
-
n.removeFromParent(),
|
|
837
|
+
n.removeFromParent(), s.style.cursor = "default", o = null, c.visible = !1;
|
|
838
838
|
}),
|
|
839
839
|
t.addEventListener("codeChange", () => {
|
|
840
840
|
if (t.isKeyDown("mouse_0")) {
|
|
841
|
-
if (!
|
|
841
|
+
if (!o) return a();
|
|
842
842
|
if (t.isKeyDown("alt"))
|
|
843
|
-
return this.removeSelectLine(
|
|
844
|
-
t.isKeyDown("control") || this.removeSelectLineAll(), this.addSelectLine(
|
|
843
|
+
return this.removeSelectLine(o);
|
|
844
|
+
t.isKeyDown("control") || this.removeSelectLineAll(), this.addSelectLine(o);
|
|
845
845
|
} else if (t.isKeyDown("mouse_1")) {
|
|
846
|
-
if (!
|
|
847
|
-
this.removeSelectLine(
|
|
846
|
+
if (!o) return;
|
|
847
|
+
this.removeSelectLine(o);
|
|
848
848
|
} else if (t.isKeyDown("mouse_2")) {
|
|
849
|
-
if (!
|
|
850
|
-
this.addSelectLine(
|
|
849
|
+
if (!o) return;
|
|
850
|
+
this.addSelectLine(o);
|
|
851
851
|
} else t.isKeyDowns(["control", "z"]) ? e.commandManager.rollback() : t.isKeyDowns(["control", "y"]) && e.commandManager.revokeRollback();
|
|
852
852
|
}),
|
|
853
853
|
function() {
|
|
854
|
-
n.removeFromParent(),
|
|
854
|
+
n.removeFromParent(), c.removeFromParent();
|
|
855
855
|
}
|
|
856
856
|
);
|
|
857
857
|
}
|
|
@@ -862,7 +862,7 @@ class it extends O {
|
|
|
862
862
|
this.canceEventRecord("clear"), this.removeSelectLineAll(), this.updateSelectLinesGeometry();
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
|
-
class bn extends
|
|
865
|
+
class bn extends Xe {
|
|
866
866
|
list = [];
|
|
867
867
|
rollbacklist = [];
|
|
868
868
|
revokeRollbacklist = [];
|
|
@@ -890,7 +890,7 @@ class bn extends Ye {
|
|
|
890
890
|
return this.revokeRollbacklist.push(e), this;
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
|
-
class xn extends
|
|
893
|
+
class xn extends Xe {
|
|
894
894
|
commandFlowMap = /* @__PURE__ */ new Map();
|
|
895
895
|
lock = !1;
|
|
896
896
|
abortController = null;
|
|
@@ -934,25 +934,25 @@ class xn extends Ye {
|
|
|
934
934
|
currentName: this.currentName
|
|
935
935
|
}), this.executionPromise && await this.executionPromise, this.executionPromise = null, this.lock)
|
|
936
936
|
throw new Error("命令管理器已被 " + this.currentName + " 命令锁定,无法启动新的命令流,请退出或等待命令执行结束");
|
|
937
|
-
const
|
|
938
|
-
if (!
|
|
937
|
+
const s = this.commandFlowMap.get(e);
|
|
938
|
+
if (!s)
|
|
939
939
|
throw new Error(`命令流 ${e} 不存在`);
|
|
940
|
-
this.lock = !0, this.abortController = new AbortController(), this.currentName = e,
|
|
940
|
+
this.lock = !0, this.abortController = new AbortController(), this.currentName = e, s.dispatchEvent({ type: "started" }), this.dispatchEvent({ type: "started", name: e });
|
|
941
941
|
try {
|
|
942
|
-
for (let
|
|
943
|
-
const a =
|
|
944
|
-
if (
|
|
945
|
-
this.resolve =
|
|
942
|
+
for (let o = n; o < s.list.length; o++) {
|
|
943
|
+
const a = s.list[o];
|
|
944
|
+
if (s.dispatchEvent({ type: "executing", index: o }), this.dispatchEvent({ type: "executing", name: e, index: o }), t = await new Promise((c) => {
|
|
945
|
+
this.resolve = c, a(c, t);
|
|
946
946
|
}), this.abortController.signal.aborted) {
|
|
947
|
-
|
|
947
|
+
s.dispatchEvent({ type: "executionInterrupt", index: o }), this.dispatchEvent({ type: "executionInterrupt", name: e, index: o }), this.dispatchEvent({ type: "cancel", name: e });
|
|
948
948
|
break;
|
|
949
949
|
} else
|
|
950
|
-
|
|
950
|
+
s.dispatchEvent({ type: "executionCompleted", index: o, data: t }), this.dispatchEvent({ type: "executionCompleted", name: e, index: o, data: t });
|
|
951
951
|
}
|
|
952
|
-
} catch (
|
|
953
|
-
console.error(
|
|
952
|
+
} catch (o) {
|
|
953
|
+
console.error(o);
|
|
954
954
|
} finally {
|
|
955
|
-
this.abortController && !this.abortController.signal.aborted && (
|
|
955
|
+
this.abortController && !this.abortController.signal.aborted && (s.dispatchEvent({ type: "completed", data: t }), this.dispatchEvent({ type: "completed", name: e, data: t }), s.writeOperationList && (this.operationList.push({ name: e, data: t }), this.rollbackList.length = 0)), this.lock = !1, this.abortController = null, this.currentName = null, s.dispatchEvent({ type: "finally" }), this.dispatchEvent({ type: "finally", name: e }), this.executionResolve && (this.executionResolve(null), this.executionResolve = null);
|
|
956
956
|
}
|
|
957
957
|
return t;
|
|
958
958
|
}
|
|
@@ -970,7 +970,7 @@ class xn extends Ye {
|
|
|
970
970
|
if (!e) return !1;
|
|
971
971
|
const t = this.commandFlowMap.get(e.name);
|
|
972
972
|
if (!t) return !1;
|
|
973
|
-
const n = t.rollbacklist.reduce((
|
|
973
|
+
const n = t.rollbacklist.reduce((s, o) => o(s), e.data);
|
|
974
974
|
return this.dispatchEvent({ type: "rollback", name: e.name }), this.rollbackList.push({
|
|
975
975
|
data: n,
|
|
976
976
|
name: e.name
|
|
@@ -988,7 +988,7 @@ class xn extends Ye {
|
|
|
988
988
|
if (!e) return !1;
|
|
989
989
|
const t = this.commandFlowMap.get(e.name);
|
|
990
990
|
if (!t) return !1;
|
|
991
|
-
const n = t.revokeRollbacklist.reduce((
|
|
991
|
+
const n = t.revokeRollbacklist.reduce((s, o) => o(s), e.data);
|
|
992
992
|
return this.dispatchEvent({ type: "revokeRollback", name: e.name }), this.operationList.push({ name: e.name, data: n }), !0;
|
|
993
993
|
} catch (e) {
|
|
994
994
|
throw new Error(`撤回回滚失败:${e}`);
|
|
@@ -1019,9 +1019,9 @@ const Cn = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
|
|
|
1019
1019
|
}, Symbol.toStringTag, { value: "Module" })), On = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1757902422799'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1735'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M843.2%20726.4c-20.2%200-39.2%205.2-55.8%2014.3L283.8%20237.2c9-16.5%2014.1-35.4%2014.1-55.5%200-64.2-52.3-116.5-116.5-116.5S65%20117.4%2065%20181.6s52.3%20116.5%20116.5%20116.5c20.2%200%2039.2-5.2%2055.8-14.2l503.5%20503.5c-9%2016.5-14.1%2035.4-14.1%2055.5%200%2064.2%2052.3%20116.5%20116.5%20116.5s116.5-52.3%20116.5-116.5-52.3-116.5-116.5-116.5zM181.4%20232.1c-27.8%200-50.5-22.6-50.5-50.5s22.6-50.5%2050.5-50.5%2050.5%2022.6%2050.5%2050.5-22.6%2050.5-50.5%2050.5z%20m661.8%20661.3c-27.8%200-50.5-22.6-50.5-50.5%200-27.8%2022.6-50.5%2050.5-50.5s50.5%2022.6%2050.5%2050.5c0%2027.8-22.7%2050.5-50.5%2050.5z'%20fill='%23231815'%20p-id='1736'%3e%3c/path%3e%3c/svg%3e", Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1020
1020
|
__proto__: null,
|
|
1021
1021
|
default: On
|
|
1022
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1022
|
+
}, Symbol.toStringTag, { value: "Module" })), Kn = "data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M114.176%2046.528h618.496c37.312%200.064%2067.584%2030.336%2067.648%2067.648v618.56c0%2037.248-30.336%2067.584-67.648%2067.584H114.176A67.776%2067.776%200%200%201%2046.528%20732.8V114.176c0-37.312%2030.336-67.648%2067.648-67.648z%20m2.176%20686.208l616.32-2.24-2.176-616.32-614.144%202.176v616.32zM907.648%20291.2l2.176%20616.32H291.264a34.88%2034.88%200%201%200%200%2069.888h618.56c37.312%200%2067.648-30.336%2067.648-67.648V291.264a34.88%2034.88%200%201%200-69.824%200z'%20%3e%3c/path%3e%3c/svg%3e", zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1023
1023
|
__proto__: null,
|
|
1024
|
-
default:
|
|
1024
|
+
default: Kn
|
|
1025
1025
|
}, Symbol.toStringTag, { value: "Module" })), Tn = "data:image/svg+xml,%3csvg%20viewBox='0%200%201029%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M788.17984%2016l-55.424%2060.672%20116.48%20106.56H418.13184a410.816%20410.816%200%201%200%200%20821.632h547.712v-82.176H418.13184a328.64%20328.64%200%200%201%200-657.28l441.792-0.128-124.8%2098.368%2050.752%2064.512%20243.328-191.488L788.17984%2016z'%3e%3c/path%3e%3c/svg%3e", jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1026
1026
|
__proto__: null,
|
|
1027
1027
|
default: Tn
|
|
@@ -1043,14 +1043,14 @@ const Cn = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
|
|
|
1043
1043
|
}, Symbol.toStringTag, { value: "Module" })), Xn = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1757902547951'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='5129'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M59.355%2091.776v867.881h867.881V91.776H59.356zM897.31%20929.73H89.282V121.703h808.027V929.73z'%20fill=''%20p-id='5130'%3e%3c/path%3e%3cpath%20d='M833.964%20185.048H152.627v681.337h681.337V185.048z%20m-355.632%20651.41H182.554V532.2h295.778v304.257z%20m0-334.184H182.554V214.975h295.778v287.299z%20m325.705%20334.184H508.259V532.2h295.778v304.257z%20m0-334.184H508.259V214.975h295.778v287.299z'%20fill=''%20p-id='5131'%3e%3c/path%3e%3c/svg%3e", $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1044
1044
|
__proto__: null,
|
|
1045
1045
|
default: Xn
|
|
1046
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1047
|
-
class
|
|
1046
|
+
}, Symbol.toStringTag, { value: "Module" })), es = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAKdUlEQVR4AeydbZrUKBRGq2YjOjvpWYntStSVjK5EdzLOSsr7arBLOkkBAcLHmacwlQQInMsZUvdP/3Xhv+oEbrfbk5XYz1P1gfLAC4KwCCCwQwBBduBwCwIIwhqAwA4BBNmBwy0IFBQEuBDonwCC9B9DZlCQAIIUhEvX/RNAkP5jyAwKEkCQgnDpun8CfQrSP3dm0AkBBOkkUAzzHAIIcg53ntoJAQTpJFAM8xwCCHIOd57aCQEE8QLFKQTuCSDIPQ2+Q8AjgCAeEE4hcE8AQe5p8B0CHgEE8YBwCoF7AghyT6Psd3rvkACCdBg0hlyPAILUY82TOiSAIB0GjSHXI4Ag9VjzpA4JIEiHQXs9ZK6UIoAgpcjS7xAEEGSIMDKJUgQQpBRZ+h2CAIIMEUYmUYoAgpQiO0q/k88DQSZfAEx/nwCC7PPh7uQEEGTyBcD09wkgyD4f7k5OAEEmXwBnTr+HZyNID1FijKcRQBAP/e12e2vl2cqHUsUe+c5K7OddqfG4fmMHNEN9BPGifL1ev9ulN1Y+FizP1nfsR21Kjun/2AHNUB9BVqJsknyyy1qMdpji89nm/HmKmUZOEkE2gNmCkSTaTTZqDHP5m831/TCz+TWRbP8iyA5KWzh/2+2RJfluc/zH5shngwCCbIC5u6wFNKIkmhM7x12g174iyBqVu2v2f1gtpBFft97b3L7dTZWvKwQQZAWKf8kWkn7Aqvi3ej1HjsDIIUggKJNEu8gImS0yVoExV7XXgugqZZXAIoleuVbvd3CRjFVkkBAkEphJ0mtmi4xVZKxVHUFEIb70ltnSrkfGKj7OFwRJgGa7iBacfpPomNBD9Sb8KE9EjiCJ4EwSZbVUEnuo1gw5DqCuKsiBcTbZ1CTRLtJyZouM1cGVgyAHAS6StPiqRcbqYGzVHEFE4WAxSVrLbJGxOhhT1xxBHInjx1YyW9rNyFgdj+fPHhDkJ4bj/9guooWp3yQ6Hu8wvQd+lKeze9VyFEFeTeyMCyaJsloqZzxez0QOUchYECQjTHVlkmgXOSOzRcZKAchcECQzUHW3SFLzVYuMlcAXKAhSAKq6NElqZbbIWAl4oYIghcAu3ZbObGmXImO1wC5xQJCHVNMr2C6iBazfJDqmd7Tdkh/l22yy3EGQLBi3OzFJlNVS2a6Udgc50rhFtUKQKFxplU0S7SI5M1tkrNJCEd0KQaKRpTVYJMnxqkXGKi0ESa0QJAlbWiOT5Ghmi4xVGvrkVgiSjC654UtmK64L7T5krOKYHa6NIIcRxnVgu4gWun6T6BjTmB/lMbQy1UWQTCBjujFJlNVSCW2GHKGkMtdDkMxAQ7szSbSLhGS2yFiFQi1QD0EKQA3tcpFk71WLjFUozEL1EKQQ2NBuTZKtzNahjFXo86m3TwBB9vnUuutntrSrkLGqRX/nOQiyA6fWLdtFJIR+k+iox/KjXBQaKAjSQBA0BJNEWS0V5BCQRgqCNBIIDcMk+WRFkuiU0gABBGkgCJ0NYarhIshU4WaysQQQJJYY9acigCBThZvJxhJAkFhi1J+KAIJMFe7WJ9ve+BCkvZgwooYIIEhDwWAo7RFAkPZiwogaIoAgDQWDobRHAEHaiwkjKkEgsU8ESQRHszkIIMgccWaWiQQQJBEczeYggCBzxJlZJhJAkERwNJuDQIggc5BglhBYIZBNkNvt9kSBQStrYGWtJ13KJsjy9K92pFwuMDiXgS3DPJ/cguQZFb1AoBECCNJIIBhGmwROFqRNKIwKAo4AgjgSHCGwQgBBVqBwCQKOAII4EhwhsEIAQVagcAkCjsC4grgZcoTAAQIIcgAeTccngCDjx5gZHiCAIAfg0XR8ArkF0V9KolwuMDiXQTZzswlyvV71ByenKMy1/VjnMiSbILkGRD8QaIkAgrQUDcbSHAEEaS4kDKglAgjSUjQYS3MEEKStkDCaxgggSGMBYThtEUCQtuLBaBojgCCNBYThtEUAQdqKB6NpjACCNBaQcsOh5xQCCJJCjTbTEECQaULNRFMIIEgKNdpMQwBBpgk1E00hgCAp1GjzJ4GBzxBk4OAyteMEEOQ4Q3oYmACCNBTc2+32bOVDQ0OafigI0sgSMDGebCj/Wvlo39/akU8DBBCkgSAsQuiP7rjR/Ldcc+fTHs+eOIKcHIFFBO0c/ki+Lvf865xXJIAgFWFvPEpy6PXKv63XrA9I4mOpe44gdXn/8TRb/FtyuHrP9uWdFT4nEUCQk8CbHFr8Ko9GoB/tZLYeUSp0H0EKgd3r1uTQK5V2j71q9/ckiV657q/x/RiBoNYIEoQpXyWTQwv9PmMV2jmZrVBSGeshSEaYj7pa5IjZOfwuyWz5RAqfI0hhwF73kkOvV97l4FPtPmS2gnEdr4ggxxkG9WC7x1E53HP0w57MlqNR+IgghQGre5NDi1pFpzmKfrST2cpB8kEfaYI86JTbLwRMDr1Safd4uZjnmyTRK1ee3uhllQCCrGLJc9Hk0AJOyViFDoDMViipxHoIkgjuUbNFjhI7h/9oMls+kYznCJIRpteV5NDrlXc5+6l2KTJb2bH+6hBBfnHI+q/tHrXkcONWAoDMlqOR8dicIBnndkpXJocWq0rt5+tHO5mtzNQRJCNQk0OvVNo9MvYa1ZUk0StXVCMqbxNAkG02UXdMDi3Mkhmr0PGQ2QolFVAPQQIgPaqyyHHmzuEPkcyWTyTxHEESwXnNJIder7zLp51qNyOzlQH/TIJkwPW6C9s9WpPDDVKJAjJbjkbiEUESwamZyaFFqKLTFot+tJPZOhAZBEmEZ3LolUq7R2IP1ZpJEr1yVXvgSA9CkIRomhxacC1krEJHT2YrlJRXD0E8II9OFzl62Dn8qZDZ8okEnCNIACSviuTQ69Xd5S6+atcjsxUZKgSJAGa7R69yuFkqoUBmy9EIOCJIACRVMTm0uFR02nPRj3YyW4ERRJAAUCaHXqm0ewTU7qKKJNErVxeDPXOQCPKAvsmhhdRTxurBjH7fJrP1G8X2FwTZZnNZ5Dh359gZX4ZbZLYeQESQfUCSQ69X+7X6vavdkczWTvwQZAOO7R6jy+FmrsQDmS1HwzsiiAdEpyaHFo2KTmco+tFOZmsl0giyAsUuvbHysWD5bH3HftSm5JhixzNFfQRZCfP1ev10LVjskV+sxH6+5B6T31/sgGaojyAzRJk5JhNAkGR0NJyBAILMEGXmmEwAQZLR0XAGAggyQ5Trz3GYJyLIMKFkIiUIIEgJqvQ5DAEEGSaUTKQEAQQpQZU+hyGAIMOEcpaJ1J0ngtTlzdM6I4AgnQWM4dYlgCB1efO0zgggSGcBY7h1CSBIXd48rWUCK2NDkBUoXIKAI4AgjgRHCKwQQJAVKFyCgCOAII4ERwisEECQFShcgoAjkEsQ1x9HCAxFAEGGCieTyU0AQXITpb+hCCDIUOFkMrkJIEhuovQ3FIEOBBmKN5PpjACCdBYwhluXAILU5c3TOiOAIJ0FjOHWJYAgdXnztM4IzC1IZ8FiuPUJIEh95jyxIwII0lGwGGp9AghSnzlP7IgAgnQULIZanwCCFGJOt2MQ+AEAAP//U3PGlQAAAAZJREFUAwA3ILMm/jaVEAAAAABJRU5ErkJggg==", ts = new m.TextureLoader(), ns = ts.load(es);
|
|
1047
|
+
class ss extends Se {
|
|
1048
1048
|
static name = "RenderManager";
|
|
1049
1049
|
container = new m.Group();
|
|
1050
1050
|
lines = [];
|
|
1051
|
-
pointVirtualGrid = new
|
|
1052
|
-
quadtree = new ze(new
|
|
1053
|
-
verticalReferenceLineFlag = new m.Mesh(new m.PlaneGeometry(0.3, 0.3), new m.MeshBasicMaterial({ map:
|
|
1051
|
+
pointVirtualGrid = new Ke();
|
|
1052
|
+
quadtree = new ze(new Ye());
|
|
1053
|
+
verticalReferenceLineFlag = new m.Mesh(new m.PlaneGeometry(0.3, 0.3), new m.MeshBasicMaterial({ map: ns, color: 58111, transparent: !0 }));
|
|
1054
1054
|
onAddFromParent() {
|
|
1055
1055
|
const e = this.dxfLineModel;
|
|
1056
1056
|
this.editor.container.add(this.container), this.editor.container.add(e.dxfModelGroup), e.dxfLineModel.material = new m.LineBasicMaterial({
|
|
@@ -1070,7 +1070,7 @@ class oo extends Se {
|
|
|
1070
1070
|
return;
|
|
1071
1071
|
} else
|
|
1072
1072
|
this.updatedMode = "dxf";
|
|
1073
|
-
this.pointVirtualGrid = new
|
|
1073
|
+
this.pointVirtualGrid = new Ke();
|
|
1074
1074
|
const e = this.dxf.box.clone().expansion(Math.max(this.dxf.box.width, this.dxf.box.height) * 2);
|
|
1075
1075
|
(e.width === 0 || e.height === 0) && e.set(-200, -200, 200, 200), this.quadtree = new ze(e), this.lines.length = 0, this.dxf.lineSegments.forEach((t) => {
|
|
1076
1076
|
t.userData.isDoor || this.addLine(t.clone());
|
|
@@ -1101,11 +1101,11 @@ class oo extends Se {
|
|
|
1101
1101
|
for (let t = 0; t < e.length; t++) {
|
|
1102
1102
|
const n = e[t];
|
|
1103
1103
|
this.lines.push(n), this.pointVirtualGrid.insert(n.start, n), this.pointVirtualGrid.insert(n.end, n);
|
|
1104
|
-
const
|
|
1104
|
+
const s = {
|
|
1105
1105
|
line: n,
|
|
1106
1106
|
userData: void 0
|
|
1107
1107
|
};
|
|
1108
|
-
n.userData.quadtreeNode =
|
|
1108
|
+
n.userData.quadtreeNode = s, this.quadtree.insert(s);
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
1111
|
/** 移除线段
|
|
@@ -1124,8 +1124,8 @@ class oo extends Se {
|
|
|
1124
1124
|
for (let t = 0; t < e.length; t++) {
|
|
1125
1125
|
const n = e[t];
|
|
1126
1126
|
n.userData.quadtreeNode && this.quadtree.remove(n.userData.quadtreeNode), this.pointVirtualGrid.remove(n.start), this.pointVirtualGrid.remove(n.end);
|
|
1127
|
-
const
|
|
1128
|
-
this.lines.splice(
|
|
1127
|
+
const s = this.lines.indexOf(n);
|
|
1128
|
+
this.lines.splice(s, 1);
|
|
1129
1129
|
}
|
|
1130
1130
|
this.draw();
|
|
1131
1131
|
}
|
|
@@ -1134,15 +1134,15 @@ class oo extends Se {
|
|
|
1134
1134
|
*/
|
|
1135
1135
|
draw(e = !0) {
|
|
1136
1136
|
this.container.clear();
|
|
1137
|
-
const t = [], n = [],
|
|
1138
|
-
this.lines.forEach((
|
|
1139
|
-
if (
|
|
1140
|
-
|
|
1141
|
-
}),
|
|
1142
|
-
const
|
|
1143
|
-
|
|
1144
|
-
}),
|
|
1145
|
-
const a =
|
|
1137
|
+
const t = [], n = [], s = [];
|
|
1138
|
+
this.lines.forEach((o) => {
|
|
1139
|
+
if (o.points.forEach((a) => {
|
|
1140
|
+
o.userData.isDoor ? n.push(a.x, a.y, 0) : t.push(a.x, a.y, 0);
|
|
1141
|
+
}), o.userData.isWindow && o.userData.drawWindow && o.userData.drawWindow.forEach(({ width: a, p: c }) => {
|
|
1142
|
+
const d = _.from(c), i = o.direction(), r = d.clone().add(i.clone().multiplyScalar(a * 0.5)), h = d.clone().add(i.clone().multiplyScalar(-a * 0.5));
|
|
1143
|
+
s.push(r.x, r.y, 1e-3), s.push(h.x, h.y, 1e-3);
|
|
1144
|
+
}), o.userData.isVerticalReferenceLine) {
|
|
1145
|
+
const a = o.center;
|
|
1146
1146
|
this.verticalReferenceLineFlag.position.set(a.x, a.y, 0), this.container.add(this.verticalReferenceLineFlag);
|
|
1147
1147
|
}
|
|
1148
1148
|
}), t.length && this.renderer.createLineSegments({
|
|
@@ -1153,9 +1153,9 @@ class oo extends Se {
|
|
|
1153
1153
|
position: n
|
|
1154
1154
|
}, n.length / 3, {
|
|
1155
1155
|
color: 16776960
|
|
1156
|
-
}, this.container),
|
|
1157
|
-
position:
|
|
1158
|
-
},
|
|
1156
|
+
}, this.container), s.length && this.renderer.createLineSegments({
|
|
1157
|
+
position: s
|
|
1158
|
+
}, s.length / 3, {
|
|
1159
1159
|
color: 16711935
|
|
1160
1160
|
}, this.container), e && this.synchronizeDxf();
|
|
1161
1161
|
}
|
|
@@ -1164,25 +1164,25 @@ class oo extends Se {
|
|
|
1164
1164
|
* @returns
|
|
1165
1165
|
*/
|
|
1166
1166
|
adsorption(e = 0.04, t = this.pointVirtualGrid, n = this.quadtree) {
|
|
1167
|
-
const
|
|
1167
|
+
const s = this.parent?.findComponentByName("Editor"), o = _.from(s.pointerPosition), a = t.queryCircle(o, e).sort((d, i) => d.point.distance(o) - i.point.distance(o));
|
|
1168
1168
|
if (a.length) return {
|
|
1169
1169
|
point: new m.Vector3(a[0].point.x, a[0].point.y, 0),
|
|
1170
1170
|
find: !0,
|
|
1171
1171
|
mode: "point",
|
|
1172
1172
|
line: a[0].userData
|
|
1173
1173
|
};
|
|
1174
|
-
let
|
|
1175
|
-
if (
|
|
1176
|
-
let
|
|
1177
|
-
return
|
|
1178
|
-
point: new m.Vector3(
|
|
1174
|
+
let c = n.queryCircle(o, e);
|
|
1175
|
+
if (c.length) {
|
|
1176
|
+
let d = c.map((i) => i.line.projectPoint(o));
|
|
1177
|
+
return d.sort((i, r) => i && r ? i.distance(o) - r.distance(o) : 0), c = c.filter((i, r) => !!d[r]), d = d.filter((i, r) => !!d[r]), {
|
|
1178
|
+
point: new m.Vector3(d[0].x, d[0].y, 0),
|
|
1179
1179
|
find: !0,
|
|
1180
1180
|
mode: "line",
|
|
1181
|
-
line:
|
|
1181
|
+
line: c[0].line
|
|
1182
1182
|
};
|
|
1183
1183
|
}
|
|
1184
1184
|
return {
|
|
1185
|
-
point: new m.Vector3(
|
|
1185
|
+
point: new m.Vector3(s.pointerPosition.x, s.pointerPosition.y, 0),
|
|
1186
1186
|
find: !1
|
|
1187
1187
|
};
|
|
1188
1188
|
}
|
|
@@ -1191,8 +1191,8 @@ class oo extends Se {
|
|
|
1191
1191
|
*/
|
|
1192
1192
|
createGeometry(e, t) {
|
|
1193
1193
|
const n = new m.BufferGeometry();
|
|
1194
|
-
return Object.keys(e).forEach((
|
|
1195
|
-
n.setAttribute("position", new m.BufferAttribute(new Float32Array(e[
|
|
1194
|
+
return Object.keys(e).forEach((s) => {
|
|
1195
|
+
n.setAttribute("position", new m.BufferAttribute(new Float32Array(e[s]), e[s].length / t));
|
|
1196
1196
|
}), n;
|
|
1197
1197
|
}
|
|
1198
1198
|
/**
|
|
@@ -1200,21 +1200,21 @@ class oo extends Se {
|
|
|
1200
1200
|
*/
|
|
1201
1201
|
toJson() {
|
|
1202
1202
|
return this.lines.map((e) => {
|
|
1203
|
-
const t = e.userData, n = t.drawWindow,
|
|
1203
|
+
const t = e.userData, n = t.drawWindow, s = this.quadtree.queryLineSegment(e).filter((o) => o.line !== e && !o.userData?.isDoor).map((o) => ({ index: this.lines.indexOf(o.line) }));
|
|
1204
1204
|
return {
|
|
1205
1205
|
start: e.start.toJson(this.dxf.originalZAverage),
|
|
1206
1206
|
end: e.end.toJson(this.dxf.originalZAverage),
|
|
1207
|
-
insetionArr:
|
|
1207
|
+
insetionArr: s,
|
|
1208
1208
|
isDoor: t.isDoor,
|
|
1209
1209
|
doorDirectConnection: t.isDoor,
|
|
1210
1210
|
length: e.length(),
|
|
1211
1211
|
isWindow: t.isWindow,
|
|
1212
1212
|
isVerticalReferenceLine: t.isVerticalReferenceLine,
|
|
1213
1213
|
wallWidth: e.userData.wallWidth,
|
|
1214
|
-
drawWindow: n && n.map((
|
|
1215
|
-
p: { x:
|
|
1216
|
-
width:
|
|
1217
|
-
full:
|
|
1214
|
+
drawWindow: n && n.map((o) => ({
|
|
1215
|
+
p: { x: o.p.x, y: o.p.y, z: o.p.z },
|
|
1216
|
+
width: o.width,
|
|
1217
|
+
full: o.full
|
|
1218
1218
|
}))
|
|
1219
1219
|
};
|
|
1220
1220
|
});
|
|
@@ -1255,7 +1255,7 @@ class oo extends Se {
|
|
|
1255
1255
|
return this.parent?.findComponentByName("DxfLineModel");
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
|
-
class
|
|
1258
|
+
class os extends O {
|
|
1259
1259
|
static name = "DrawDoorLine";
|
|
1260
1260
|
container = new m.Group();
|
|
1261
1261
|
interruptKeys = ["escape"];
|
|
@@ -1263,18 +1263,18 @@ class so extends O {
|
|
|
1263
1263
|
commandName = "draw-door-line";
|
|
1264
1264
|
onAddFromParent(e) {
|
|
1265
1265
|
super.onAddFromParent(e);
|
|
1266
|
-
const t = e.findComponentByName("Editor"), n = t.eventInput,
|
|
1266
|
+
const t = e.findComponentByName("Editor"), n = t.eventInput, s = t.commandManager;
|
|
1267
1267
|
this.editor.container.add(this.container);
|
|
1268
|
-
const
|
|
1269
|
-
n.addKeyCombination(this.commandName, this.shortcutKeys),
|
|
1270
|
-
n.isKeyCombination(this.commandName) && await
|
|
1268
|
+
const o = this.commandManager.addCommandFlow("draw-door-line").add(this.createInterrupt()).add(this.createCursor("no-drop")).add(this.selectPoint.bind(this)).add(this.end.bind(this)).addRollback(this.rollback.bind(this)).addRevokeRollback(this.revokeRollback.bind(this));
|
|
1269
|
+
n.addKeyCombination(this.commandName, this.shortcutKeys), o.addEventListener("finally", this.createFinally()), o.addEventListener("completed", (a) => this.completed(a.data)), n.addCancelDefaultBehavior(() => n.isOnlyKeyDowns(this.shortcutKeys)), n.addEventListener("codeChange", async () => {
|
|
1270
|
+
n.isKeyCombination(this.commandName) && await s.start(this.commandName);
|
|
1271
1271
|
});
|
|
1272
1272
|
}
|
|
1273
1273
|
/** 选择点
|
|
1274
1274
|
* @param next
|
|
1275
1275
|
*/
|
|
1276
1276
|
selectPoint(e) {
|
|
1277
|
-
let t = this.parent?.findComponentByName("Editor"), n = null,
|
|
1277
|
+
let t = this.parent?.findComponentByName("Editor"), n = null, s = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 65280 })), o = new we([], 16711935), a = new we([
|
|
1278
1278
|
new m.Vector3(-1e4, 0, 0),
|
|
1279
1279
|
new m.Vector3(1e4, 0, 0),
|
|
1280
1280
|
new m.Vector3(0, -1e4, 0),
|
|
@@ -1285,25 +1285,25 @@ class so extends O {
|
|
|
1285
1285
|
dashSize: 0.1,
|
|
1286
1286
|
gapSize: 0.1,
|
|
1287
1287
|
linewidth: 0.1
|
|
1288
|
-
}), this.container.add(
|
|
1289
|
-
let
|
|
1288
|
+
}), this.container.add(o);
|
|
1289
|
+
let c = null;
|
|
1290
1290
|
this.addEventRecord(
|
|
1291
1291
|
"clear",
|
|
1292
1292
|
t.addEventListener("pointerPositionChange", () => {
|
|
1293
|
-
const { point:
|
|
1294
|
-
n &&
|
|
1293
|
+
const { point: d, find: i } = t.renderManager.adsorption();
|
|
1294
|
+
n && o.setPoint(n, d), this.dispatchEvent({ type: "pointerMove", point: d }), i ? (s.position.set(d.x, d.y, 0), this.container.add(s), this.domElement.style.cursor = "none", c = d.clone()) : (c = null, s.removeFromParent(), this.domElement.style.cursor = "no-drop");
|
|
1295
1295
|
}),
|
|
1296
1296
|
t.eventInput.addEventListener("codeChange", async () => {
|
|
1297
|
-
if (t.eventInput.isKeyDown("mouse_0") &&
|
|
1297
|
+
if (t.eventInput.isKeyDown("mouse_0") && c) {
|
|
1298
1298
|
if (!n) {
|
|
1299
|
-
n =
|
|
1299
|
+
n = c.clone();
|
|
1300
1300
|
return;
|
|
1301
1301
|
}
|
|
1302
|
-
e([n.clone(),
|
|
1302
|
+
e([n.clone(), c.clone()]);
|
|
1303
1303
|
}
|
|
1304
1304
|
}),
|
|
1305
1305
|
function() {
|
|
1306
|
-
|
|
1306
|
+
o.removeFromParent(), s.removeFromParent(), a.removeFromParent();
|
|
1307
1307
|
}
|
|
1308
1308
|
);
|
|
1309
1309
|
}
|
|
@@ -1314,21 +1314,21 @@ class so extends O {
|
|
|
1314
1314
|
*/
|
|
1315
1315
|
end(e, t) {
|
|
1316
1316
|
const n = [];
|
|
1317
|
-
for (let
|
|
1318
|
-
const
|
|
1317
|
+
for (let s = 0; s < t.length; s += 2) {
|
|
1318
|
+
const o = _.from(t[s]), a = _.from(t[s + 1]), c = this.renderManager.quadtree.queryCircle(o, 1e-3)[0].line, d = this.renderManager.quadtree.queryCircle(a, 1e-3)[0].line;
|
|
1319
1319
|
let i = null;
|
|
1320
|
-
|
|
1321
|
-
oldLine:
|
|
1320
|
+
c === d && (i = {
|
|
1321
|
+
oldLine: c,
|
|
1322
1322
|
newLine1: new B(
|
|
1323
|
-
|
|
1324
|
-
|
|
1323
|
+
c.start,
|
|
1324
|
+
c.start.distance(o) < c.start.distance(a) ? o.clone() : a.clone()
|
|
1325
1325
|
),
|
|
1326
1326
|
newLine2: new B(
|
|
1327
|
-
|
|
1328
|
-
|
|
1327
|
+
c.end,
|
|
1328
|
+
c.end.distance(o) < c.end.distance(a) ? o.clone() : a.clone()
|
|
1329
1329
|
)
|
|
1330
1330
|
});
|
|
1331
|
-
const r = new B(
|
|
1331
|
+
const r = new B(o, a);
|
|
1332
1332
|
r.userData.isDoor = !0, r.userData.doorDirectConnection = !0, n.push({
|
|
1333
1333
|
line: r,
|
|
1334
1334
|
option: i
|
|
@@ -1359,7 +1359,7 @@ class so extends O {
|
|
|
1359
1359
|
return this.completed(e), e;
|
|
1360
1360
|
}
|
|
1361
1361
|
}
|
|
1362
|
-
class
|
|
1362
|
+
class as extends O {
|
|
1363
1363
|
static name = "DrawWindow";
|
|
1364
1364
|
container = new m.Group();
|
|
1365
1365
|
interruptKeys = ["escape"];
|
|
@@ -1374,24 +1374,24 @@ class ao extends O {
|
|
|
1374
1374
|
* @param next
|
|
1375
1375
|
*/
|
|
1376
1376
|
selectPointStart(e) {
|
|
1377
|
-
let t = null, n = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 16711935 })),
|
|
1377
|
+
let t = null, n = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 16711935 })), s = null;
|
|
1378
1378
|
this.addEventRecord("selectPointStart").add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
1379
|
-
const { point:
|
|
1380
|
-
this.dispatchEvent({ type: "pointerMove", point:
|
|
1379
|
+
const { point: o, line: a, find: c } = this.editor.renderManager.adsorption();
|
|
1380
|
+
this.dispatchEvent({ type: "pointerMove", point: o }), c ? (this.domElement.style.cursor = "none", n.position.copy(o), s = a, t = o.clone(), this.container.add(n)) : (this.domElement.style.cursor = "no-drop", t = null, n.removeFromParent());
|
|
1381
1381
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
1382
|
-
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), e({ point: t, line:
|
|
1382
|
+
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), e({ point: t, line: s }));
|
|
1383
1383
|
})), this.addEventRecord("clear").add(() => n.removeFromParent());
|
|
1384
1384
|
}
|
|
1385
1385
|
/** 选择结束点
|
|
1386
1386
|
* @param next
|
|
1387
1387
|
*/
|
|
1388
1388
|
selectPointEnd(e, { point: t, line: n }) {
|
|
1389
|
-
let
|
|
1390
|
-
this.addEventRecord("clear").add(() =>
|
|
1391
|
-
const { point: a, find:
|
|
1392
|
-
this.dispatchEvent({ type: "pointerMove", point: a }),
|
|
1389
|
+
let s = null, o = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 16711935 }));
|
|
1390
|
+
this.addEventRecord("clear").add(() => o.removeFromParent()).add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
1391
|
+
const { point: a, find: c, line: d } = this.editor.renderManager.adsorption();
|
|
1392
|
+
this.dispatchEvent({ type: "pointerMove", point: a }), c && d === n ? (this.domElement.style.cursor = "none", o.position.copy(a), s = a.clone(), this.container.add(o)) : (this.domElement.style.cursor = "no-drop", s = null, o.removeFromParent());
|
|
1393
1393
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
1394
|
-
this.eventInput.isKeyDown("mouse_0") &&
|
|
1394
|
+
this.eventInput.isKeyDown("mouse_0") && s && e({ line: n, start: t, end: s });
|
|
1395
1395
|
}));
|
|
1396
1396
|
}
|
|
1397
1397
|
/**
|
|
@@ -1399,13 +1399,13 @@ class ao extends O {
|
|
|
1399
1399
|
* @param next
|
|
1400
1400
|
* @param points
|
|
1401
1401
|
*/
|
|
1402
|
-
end(e, { start: t, end: n, line:
|
|
1403
|
-
const
|
|
1402
|
+
end(e, { start: t, end: n, line: s }) {
|
|
1403
|
+
const o = new B(_.from(t), _.from(n)), a = o.center, c = o.length(), d = {
|
|
1404
1404
|
p: new m.Vector3(a.x, a.y, 0),
|
|
1405
|
-
width:
|
|
1406
|
-
full: Math.abs(
|
|
1405
|
+
width: c,
|
|
1406
|
+
full: Math.abs(c - s.length()) < 0.01
|
|
1407
1407
|
};
|
|
1408
|
-
e({ line:
|
|
1408
|
+
e({ line: s, doorDataItem: d });
|
|
1409
1409
|
}
|
|
1410
1410
|
/** 执行完成
|
|
1411
1411
|
*/
|
|
@@ -1418,8 +1418,8 @@ class ao extends O {
|
|
|
1418
1418
|
rollback(e) {
|
|
1419
1419
|
const { doorDataItem: t, line: n } = e;
|
|
1420
1420
|
if (n.userData.drawWindow) {
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1421
|
+
const s = n.userData.drawWindow.indexOf(t);
|
|
1422
|
+
s !== -1 && (n.userData.drawWindow.splice(s, 1), n.userData.drawWindow.length === 0 && (delete n.userData.drawWindow, delete n.userData.isWindow), this.renderManager.draw());
|
|
1423
1423
|
}
|
|
1424
1424
|
return e;
|
|
1425
1425
|
}
|
|
@@ -1467,46 +1467,46 @@ class le extends O {
|
|
|
1467
1467
|
* @param id
|
|
1468
1468
|
* @returns
|
|
1469
1469
|
*/
|
|
1470
|
-
setLinePoint(e, t, n,
|
|
1470
|
+
setLinePoint(e, t, n, s = "all", o = [], a = At()) {
|
|
1471
1471
|
if (e.userData.setLinePointUUid === a) return [];
|
|
1472
1472
|
e.userData.setLinePointUUid = a;
|
|
1473
|
-
let
|
|
1474
|
-
(
|
|
1473
|
+
let c = [], d = [];
|
|
1474
|
+
(s === "start" || s === "all") && (c = this.renderManager.pointVirtualGrid.queryPoint(e.start).filter((y) => y.userData !== e)), (s === "end" || s === "all") && (d = this.renderManager.pointVirtualGrid.queryPoint(e.end).filter((y) => y.userData !== e));
|
|
1475
1475
|
const i = e.clone();
|
|
1476
1476
|
let r = "";
|
|
1477
|
-
t && (e.start.equal(t) || (r = "start"),
|
|
1477
|
+
t && (e.start.equal(t) || (r = "start"), o.push({
|
|
1478
1478
|
point: e.start,
|
|
1479
1479
|
oldPoint: e.start.clone(),
|
|
1480
1480
|
newPoint: t,
|
|
1481
1481
|
line: e
|
|
1482
|
-
}), e.start.copy(t)), n && (e.end.equal(n) || (r = r === "start" ? "all" : "end"),
|
|
1482
|
+
}), e.start.copy(t)), n && (e.end.equal(n) || (r = r === "start" ? "all" : "end"), o.push({
|
|
1483
1483
|
point: e.end,
|
|
1484
1484
|
oldPoint: e.end.clone(),
|
|
1485
1485
|
newPoint: n,
|
|
1486
1486
|
line: e
|
|
1487
1487
|
}), e.end.copy(n));
|
|
1488
|
-
const h = (
|
|
1489
|
-
|
|
1488
|
+
const h = (y, f, p) => {
|
|
1489
|
+
y.forEach((u) => {
|
|
1490
1490
|
const { point: E, userData: x } = u, k = x.start === E ? "start" : "end";
|
|
1491
1491
|
if (x.directionEqual(i))
|
|
1492
1492
|
if (k === "start") {
|
|
1493
|
-
const
|
|
1494
|
-
if (
|
|
1493
|
+
const z = e.projectPoint(x.end, !1);
|
|
1494
|
+
if (z) return this.setLinePoint(x, f, z, "end", o, a);
|
|
1495
1495
|
} else {
|
|
1496
|
-
const
|
|
1497
|
-
if (
|
|
1496
|
+
const z = e.projectPoint(x.start, !1);
|
|
1497
|
+
if (z) return this.setLinePoint(x, z, f, "start", o, a);
|
|
1498
1498
|
}
|
|
1499
1499
|
(r === "all" || p === r) && this.setLinePoint(
|
|
1500
1500
|
x,
|
|
1501
1501
|
x.start === E ? f : x.start,
|
|
1502
1502
|
x.end === E ? f : x.end,
|
|
1503
1503
|
x.start === E ? "end" : "start",
|
|
1504
|
-
|
|
1504
|
+
o,
|
|
1505
1505
|
a
|
|
1506
1506
|
);
|
|
1507
1507
|
});
|
|
1508
1508
|
};
|
|
1509
|
-
return h(
|
|
1509
|
+
return h(c, e.start, "start"), h(d, e.end, "end"), [...c, ...d];
|
|
1510
1510
|
}
|
|
1511
1511
|
/** 修正2
|
|
1512
1512
|
* 第一步:确定需要修复的线段
|
|
@@ -1520,16 +1520,16 @@ class le extends O {
|
|
|
1520
1520
|
*/
|
|
1521
1521
|
correction(e, t = [], n = /* @__PURE__ */ new Set()) {
|
|
1522
1522
|
n.add(e);
|
|
1523
|
-
const
|
|
1524
|
-
const [h,
|
|
1525
|
-
return r.sameEndpoint(e) ? h.push(r) :
|
|
1523
|
+
const s = this.renderManager.quadtree.queryLineSegment(e).filter(({ line: i }) => !(i === e || i.userData.isDoor || n.has(i))).map((i) => i.line), o = e.direction(), [a, c] = s.reduce((i, r) => {
|
|
1524
|
+
const [h, y] = i;
|
|
1525
|
+
return r.sameEndpoint(e) ? h.push(r) : y.push(r), i;
|
|
1526
1526
|
}, [[], []]);
|
|
1527
1527
|
a.forEach((i) => {
|
|
1528
|
-
const r = i.direction(), h =
|
|
1528
|
+
const r = i.direction(), h = o.angleBetween(r, "angle");
|
|
1529
1529
|
if (Math.abs(90 - h) > 45) return !1;
|
|
1530
1530
|
const f = e.sameEndpointAsStart(i) ? e.start : e.end, p = i.sameEndpointAsStart(e) ? i.end : i.start, u = new B(
|
|
1531
|
-
p.clone().add(
|
|
1532
|
-
p.clone().add(
|
|
1531
|
+
p.clone().add(o.clone().multiplyScalar(1)),
|
|
1532
|
+
p.clone().add(o.clone().multiplyScalar(-1))
|
|
1533
1533
|
), E = u.projectPoint(f, !1);
|
|
1534
1534
|
if (E) {
|
|
1535
1535
|
const x = [];
|
|
@@ -1542,14 +1542,14 @@ class le extends O {
|
|
|
1542
1542
|
), t.push(x);
|
|
1543
1543
|
}
|
|
1544
1544
|
return n.add(i), !1;
|
|
1545
|
-
}),
|
|
1546
|
-
const
|
|
1547
|
-
const
|
|
1548
|
-
if (
|
|
1545
|
+
}), o.copy(e.direction());
|
|
1546
|
+
const d = (i, r, h) => {
|
|
1547
|
+
const y = e.projectPoint(r);
|
|
1548
|
+
if (y) i.copy(y);
|
|
1549
1549
|
else {
|
|
1550
1550
|
const f = new B(
|
|
1551
|
-
r.clone().add(
|
|
1552
|
-
r.clone().add(
|
|
1551
|
+
r.clone().add(o.clone().multiplyScalar(1)),
|
|
1552
|
+
r.clone().add(o.clone().multiplyScalar(-1))
|
|
1553
1553
|
), p = f.projectPoint(i, !1);
|
|
1554
1554
|
if (p) {
|
|
1555
1555
|
const u = [];
|
|
@@ -1563,25 +1563,25 @@ class le extends O {
|
|
|
1563
1563
|
}
|
|
1564
1564
|
}
|
|
1565
1565
|
};
|
|
1566
|
-
return
|
|
1566
|
+
return c.forEach((i) => {
|
|
1567
1567
|
if (e.containsPoint(i.start))
|
|
1568
|
-
|
|
1568
|
+
d(i.start, i.end, i);
|
|
1569
1569
|
else if (e.containsPoint(i.end))
|
|
1570
|
-
|
|
1570
|
+
d(i.end, i.start, i);
|
|
1571
1571
|
else {
|
|
1572
1572
|
const r = e.getIntersection(i);
|
|
1573
1573
|
if (r) {
|
|
1574
1574
|
const h = new B(
|
|
1575
|
-
i.start.clone().add(
|
|
1576
|
-
i.start.clone().add(
|
|
1577
|
-
),
|
|
1578
|
-
if (
|
|
1575
|
+
i.start.clone().add(o.clone().multiplyScalar(1)),
|
|
1576
|
+
i.start.clone().add(o.clone().multiplyScalar(-1))
|
|
1577
|
+
), y = h.projectPoint(r, !1);
|
|
1578
|
+
if (y) {
|
|
1579
1579
|
const u = [];
|
|
1580
|
-
this.setLinePoint(i,
|
|
1580
|
+
this.setLinePoint(i, y, i.end, "start", u), t.push(u);
|
|
1581
1581
|
}
|
|
1582
1582
|
const f = new B(
|
|
1583
|
-
i.end.clone().add(
|
|
1584
|
-
i.end.clone().add(
|
|
1583
|
+
i.end.clone().add(o.clone().multiplyScalar(1)),
|
|
1584
|
+
i.end.clone().add(o.clone().multiplyScalar(-1))
|
|
1585
1585
|
), p = f.projectPoint(r, !1);
|
|
1586
1586
|
if (p) {
|
|
1587
1587
|
const u = [];
|
|
@@ -1597,7 +1597,7 @@ class le extends O {
|
|
|
1597
1597
|
*/
|
|
1598
1598
|
axisAlignmentCorrection(e) {
|
|
1599
1599
|
const t = [...this.renderManager.lines];
|
|
1600
|
-
return { newLines:
|
|
1600
|
+
return { newLines: ke.axisAlignmentCorrection.call(this, t, e), oldLines: t };
|
|
1601
1601
|
}
|
|
1602
1602
|
/** 开始
|
|
1603
1603
|
* @param next
|
|
@@ -1606,23 +1606,6 @@ class le extends O {
|
|
|
1606
1606
|
const n = performance.now();
|
|
1607
1607
|
e(this.axisAlignment ? this.axisAlignmentCorrection(t[0]) : this.correction(t[0])), console.log("处理时间:", performance.now() - n, "ms");
|
|
1608
1608
|
}
|
|
1609
|
-
/**
|
|
1610
|
-
* 窗户恢复
|
|
1611
|
-
* @param doorLines
|
|
1612
|
-
*/
|
|
1613
|
-
windowRecover(e) {
|
|
1614
|
-
e.forEach((t) => {
|
|
1615
|
-
const n = t.direction();
|
|
1616
|
-
t.userData.drawWindow?.forEach((o) => {
|
|
1617
|
-
const s = A.from(o.p), a = t.projectPoint(
|
|
1618
|
-
s.clone().add(n.clone().multiplyScalar(o.width * 0.5))
|
|
1619
|
-
), d = t.projectPoint(
|
|
1620
|
-
s.clone().add(n.clone().multiplyScalar(o.width * -0.5))
|
|
1621
|
-
), l = new B(a, d), i = l.center;
|
|
1622
|
-
o.p = new m.Vector3(i?.x ?? 0, i?.y ?? 0, o.p.z);
|
|
1623
|
-
});
|
|
1624
|
-
});
|
|
1625
|
-
}
|
|
1626
1609
|
/** 执行完成
|
|
1627
1610
|
* @param data
|
|
1628
1611
|
*/
|
|
@@ -1630,11 +1613,11 @@ class le extends O {
|
|
|
1630
1613
|
if (Array.isArray(e)) {
|
|
1631
1614
|
const t = [];
|
|
1632
1615
|
e.forEach((n) => {
|
|
1633
|
-
n.forEach((
|
|
1634
|
-
const { line:
|
|
1635
|
-
|
|
1616
|
+
n.forEach((s) => {
|
|
1617
|
+
const { line: o, newPoint: a, point: c } = s;
|
|
1618
|
+
c.copy(a), this.renderManager.removeLine(o), this.renderManager.addLine(o), o.userData.isWindow && t.push(o);
|
|
1636
1619
|
});
|
|
1637
|
-
}),
|
|
1620
|
+
}), ke.recomputedWindow(...t);
|
|
1638
1621
|
} else
|
|
1639
1622
|
this.renderManager.removeLines(e.oldLines), this.renderManager.addLines(e.newLines);
|
|
1640
1623
|
this.renderManager.draw();
|
|
@@ -1646,13 +1629,13 @@ class le extends O {
|
|
|
1646
1629
|
if (Array.isArray(e)) {
|
|
1647
1630
|
const t = [];
|
|
1648
1631
|
for (let n = e.length - 1; n >= 0; n--) {
|
|
1649
|
-
const
|
|
1650
|
-
for (let
|
|
1651
|
-
const a = o
|
|
1652
|
-
i.copy(
|
|
1632
|
+
const s = e[n];
|
|
1633
|
+
for (let o = s.length - 1; o >= 0; o--) {
|
|
1634
|
+
const a = s[o], { line: c, oldPoint: d, point: i } = a;
|
|
1635
|
+
i.copy(d), this.renderManager.removeLine(c), this.renderManager.addLine(c), c.userData.isWindow && t.push(c);
|
|
1653
1636
|
}
|
|
1654
1637
|
}
|
|
1655
|
-
|
|
1638
|
+
ke.recomputedWindow(...t);
|
|
1656
1639
|
} else
|
|
1657
1640
|
this.renderManager.removeLines(e.newLines), this.renderManager.addLines(e.oldLines);
|
|
1658
1641
|
return this.renderManager.draw(), e;
|
|
@@ -1682,38 +1665,14 @@ class $ extends O {
|
|
|
1682
1665
|
constraint(e, t) {
|
|
1683
1666
|
Array.isArray(t) ? t.length < 2 ? (L({ message: "未执行线段合并,请选择至少两条线段", type: "warning" }), this.cancel()) : e(t) : (L({ message: "进入命令失败", type: "warning" }), this.cancel());
|
|
1684
1667
|
}
|
|
1685
|
-
mergeLine(e, t) {
|
|
1686
|
-
for (let n = 0; n < e.points.length; n++) {
|
|
1687
|
-
const o = e.points[n];
|
|
1688
|
-
for (let s = 0; s < t.points.length; s++) {
|
|
1689
|
-
const a = t.points[s];
|
|
1690
|
-
if (o.equal(a)) {
|
|
1691
|
-
const d = e.points[(n + 1) % 2].clone(), l = t.points[(s + 1) % 2].clone();
|
|
1692
|
-
return new B(d, l);
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
return !1;
|
|
1697
|
-
}
|
|
1698
1668
|
/** 开始
|
|
1699
1669
|
* @param next
|
|
1700
1670
|
* @todo 合并所有
|
|
1701
1671
|
*/
|
|
1702
1672
|
mergeLines(e, t) {
|
|
1703
|
-
t = t.filter((
|
|
1704
|
-
const n =
|
|
1705
|
-
|
|
1706
|
-
const o = [], s = [];
|
|
1707
|
-
for (let a = 0; a < t.length; a++) {
|
|
1708
|
-
if (s.indexOf(t[a]) > -1) continue;
|
|
1709
|
-
const d = t[a], l = n.queryPoint(d.start).filter((h) => h.userData !== d && d.isParallel(h.userData, 0.1)), i = n.queryPoint(d.end).filter((h) => h.userData !== d && d.isParallel(h.userData, 0.1)), r = [d];
|
|
1710
|
-
if (l.length && r.push(l[0].userData), i.length && r.push(i[0].userData), r.length > 1) {
|
|
1711
|
-
s.push(...r), s.forEach((v) => v.points.forEach((f) => n.remove(f)));
|
|
1712
|
-
const h = r.reduce((v, f) => this.mergeLine(v, f), r.pop().clone());
|
|
1713
|
-
h.points.forEach((v) => n.insert(v, h)), o.push(h);
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
o.length ? (e({ newLines: o, deleteLines: s }), L({ message: "已合并", type: "success" })) : (L({ message: "合并失败,未找到共用点", type: "warning" }), this.commandManager.cancel());
|
|
1673
|
+
t = t.filter((o) => !o.userData.isDoor);
|
|
1674
|
+
const { newLines: n, deleteLines: s } = B.autoMergeLines(t);
|
|
1675
|
+
n.length ? (e({ newLines: n, deleteLines: s }), L({ message: "已合并", type: "success" })) : (L({ message: "合并失败,未找到共用点", type: "warning" }), this.commandManager.cancel());
|
|
1717
1676
|
}
|
|
1718
1677
|
/** 执行完成
|
|
1719
1678
|
* @param data
|
|
@@ -1792,14 +1751,14 @@ class te extends O {
|
|
|
1792
1751
|
* @param next
|
|
1793
1752
|
*/
|
|
1794
1753
|
connection(e, t) {
|
|
1795
|
-
let n,
|
|
1754
|
+
let n, s, o = 1 / 0;
|
|
1796
1755
|
for (let a = 0; a < 2; a++)
|
|
1797
|
-
for (let
|
|
1798
|
-
const
|
|
1799
|
-
r <
|
|
1756
|
+
for (let c = 0; c < 2; c++) {
|
|
1757
|
+
const d = t[0].points[a], i = t[1].points[c], r = d.distance(i);
|
|
1758
|
+
r < o && (n = d, s = i, o = r);
|
|
1800
1759
|
}
|
|
1801
|
-
if (n &&
|
|
1802
|
-
const a = new B(n.clone(),
|
|
1760
|
+
if (n && s) {
|
|
1761
|
+
const a = new B(n.clone(), s.clone());
|
|
1803
1762
|
e(a), L({ message: "连接成功", type: "success" });
|
|
1804
1763
|
} else this.cancel();
|
|
1805
1764
|
}
|
|
@@ -1845,26 +1804,26 @@ class ne extends O {
|
|
|
1845
1804
|
* @param next
|
|
1846
1805
|
*/
|
|
1847
1806
|
connection(e, t) {
|
|
1848
|
-
const n = t[0],
|
|
1849
|
-
if (!
|
|
1850
|
-
const a = n.points.map((r) => r.clone()),
|
|
1851
|
-
n.start.distance(
|
|
1852
|
-
const
|
|
1853
|
-
e({ line1: n, line2:
|
|
1807
|
+
const n = t[0], s = t[1], o = t[0].getIntersection(t[1]);
|
|
1808
|
+
if (!o) return;
|
|
1809
|
+
const a = n.points.map((r) => r.clone()), c = s.points.map((r) => r.clone());
|
|
1810
|
+
n.start.distance(o) < n.end.distance(o) ? n.start.copy(o) : n.end.copy(o), s.start.distance(o) < s.end.distance(o) ? s.start.copy(o) : s.end.copy(o);
|
|
1811
|
+
const d = n.points.map((r) => r.clone()), i = s.points.map((r) => r.clone());
|
|
1812
|
+
e({ line1: n, line2: s, oldLine1: a, oldLine2: c, newLine1: d, newLine2: i }), L({ message: "连接成功", type: "success" });
|
|
1854
1813
|
}
|
|
1855
1814
|
/** 执行完成
|
|
1856
1815
|
* @param next
|
|
1857
1816
|
* @param selectLines
|
|
1858
1817
|
*/
|
|
1859
|
-
completed({ line1: e, line2: t, newLine1: n, newLine2:
|
|
1860
|
-
this.renderManager.removeLine(e), this.renderManager.removeLine(t), e.set(...n), t.set(...
|
|
1818
|
+
completed({ line1: e, line2: t, newLine1: n, newLine2: s }) {
|
|
1819
|
+
this.renderManager.removeLine(e), this.renderManager.removeLine(t), e.set(...n), t.set(...s), this.renderManager.addLines([e, t]), this.renderManager.draw();
|
|
1861
1820
|
}
|
|
1862
1821
|
/** 回滚操作
|
|
1863
1822
|
* @param data
|
|
1864
1823
|
*/
|
|
1865
1824
|
rollback(e) {
|
|
1866
|
-
const { line1: t, line2: n, oldLine1:
|
|
1867
|
-
return this.renderManager.removeLine(t), this.renderManager.removeLine(n), t.set(...
|
|
1825
|
+
const { line1: t, line2: n, oldLine1: s, oldLine2: o } = e;
|
|
1826
|
+
return this.renderManager.removeLine(t), this.renderManager.removeLine(n), t.set(...s), n.set(...o), this.renderManager.addLines([t, n]), this.renderManager.draw(), e;
|
|
1868
1827
|
}
|
|
1869
1828
|
/** 撤回回滚
|
|
1870
1829
|
* @param lines
|
|
@@ -1874,15 +1833,15 @@ class ne extends O {
|
|
|
1874
1833
|
return this.completed(e), e;
|
|
1875
1834
|
}
|
|
1876
1835
|
}
|
|
1877
|
-
class
|
|
1836
|
+
class se extends O {
|
|
1878
1837
|
static name = "DeleteSelectWindow";
|
|
1879
1838
|
shortcutKeys = ["Q", "Delete"];
|
|
1880
1839
|
static commandName = "deleteSelectWindow";
|
|
1881
1840
|
onAddFromParent(e) {
|
|
1882
1841
|
super.onAddFromParent(e);
|
|
1883
|
-
const t = this.commandManager.addCommandFlow(
|
|
1884
|
-
t.addEventListener("finally", this.createFinally()), t.addEventListener("completed", (n) => this.completed(n.data)), this.eventInput.addKeyCombination(
|
|
1885
|
-
this.eventInput.isKeyCombination(
|
|
1842
|
+
const t = this.commandManager.addCommandFlow(se.commandName).add(this.createInterrupt()).add(this.constraint.bind(this)).add(this.end.bind(this)).addRollback(this.rollback.bind(this)).addRevokeRollback(this.revokeRollback.bind(this));
|
|
1843
|
+
t.addEventListener("finally", this.createFinally()), t.addEventListener("completed", (n) => this.completed(n.data)), this.eventInput.addKeyCombination(se.commandName, this.shortcutKeys), this.eventInput.addEventListener("codeChange", async () => {
|
|
1844
|
+
this.eventInput.isKeyCombination(se.commandName) && await this.commandManager.start(se.commandName, [...this.default.selectLines]);
|
|
1886
1845
|
}), this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
|
|
1887
1846
|
}
|
|
1888
1847
|
/**
|
|
@@ -1895,13 +1854,13 @@ class oe extends O {
|
|
|
1895
1854
|
* @param next
|
|
1896
1855
|
*/
|
|
1897
1856
|
end(e, t) {
|
|
1898
|
-
let n = !1,
|
|
1899
|
-
t.forEach((
|
|
1900
|
-
|
|
1901
|
-
line:
|
|
1902
|
-
drawDoorData:
|
|
1857
|
+
let n = !1, s = [];
|
|
1858
|
+
t.forEach((o) => {
|
|
1859
|
+
o.userData.isWindow && (s.push({
|
|
1860
|
+
line: o,
|
|
1861
|
+
drawDoorData: o.userData.drawDoorData
|
|
1903
1862
|
}), n = !0);
|
|
1904
|
-
}), n && L({ message: "删除窗户成功", type: "success" }), e(
|
|
1863
|
+
}), n && L({ message: "删除窗户成功", type: "success" }), e(s);
|
|
1905
1864
|
}
|
|
1906
1865
|
/**
|
|
1907
1866
|
* 完成
|
|
@@ -1931,16 +1890,16 @@ class oe extends O {
|
|
|
1931
1890
|
return this.completed(e), e;
|
|
1932
1891
|
}
|
|
1933
1892
|
}
|
|
1934
|
-
class
|
|
1893
|
+
class oe extends O {
|
|
1935
1894
|
static name = "SelectAll";
|
|
1936
1895
|
container = new m.Group();
|
|
1937
1896
|
shortcutKeys = ["control", "a"];
|
|
1938
1897
|
static commandName = "selectAll";
|
|
1939
1898
|
onAddFromParent(e) {
|
|
1940
1899
|
super.onAddFromParent(e), this.editor.container.add(this.container), this.container.position.z = 1e-3;
|
|
1941
|
-
const t = this.commandManager.addCommandFlow(
|
|
1942
|
-
t.writeOperationList = !1, t.addEventListener("finally", this.createFinally()), t.addEventListener("completed", (n) => this.completed(n.data)), this.eventInput.addKeyCombination(
|
|
1943
|
-
this.eventInput.isKeyCombination(
|
|
1900
|
+
const t = this.commandManager.addCommandFlow(oe.commandName).add(this.createInterrupt()).add(this.selectAll.bind(this)).addRollback(this.rollback.bind(this)).addRevokeRollback(this.revokeRollback.bind(this));
|
|
1901
|
+
t.writeOperationList = !1, t.addEventListener("finally", this.createFinally()), t.addEventListener("completed", (n) => this.completed(n.data)), this.eventInput.addKeyCombination(oe.commandName, this.shortcutKeys), this.eventInput.addEventListener("codeChange", async () => {
|
|
1902
|
+
this.eventInput.isKeyCombination(oe.commandName) && await this.commandManager.start(oe.commandName);
|
|
1944
1903
|
}), this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
|
|
1945
1904
|
}
|
|
1946
1905
|
/** 开始
|
|
@@ -1991,18 +1950,18 @@ class ae extends O {
|
|
|
1991
1950
|
* @param selectLines
|
|
1992
1951
|
*/
|
|
1993
1952
|
viewAngle(e, t) {
|
|
1994
|
-
const [n,
|
|
1995
|
-
let a,
|
|
1996
|
-
n.sameEndpointAsStart(
|
|
1997
|
-
function h(
|
|
1998
|
-
const b = M.x -
|
|
1953
|
+
const [n, s] = t, o = Math.min(0.5, n.length(), s.length());
|
|
1954
|
+
let a, c, d, i = 0, r = 0;
|
|
1955
|
+
n.sameEndpointAsStart(s) ? (a = n.start, c = n.end) : (a = n.end, c = n.start), s.sameEndpointAsStart(n) ? d = s.end : d = s.start;
|
|
1956
|
+
function h(A, M) {
|
|
1957
|
+
const b = M.x - A.x, F = M.y - A.y;
|
|
1999
1958
|
let W = Math.atan2(F, b) * (180 / Math.PI);
|
|
2000
1959
|
return W < 0 && (W += 360), W;
|
|
2001
1960
|
}
|
|
2002
|
-
const
|
|
2003
|
-
function x(
|
|
2004
|
-
for (let b =
|
|
2005
|
-
const F = Math.cos(b * Math.PI / 180) *
|
|
1961
|
+
const y = h(a, c), f = h(a, d), p = Math.min(y, f), u = Math.max(y, f), E = [];
|
|
1962
|
+
function x(A, M) {
|
|
1963
|
+
for (let b = A; b <= M; b++) {
|
|
1964
|
+
const F = Math.cos(b * Math.PI / 180) * o + a.x, W = Math.sin(b * Math.PI / 180) * o + a.y, he = Math.cos((b + 1) * Math.PI / 180) * o + a.x, Ce = Math.sin((b + 1) * Math.PI / 180) * o + a.y;
|
|
2006
1965
|
E.push(F, W, 0, he, Ce, 0);
|
|
2007
1966
|
}
|
|
2008
1967
|
}
|
|
@@ -2011,7 +1970,7 @@ class ae extends O {
|
|
|
2011
1970
|
k.geometry = this.renderManager.createGeometry({
|
|
2012
1971
|
position: E
|
|
2013
1972
|
}, E.length / 3), k.material = new m.LineBasicMaterial({ color: 16711935 }), this.renderManager.container.add(k);
|
|
2014
|
-
const
|
|
1973
|
+
const z = Math.cos(r * Math.PI / 180) * o + a.x, Y = Math.sin(r * Math.PI / 180) * o + a.y, Z = this.renderer.createText(Number(i.toFixed(2)), new m.Vector3(z, Y, 0), {
|
|
2015
1974
|
textShadow: "0px 0px 2px #000"
|
|
2016
1975
|
}, this.renderManager.container);
|
|
2017
1976
|
let G = 0;
|
|
@@ -2020,7 +1979,7 @@ class ae extends O {
|
|
|
2020
1979
|
}));
|
|
2021
1980
|
}
|
|
2022
1981
|
}
|
|
2023
|
-
class
|
|
1982
|
+
class dt extends O {
|
|
2024
1983
|
static name = "ClippingLine";
|
|
2025
1984
|
container = new m.Group();
|
|
2026
1985
|
shortcutKeys = ["control", "x"];
|
|
@@ -2035,24 +1994,24 @@ class rt extends O {
|
|
|
2035
1994
|
* @param next
|
|
2036
1995
|
*/
|
|
2037
1996
|
selectPointStart(e) {
|
|
2038
|
-
let t = null, n = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 16711935 })),
|
|
1997
|
+
let t = null, n = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 16711935 })), s = null;
|
|
2039
1998
|
this.addEventRecord("selectPointStart").add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
2040
|
-
const { point:
|
|
2041
|
-
this.dispatchEvent({ type: "pointerMove", point:
|
|
1999
|
+
const { point: o, line: a, find: c } = this.editor.renderManager.adsorption();
|
|
2000
|
+
this.dispatchEvent({ type: "pointerMove", point: o }), c ? (this.domElement.style.cursor = "none", n.position.copy(o), s = a, t = o.clone(), this.container.add(n)) : (this.domElement.style.cursor = "no-drop", t = null, n.removeFromParent());
|
|
2042
2001
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
2043
|
-
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), e({ point: t, line:
|
|
2002
|
+
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), e({ point: t, line: s }));
|
|
2044
2003
|
})), this.addEventRecord("clear").add(() => n.removeFromParent());
|
|
2045
2004
|
}
|
|
2046
2005
|
/** 选择结束点
|
|
2047
2006
|
* @param next
|
|
2048
2007
|
*/
|
|
2049
2008
|
selectPointEnd(e, { point: t, line: n }) {
|
|
2050
|
-
let
|
|
2051
|
-
this.addEventRecord("clear").add(() =>
|
|
2052
|
-
const { point: a, find:
|
|
2053
|
-
this.dispatchEvent({ type: "pointerMove", point: a }),
|
|
2009
|
+
let s = null, o = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 16711935 }));
|
|
2010
|
+
this.addEventRecord("clear").add(() => o.removeFromParent()).add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
2011
|
+
const { point: a, find: c, line: d } = this.editor.renderManager.adsorption();
|
|
2012
|
+
this.dispatchEvent({ type: "pointerMove", point: a }), c && d === n ? (this.domElement.style.cursor = "none", o.position.copy(a), s = a.clone(), this.container.add(o)) : (this.domElement.style.cursor = "no-drop", s = null, o.removeFromParent());
|
|
2054
2013
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
2055
|
-
this.eventInput.isKeyDown("mouse_0") &&
|
|
2014
|
+
this.eventInput.isKeyDown("mouse_0") && s && e({ line: n, start: t, end: s });
|
|
2056
2015
|
}));
|
|
2057
2016
|
}
|
|
2058
2017
|
/**
|
|
@@ -2060,17 +2019,17 @@ class rt extends O {
|
|
|
2060
2019
|
* @param next
|
|
2061
2020
|
* @param points
|
|
2062
2021
|
*/
|
|
2063
|
-
end(e, { start: t, end: n, line:
|
|
2064
|
-
const
|
|
2022
|
+
end(e, { start: t, end: n, line: s }) {
|
|
2023
|
+
const o = _.from(t), a = _.from(n);
|
|
2065
2024
|
e({
|
|
2066
|
-
oldLine:
|
|
2025
|
+
oldLine: s,
|
|
2067
2026
|
newLine1: new B(
|
|
2068
|
-
|
|
2069
|
-
|
|
2027
|
+
s.start,
|
|
2028
|
+
s.start.distance(o) < s.start.distance(a) ? o.clone() : a.clone()
|
|
2070
2029
|
),
|
|
2071
2030
|
newLine2: new B(
|
|
2072
|
-
|
|
2073
|
-
|
|
2031
|
+
s.end,
|
|
2032
|
+
s.end.distance(o) < s.end.distance(a) ? o.clone() : a.clone()
|
|
2074
2033
|
)
|
|
2075
2034
|
});
|
|
2076
2035
|
}
|
|
@@ -2121,31 +2080,31 @@ class ie extends O {
|
|
|
2121
2080
|
}), t[0].userData.isVerticalReferenceLine = !0, e(), this.renderManager.draw();
|
|
2122
2081
|
}
|
|
2123
2082
|
}
|
|
2124
|
-
const
|
|
2083
|
+
const is = {
|
|
2125
2084
|
key: 0,
|
|
2126
2085
|
class: "mt-[5px] text-[#ccc] text-[11px] absolute left-[10px] bottom-[10px] rounded-[8px] min-w-[150px] bg-black/15 p-[10px]"
|
|
2127
|
-
},
|
|
2086
|
+
}, rs = { class: "text-start max-w-[150px]" }, ds = { class: "inline-block ml-[10px] text-[var(--color-primary)]" }, ls = {
|
|
2128
2087
|
key: 0,
|
|
2129
2088
|
class: "p-[5px] max-w-[200px]"
|
|
2130
|
-
},
|
|
2089
|
+
}, cs = { class: "text-[14px] flex flex-col" }, ms = ["onClick"], hs = { class: "flex flex-row items-center" }, us = { class: "flex justify-center items-center size-[20px] bg-[#f0f0f0] rounded-[2px] mr-[10px]" }, ps = ["src"], gs = { class: "text-wrap" }, vs = {
|
|
2131
2090
|
key: 1,
|
|
2132
2091
|
class: "text-[#999]"
|
|
2133
|
-
},
|
|
2092
|
+
}, fs = {
|
|
2134
2093
|
style: { "--el-color-primary": "var(--primary-color)" },
|
|
2135
2094
|
class: "flex flex-row items-center justify-between gap-[10px] mt-[10px] text-[10px]"
|
|
2136
|
-
},
|
|
2095
|
+
}, ws = {
|
|
2137
2096
|
key: 0,
|
|
2138
2097
|
class: "flex flex-row items-center flex-wrap justify-between gap-[10px] mt-[10px] text-[10px]"
|
|
2139
|
-
},
|
|
2098
|
+
}, ys = { class: "flex-wrap border-t-1 border-t-[#eee] mt-[5px] pt-[5px] flex items-center gap-[10px]" }, bs = ["onClick", "title"], xs = ["src"], Cs = /* @__PURE__ */ me({
|
|
2140
2099
|
__name: "EditorTool",
|
|
2141
2100
|
props: {
|
|
2142
2101
|
dxfSystem: {},
|
|
2143
2102
|
permission: {}
|
|
2144
2103
|
},
|
|
2145
|
-
setup(
|
|
2146
|
-
function e(C, g,
|
|
2147
|
-
const ue =
|
|
2148
|
-
C = Math.max(0, Math.min(C, ue)), g = Math.max(pe, Math.min(g, Me)),
|
|
2104
|
+
setup(l) {
|
|
2105
|
+
function e(C, g, w = h.value.getBoundingClientRect(), U = y.value.getBoundingClientRect()) {
|
|
2106
|
+
const ue = w.width - U.width, pe = 0, Me = w.height - U.height;
|
|
2107
|
+
C = Math.max(0, Math.min(C, ue)), g = Math.max(pe, Math.min(g, Me)), A.value = { left: C, top: g };
|
|
2149
2108
|
}
|
|
2150
2109
|
function t(C) {
|
|
2151
2110
|
p.value === C.command || p.value !== "default" || x.commandManager.start(C.command);
|
|
@@ -2160,16 +2119,16 @@ const io = {
|
|
|
2160
2119
|
}
|
|
2161
2120
|
}
|
|
2162
2121
|
}
|
|
2163
|
-
async function
|
|
2164
|
-
const C = await
|
|
2122
|
+
async function s() {
|
|
2123
|
+
const C = await Dt.json();
|
|
2165
2124
|
Array.isArray(C) && (localStorage.removeItem("orbitControls"), n(C));
|
|
2166
2125
|
}
|
|
2167
|
-
function
|
|
2126
|
+
function o({ offsetX: C, offsetY: g }) {
|
|
2168
2127
|
E.mouseMoveEventProxylock = !0;
|
|
2169
|
-
const
|
|
2128
|
+
const w = document.body.style.cursor;
|
|
2170
2129
|
document.body.style.cursor = "move";
|
|
2171
2130
|
const U = (ue) => {
|
|
2172
|
-
const pe = h.value.getBoundingClientRect(), Me =
|
|
2131
|
+
const pe = h.value.getBoundingClientRect(), Me = y.value.getBoundingClientRect();
|
|
2173
2132
|
e(
|
|
2174
2133
|
ue.pageX - pe.left - C,
|
|
2175
2134
|
ue.pageY - pe.top - g,
|
|
@@ -2177,11 +2136,11 @@ const io = {
|
|
|
2177
2136
|
Me
|
|
2178
2137
|
), ue.stopPropagation(), document.body.style.cursor = "move";
|
|
2179
2138
|
}, Ee = () => {
|
|
2180
|
-
document.body.removeEventListener("mousemove", U), document.removeEventListener("mouseup", Ee), document.body.style.cursor =
|
|
2139
|
+
document.body.removeEventListener("mousemove", U), document.removeEventListener("mouseup", Ee), document.body.style.cursor = w, E.mouseMoveEventProxylock = !1;
|
|
2181
2140
|
};
|
|
2182
2141
|
document.body.addEventListener("mousemove", U), document.addEventListener("mouseup", Ee);
|
|
2183
2142
|
}
|
|
2184
|
-
const a =
|
|
2143
|
+
const a = l, c = S(!0), d = S(!0), i = S(!0), r = S(!1), h = S(), y = S(), f = S(!0), p = S(""), u = Ot(a.dxfSystem), E = u.findComponentByType(Pt), x = u.findComponentByType(lt), k = u.findComponentByType(rt), z = u.findComponentByType(St), Y = u.findComponentByType(_t), Z = S(0), G = S(0), A = S({ left: 10, top: 100 }), M = /* @__PURE__ */ Object.assign({ "./assets/images/angle.svg": En, "./assets/images/connection.svg": Ln, "./assets/images/cutLine.svg": In, "./assets/images/deleteSelectLine.svg": Dn, "./assets/images/deleteSelectWindow.svg": Sn, "./assets/images/door.svg": Bn, "./assets/images/intersectionConnection.svg": Rn, "./assets/images/line.svg": Fn, "./assets/images/mergeLine.svg": zn, "./assets/images/revokeRollback.svg": jn, "./assets/images/rollback.svg": Gn, "./assets/images/selectAll.svg": Hn, "./assets/images/selectPoint.svg": Jn, "./assets/images/verticalCorrection.svg": qn, "./assets/images/verticalLine.svg": Yn, "./assets/images/window.svg": $n }), b = S(!1), F = S(0), W = S(!1), he = new ResizeObserver(() => e(A.value.left, A.value.top)), Ce = [
|
|
2185
2144
|
{ name: "开启绘制线段命令", shortcut: "Ctrl + L" },
|
|
2186
2145
|
{ name: "开启绘制门线命令", shortcut: "Ctrl + M" },
|
|
2187
2146
|
{ name: "开启绘制窗户线命令", shortcut: "Ctrl + Q" },
|
|
@@ -2201,7 +2160,7 @@ const io = {
|
|
|
2201
2160
|
{ name: "取消命令", shortcut: "Esc" },
|
|
2202
2161
|
{ name: "回滚操作", shortcut: "Ctrl + Z" },
|
|
2203
2162
|
{ name: "取消回滚操作", shortcut: "Ctrl + Y" }
|
|
2204
|
-
],
|
|
2163
|
+
], ct = [
|
|
2205
2164
|
{
|
|
2206
2165
|
command: "default",
|
|
2207
2166
|
name: "默认",
|
|
@@ -2237,13 +2196,13 @@ const io = {
|
|
|
2237
2196
|
shortcut: "Ctrl + P"
|
|
2238
2197
|
},
|
|
2239
2198
|
{
|
|
2240
|
-
command:
|
|
2199
|
+
command: dt.commandName,
|
|
2241
2200
|
name: "裁剪线段",
|
|
2242
2201
|
show: !0,
|
|
2243
2202
|
src: M["./assets/images/cutLine.svg"].default,
|
|
2244
2203
|
shortcut: "Ctrl + X"
|
|
2245
2204
|
}
|
|
2246
|
-
],
|
|
2205
|
+
], mt = [
|
|
2247
2206
|
{
|
|
2248
2207
|
command: "",
|
|
2249
2208
|
name: "操作回滚",
|
|
@@ -2313,14 +2272,14 @@ const io = {
|
|
|
2313
2272
|
shortcut: "r"
|
|
2314
2273
|
},
|
|
2315
2274
|
{
|
|
2316
|
-
command:
|
|
2275
|
+
command: oe.commandName,
|
|
2317
2276
|
name: "全选",
|
|
2318
2277
|
show: D(() => F.value !== x.renderManager.lines.length),
|
|
2319
2278
|
src: M["./assets/images/selectAll.svg"].default,
|
|
2320
2279
|
shortcut: "Ctrl + A"
|
|
2321
2280
|
},
|
|
2322
2281
|
{
|
|
2323
|
-
command:
|
|
2282
|
+
command: se.commandName,
|
|
2324
2283
|
name: "清除窗户",
|
|
2325
2284
|
show: D(() => W.value),
|
|
2326
2285
|
src: M["./assets/images/deleteSelectWindow.svg"].default,
|
|
@@ -2334,15 +2293,15 @@ const io = {
|
|
|
2334
2293
|
shortcut: "Delete"
|
|
2335
2294
|
}
|
|
2336
2295
|
];
|
|
2337
|
-
J(
|
|
2338
|
-
localStorage.setItem("toolBarExpand", f.value + ""), f.value && ye(() => e(
|
|
2339
|
-
}), J(
|
|
2340
|
-
const
|
|
2296
|
+
J(A, () => localStorage.setItem("editorToolPosition", JSON.stringify(A.value))), J(b, () => localStorage.setItem("showShortcutKey", b.value + "")), J(f, () => {
|
|
2297
|
+
localStorage.setItem("toolBarExpand", f.value + ""), f.value && ye(() => e(A.value.left, A.value.top));
|
|
2298
|
+
}), J(c, () => u.Variable.set("originalLineVisible", c.value)), J(d, () => u.Variable.set("dxfVisible", d.value)), J(i, () => u.Variable.set("whiteModelVisible", i.value)), u.Variable.addEventListener("isLook", (C) => r.value = C.value), u.Variable.addEventListener("originalLineVisible", (C) => c.value = C.value), u.Variable.addEventListener("dxfVisible", (C) => d.value = C.value), u.Variable.addEventListener("whiteModelVisible", (C) => i.value = C.value);
|
|
2299
|
+
const ht = x.commandManager.addEventListener("started", (C) => {
|
|
2341
2300
|
p.value = C.name;
|
|
2342
2301
|
});
|
|
2343
|
-
return localStorage.getItem("showShortcutKey") && (b.value = localStorage.getItem("showShortcutKey") === "true"), localStorage.getItem("toolBarExpand") && (f.value = localStorage.getItem("toolBarExpand") === "true"),
|
|
2344
|
-
|
|
2345
|
-
if (
|
|
2302
|
+
return localStorage.getItem("showShortcutKey") && (b.value = localStorage.getItem("showShortcutKey") === "true"), localStorage.getItem("toolBarExpand") && (f.value = localStorage.getItem("toolBarExpand") === "true"), tt(() => {
|
|
2303
|
+
y.value.style.display = "none", setTimeout(() => {
|
|
2304
|
+
if (y.value.style.display = "block", localStorage.getItem("editorToolPosition")) {
|
|
2346
2305
|
const { left: C, top: g } = JSON.parse(localStorage.getItem("editorToolPosition") ?? "{}");
|
|
2347
2306
|
e(C, g), ye(() => he.observe(h.value));
|
|
2348
2307
|
} else
|
|
@@ -2357,21 +2316,21 @@ const io = {
|
|
|
2357
2316
|
});
|
|
2358
2317
|
});
|
|
2359
2318
|
}), Ft(() => {
|
|
2360
|
-
E.mouseMoveEventProxylock = !1,
|
|
2319
|
+
E.mouseMoveEventProxylock = !1, ht(), he.disconnect();
|
|
2361
2320
|
}), (C, g) => (P(), R("div", {
|
|
2362
2321
|
ref_key: "elRef",
|
|
2363
2322
|
ref: h,
|
|
2364
2323
|
class: "editorTool pointer-events-none overflow-hidden absolute left-0 top-0 w-full h-full z-[20] flex flex-row justify-between p-[5px] box-border select-none pointer-events-[all]"
|
|
2365
2324
|
}, [
|
|
2366
|
-
|
|
2325
|
+
K(xe, null, {
|
|
2367
2326
|
default: j(() => [
|
|
2368
|
-
b.value ? (P(), R("div",
|
|
2369
|
-
(P(), R(ve, null,
|
|
2327
|
+
b.value ? (P(), R("div", is, [
|
|
2328
|
+
(P(), R(ve, null, Ie(Ce, (w) => I("div", {
|
|
2370
2329
|
class: "p-[4px_0px] flex justify-between text-right border-b-1 border-b-[rgba(255,255,255,0.1)] last-of-type:border-b-0",
|
|
2371
|
-
key:
|
|
2330
|
+
key: w.name
|
|
2372
2331
|
}, [
|
|
2373
|
-
I("p",
|
|
2374
|
-
I("span",
|
|
2332
|
+
I("p", rs, de(w.name), 1),
|
|
2333
|
+
I("span", ds, de(w.shortcut), 1)
|
|
2375
2334
|
])), 64))
|
|
2376
2335
|
])) : q("", !0)
|
|
2377
2336
|
]),
|
|
@@ -2379,19 +2338,19 @@ const io = {
|
|
|
2379
2338
|
}),
|
|
2380
2339
|
I("div", {
|
|
2381
2340
|
ref_key: "toolBarRef",
|
|
2382
|
-
ref:
|
|
2383
|
-
style: _e({ left:
|
|
2341
|
+
ref: y,
|
|
2342
|
+
style: _e({ left: A.value.left + "px", top: A.value.top + "px" }),
|
|
2384
2343
|
class: V(["overflow-hidden pointer-events-auto w-fit max-w-[260px] transition-[border-radius] text-[#333] absolute z-[11] bg-white select-none", { "rounded-[8px] ": f.value }]),
|
|
2385
|
-
onMousedown: g[10] || (g[10] = (
|
|
2344
|
+
onMousedown: g[10] || (g[10] = (w) => w.stopPropagation())
|
|
2386
2345
|
}, [
|
|
2387
2346
|
I("div", {
|
|
2388
|
-
onMousedown:
|
|
2347
|
+
onMousedown: o,
|
|
2389
2348
|
class: V([{ "border-b-[#eee] border-b-1": f.value }, "flex flex-row justify-between header text-[14px] font-bold p-[10px 0px]"])
|
|
2390
2349
|
}, [
|
|
2391
|
-
g[12] || (g[12] =
|
|
2350
|
+
g[12] || (g[12] = Kt('<div class="flex flex-row" data-v-39e8b14c><div class="p-[2px_5px] flex items-center pointer-events-none" data-v-39e8b14c><svg fill="#aaa" width="20" height="20" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" data-v-39e8b14c><path d="M341.333333 298.666667a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m0 298.666666a85.333333 85.333333 0 1 0 0-170.666666 85.333333 85.333333 0 0 0 0 170.666666z m85.333334 213.333334a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m256-512a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m85.333333 213.333333a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m-85.333333 384a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z" data-v-39e8b14c></path></svg></div><h5 class="flex text-nowrap text-[12px] items-center pointer-events-none" data-v-39e8b14c>绘制工具</h5></div>', 1)),
|
|
2392
2351
|
I("div", {
|
|
2393
|
-
onMousedown: g[0] || (g[0] = (
|
|
2394
|
-
onClick: g[1] || (g[1] = (
|
|
2352
|
+
onMousedown: g[0] || (g[0] = (w) => w.stopPropagation()),
|
|
2353
|
+
onClick: g[1] || (g[1] = (w) => f.value = !f.value),
|
|
2395
2354
|
class: "cursor-pointer flex items-center p-[0px_5px]"
|
|
2396
2355
|
}, [
|
|
2397
2356
|
(P(), R("svg", {
|
|
@@ -2407,35 +2366,35 @@ const io = {
|
|
|
2407
2366
|
]), 2))
|
|
2408
2367
|
], 32)
|
|
2409
2368
|
], 34),
|
|
2410
|
-
f.value ? (P(), R("div",
|
|
2411
|
-
I("ul",
|
|
2412
|
-
(P(), R(ve, null,
|
|
2413
|
-
key:
|
|
2369
|
+
f.value ? (P(), R("div", ls, [
|
|
2370
|
+
I("ul", cs, [
|
|
2371
|
+
(P(), R(ve, null, Ie(ct, (w) => (P(), R(ve, {
|
|
2372
|
+
key: w.command
|
|
2414
2373
|
}, [
|
|
2415
|
-
|
|
2374
|
+
w.show ? (P(), R("li", {
|
|
2416
2375
|
key: 0,
|
|
2417
|
-
onClick: (U) => t(
|
|
2376
|
+
onClick: (U) => t(w),
|
|
2418
2377
|
class: V([{
|
|
2419
|
-
"!bg-[var(--primary-color)] text-[#fff]": p.value ===
|
|
2420
|
-
"!cursor-no-drop": p.value !==
|
|
2378
|
+
"!bg-[var(--primary-color)] text-[#fff]": p.value === w.command,
|
|
2379
|
+
"!cursor-no-drop": p.value !== w.command && p.value !== "default"
|
|
2421
2380
|
}, "gap-[10px] text-[12px] hover:bg-[#ddd] transition-all rounded-[6px] p-[5px] flex flex-row items-center justify-between cursor-pointer"])
|
|
2422
2381
|
}, [
|
|
2423
|
-
I("div",
|
|
2424
|
-
I("div",
|
|
2382
|
+
I("div", hs, [
|
|
2383
|
+
I("div", us, [
|
|
2425
2384
|
I("img", {
|
|
2426
2385
|
class: "size-[14px]",
|
|
2427
|
-
src:
|
|
2386
|
+
src: w.src,
|
|
2428
2387
|
alt: "",
|
|
2429
2388
|
srcset: ""
|
|
2430
|
-
}, null, 8,
|
|
2389
|
+
}, null, 8, ps)
|
|
2431
2390
|
]),
|
|
2432
|
-
I("span",
|
|
2391
|
+
I("span", gs, de(w.name), 1)
|
|
2433
2392
|
]),
|
|
2434
|
-
p.value ===
|
|
2393
|
+
p.value === w.command ? (P(), R("div", {
|
|
2435
2394
|
key: 0,
|
|
2436
2395
|
title: "取消命令(Esc)",
|
|
2437
2396
|
class: "active:scale-[0.7] transition-all",
|
|
2438
|
-
onClick: g[2] || (g[2] = (U) => (
|
|
2397
|
+
onClick: g[2] || (g[2] = (U) => (v(x).cancelCommand(), U.stopPropagation()))
|
|
2439
2398
|
}, g[13] || (g[13] = [
|
|
2440
2399
|
I("svg", {
|
|
2441
2400
|
fill: "#fff",
|
|
@@ -2448,30 +2407,30 @@ const io = {
|
|
|
2448
2407
|
I("path", { d: "M511.104 0C228.821333 0 0 228.821333 0 511.104c0 282.282667 228.821333 511.104 511.104 511.104 282.282667 0 511.104-228.842667 511.104-511.104C1022.208 228.821333 793.386667 0 511.104 0zM511.104 898.496c-213.973333 0-387.434667-173.44-387.434667-387.413333 0-213.952 173.44-387.413333 387.434667-387.413333 213.952 0 387.392 173.44 387.392 387.413333C898.496 725.056 725.056 898.496 511.104 898.496z" }),
|
|
2449
2408
|
I("path", { d: "M236.437333 463.914667l549.333333 0 0 96.874667-549.333333 0 0-96.874667Z" })
|
|
2450
2409
|
], -1)
|
|
2451
|
-
]))) :
|
|
2452
|
-
], 10,
|
|
2410
|
+
]))) : w.shortcut ? (P(), R("div", vs, de(w.shortcut), 1)) : q("", !0)
|
|
2411
|
+
], 10, ms)) : q("", !0)
|
|
2453
2412
|
], 64))), 64))
|
|
2454
2413
|
]),
|
|
2455
|
-
I("div",
|
|
2456
|
-
|
|
2414
|
+
I("div", fs, [
|
|
2415
|
+
K(v(Fe), {
|
|
2457
2416
|
size: "small",
|
|
2458
2417
|
modelValue: b.value,
|
|
2459
|
-
"onUpdate:modelValue": g[3] || (g[3] = (
|
|
2418
|
+
"onUpdate:modelValue": g[3] || (g[3] = (w) => b.value = w),
|
|
2460
2419
|
label: "快捷键提示"
|
|
2461
2420
|
}, null, 8, ["modelValue"]),
|
|
2462
|
-
|
|
2421
|
+
K(v(Fe), {
|
|
2463
2422
|
size: "small",
|
|
2464
|
-
modelValue:
|
|
2465
|
-
"onUpdate:modelValue": g[4] || (g[4] = (
|
|
2423
|
+
modelValue: d.value,
|
|
2424
|
+
"onUpdate:modelValue": g[4] || (g[4] = (w) => d.value = w),
|
|
2466
2425
|
label: "dxf"
|
|
2467
2426
|
}, null, 8, ["modelValue"])
|
|
2468
2427
|
]),
|
|
2469
|
-
C.permission === "admin" ? (P(), R("div",
|
|
2470
|
-
|
|
2428
|
+
C.permission === "admin" ? (P(), R("div", ws, [
|
|
2429
|
+
K(v(re), {
|
|
2471
2430
|
style: { padding: "5px", "font-size": "10px" },
|
|
2472
2431
|
size: "small",
|
|
2473
2432
|
type: "success",
|
|
2474
|
-
onClick:
|
|
2433
|
+
onClick: s
|
|
2475
2434
|
}, {
|
|
2476
2435
|
default: j(() => g[14] || (g[14] = [
|
|
2477
2436
|
X(" 选择文件 ", -1)
|
|
@@ -2479,11 +2438,11 @@ const io = {
|
|
|
2479
2438
|
_: 1,
|
|
2480
2439
|
__: [14]
|
|
2481
2440
|
}),
|
|
2482
|
-
|
|
2441
|
+
K(v(re), {
|
|
2483
2442
|
style: { padding: "5px", "font-size": "10px" },
|
|
2484
2443
|
size: "small",
|
|
2485
2444
|
type: "primary",
|
|
2486
|
-
onClick: g[5] || (g[5] = (
|
|
2445
|
+
onClick: g[5] || (g[5] = (w) => v(u).Dxf.downloadOriginalData("json.json"))
|
|
2487
2446
|
}, {
|
|
2488
2447
|
default: j(() => g[15] || (g[15] = [
|
|
2489
2448
|
X(" 下载Json ", -1)
|
|
@@ -2491,11 +2450,11 @@ const io = {
|
|
|
2491
2450
|
_: 1,
|
|
2492
2451
|
__: [15]
|
|
2493
2452
|
}),
|
|
2494
|
-
|
|
2453
|
+
K(v(re), {
|
|
2495
2454
|
style: { padding: "5px", "font-size": "10px" },
|
|
2496
2455
|
size: "small",
|
|
2497
2456
|
type: "primary",
|
|
2498
|
-
onClick: g[6] || (g[6] = (
|
|
2457
|
+
onClick: g[6] || (g[6] = (w) => v(u).AngleCorrectionDxf.download("test.dxf"))
|
|
2499
2458
|
}, {
|
|
2500
2459
|
default: j(() => g[16] || (g[16] = [
|
|
2501
2460
|
X(" 下载DXF ", -1)
|
|
@@ -2503,11 +2462,11 @@ const io = {
|
|
|
2503
2462
|
_: 1,
|
|
2504
2463
|
__: [16]
|
|
2505
2464
|
}),
|
|
2506
|
-
|
|
2465
|
+
K(v(re), {
|
|
2507
2466
|
style: { padding: "5px", "font-size": "10px" },
|
|
2508
2467
|
size: "small",
|
|
2509
2468
|
type: "primary",
|
|
2510
|
-
onClick: g[7] || (g[7] = (
|
|
2469
|
+
onClick: g[7] || (g[7] = (w) => v(u).AngleCorrectionDxf.downloadImage("dxf.jpg"))
|
|
2511
2470
|
}, {
|
|
2512
2471
|
default: j(() => g[17] || (g[17] = [
|
|
2513
2472
|
X(" 下载JPG ", -1)
|
|
@@ -2515,11 +2474,11 @@ const io = {
|
|
|
2515
2474
|
_: 1,
|
|
2516
2475
|
__: [17]
|
|
2517
2476
|
}),
|
|
2518
|
-
|
|
2477
|
+
K(v(re), {
|
|
2519
2478
|
style: { padding: "5px", "font-size": "10px" },
|
|
2520
2479
|
size: "small",
|
|
2521
2480
|
type: "primary",
|
|
2522
|
-
onClick: g[8] || (g[8] = (
|
|
2481
|
+
onClick: g[8] || (g[8] = (w) => v(z).downloadGltf("test.glb", !0))
|
|
2523
2482
|
}, {
|
|
2524
2483
|
default: j(() => g[18] || (g[18] = [
|
|
2525
2484
|
X(" 下载白膜 ", -1)
|
|
@@ -2527,11 +2486,11 @@ const io = {
|
|
|
2527
2486
|
_: 1,
|
|
2528
2487
|
__: [18]
|
|
2529
2488
|
}),
|
|
2530
|
-
|
|
2489
|
+
K(v(re), {
|
|
2531
2490
|
style: { padding: "5px", "font-size": "10px" },
|
|
2532
2491
|
size: "small",
|
|
2533
2492
|
type: "primary",
|
|
2534
|
-
onClick: g[9] || (g[9] = (
|
|
2493
|
+
onClick: g[9] || (g[9] = (w) => v(Y).download())
|
|
2535
2494
|
}, {
|
|
2536
2495
|
default: j(() => g[19] || (g[19] = [
|
|
2537
2496
|
X(" 下载三维家JSON ", -1)
|
|
@@ -2540,25 +2499,25 @@ const io = {
|
|
|
2540
2499
|
__: [19]
|
|
2541
2500
|
})
|
|
2542
2501
|
])) : q("", !0),
|
|
2543
|
-
|
|
2502
|
+
K(xe, null, {
|
|
2544
2503
|
default: j(() => [
|
|
2545
|
-
I("div",
|
|
2546
|
-
|
|
2504
|
+
I("div", ys, [
|
|
2505
|
+
K(zt, null, {
|
|
2547
2506
|
default: j(() => [
|
|
2548
|
-
(P(), R(ve, null,
|
|
2549
|
-
onClick: (U) =>
|
|
2550
|
-
title: `${
|
|
2507
|
+
(P(), R(ve, null, Ie(mt, (w) => I("div", {
|
|
2508
|
+
onClick: (U) => w.show.value && p.value === "default" && (w.action ? w.action() : v(x).commandManager.start(w.command, [...v(k).selectLines])),
|
|
2509
|
+
title: `${w.name}(${w.shortcut})`,
|
|
2551
2510
|
class: V(["size-[20px] flex justify-center items-center relative overflow-hidden active:scale-[0.8] border-1 border-[#ccc] rounded-[4px] transition-all cursor-pointer", {
|
|
2552
|
-
"opacity-30 bg-[#ccc] !cursor-no-drop active:!scale-[1]": !
|
|
2553
|
-
[
|
|
2511
|
+
"opacity-30 bg-[#ccc] !cursor-no-drop active:!scale-[1]": !w.show.value || p.value !== "default",
|
|
2512
|
+
[w.class ?? ""]: !0
|
|
2554
2513
|
}]),
|
|
2555
|
-
key:
|
|
2514
|
+
key: w.command
|
|
2556
2515
|
}, [
|
|
2557
2516
|
I("img", {
|
|
2558
2517
|
class: "size-[14px]",
|
|
2559
|
-
src:
|
|
2560
|
-
}, null, 8,
|
|
2561
|
-
], 10,
|
|
2518
|
+
src: w.src
|
|
2519
|
+
}, null, 8, xs)
|
|
2520
|
+
], 10, bs)), 64))
|
|
2562
2521
|
]),
|
|
2563
2522
|
_: 1
|
|
2564
2523
|
})
|
|
@@ -2570,13 +2529,13 @@ const io = {
|
|
|
2570
2529
|
], 38)
|
|
2571
2530
|
], 512));
|
|
2572
2531
|
}
|
|
2573
|
-
}),
|
|
2574
|
-
const t =
|
|
2575
|
-
for (const [n,
|
|
2576
|
-
t[n] =
|
|
2532
|
+
}), Es = (l, e) => {
|
|
2533
|
+
const t = l.__vccOpts || l;
|
|
2534
|
+
for (const [n, s] of e)
|
|
2535
|
+
t[n] = s;
|
|
2577
2536
|
return t;
|
|
2578
|
-
},
|
|
2579
|
-
let
|
|
2537
|
+
}, Ms = /* @__PURE__ */ Es(Cs, [["__scopeId", "data-v-39e8b14c"]]);
|
|
2538
|
+
let lt = class extends Se {
|
|
2580
2539
|
static name = "Editor";
|
|
2581
2540
|
container = new m.Group();
|
|
2582
2541
|
get renderer() {
|
|
@@ -2630,20 +2589,20 @@ let dt = class extends Se {
|
|
|
2630
2589
|
this.domContainer.domElement.parentElement && (this.domContainer.domElement.parentElement.appendChild(this.domElement), this.domContainer.domElement.parentElement.appendChild(this.imgEl), n());
|
|
2631
2590
|
});
|
|
2632
2591
|
setTimeout(() => {
|
|
2633
|
-
this.app = Tt(
|
|
2592
|
+
this.app = Tt(Ms, { dxfSystem: this.parent, permission: this.viewPermission }), this.app.mount(this.domElement);
|
|
2634
2593
|
}), e.AngleCorrectionDxf.addEventListener("lineOffset", async () => {
|
|
2635
2594
|
this.imgEl.src && URL.revokeObjectURL(this.imgEl.src), setTimeout(async () => {
|
|
2636
2595
|
this.imgEl.src = URL.createObjectURL(await e.AngleCorrectionDxf.toDxfImageBlob("Centimeters", "image/png", "transparent"));
|
|
2637
2596
|
});
|
|
2638
|
-
}), this.domEventRegister.addEventListener("mousedown", (
|
|
2639
|
-
|
|
2597
|
+
}), this.domEventRegister.addEventListener("mousedown", (s) => {
|
|
2598
|
+
s.x < this.imgWidth + 10 && s.x > 10 && s.y < this.imgWidth && s.y > 10 && Object.assign(this.imgEl.style, {
|
|
2640
2599
|
width: `${Math.min(this.imgWidth * 10, this.renderer.width * 0.9)}px`,
|
|
2641
2600
|
height: `${Math.min(this.imgWidth * 10, this.renderer.height * 0.9)}px`,
|
|
2642
2601
|
background: "rgba(0,0,0,1)",
|
|
2643
2602
|
zIndex: 100
|
|
2644
2603
|
});
|
|
2645
|
-
}), this.domEventRegister.addEventListener("mousemove", (
|
|
2646
|
-
|
|
2604
|
+
}), this.domEventRegister.addEventListener("mousemove", (s) => {
|
|
2605
|
+
s.x < this.imgWidth + 10 && s.x > 10 && s.y < this.imgWidth && s.y > 10 || Object.assign(this.imgEl.style, {
|
|
2647
2606
|
width: `${this.imgWidth}px`,
|
|
2648
2607
|
height: `${this.imgWidth}px`,
|
|
2649
2608
|
background: "rgba(255,255,255,0.2)",
|
|
@@ -2666,20 +2625,20 @@ let dt = class extends Se {
|
|
|
2666
2625
|
* 打开编辑器
|
|
2667
2626
|
*/
|
|
2668
2627
|
openEdit() {
|
|
2669
|
-
const e = this.renderer, t = this.domEventRegister, n = this.dxf,
|
|
2670
|
-
this.container.position.z = n.originalZAverage, e.scene.add(this.container),
|
|
2628
|
+
const e = this.renderer, t = this.domEventRegister, n = this.dxf, s = e.orbitControls, o = e.camera, a = n.box.center, c = e.camera.position.clone(), d = s?.target?.clone(), i = new m.Vector2(), r = new m.Raycaster(), h = this.coords, y = this.pointerPosition;
|
|
2629
|
+
this.container.position.z = n.originalZAverage, e.scene.add(this.container), s && (o.position.set(a.x, a.y, 15), s.target.set(a.x, a.y, 0), s.enableRotate = !1);
|
|
2671
2630
|
const f = () => {
|
|
2672
2631
|
e.renderer.getSize(i);
|
|
2673
2632
|
const p = t.pointer.x / i.x * 2 - 1, u = -(t.pointer.y / i.y * 2 - 1);
|
|
2674
2633
|
h.set(p, u), r.setFromCamera(h, e.camera.children.length ? e.camera.children[0] : e.camera);
|
|
2675
2634
|
const E = r.intersectObject(this.plane);
|
|
2676
|
-
E.length && (
|
|
2635
|
+
E.length && (y.copy(E[0].point), this.dispatchEvent({
|
|
2677
2636
|
type: "pointerPositionChange",
|
|
2678
|
-
position:
|
|
2637
|
+
position: y
|
|
2679
2638
|
}));
|
|
2680
2639
|
};
|
|
2681
2640
|
t.addEventListener("mousemove", f), this.commandManager.disabled = !1, this.commandManager.start("default"), this._exitEditCallBack = () => {
|
|
2682
|
-
t.removeEventListener("mousemove", f),
|
|
2641
|
+
t.removeEventListener("mousemove", f), s && (o.position.copy(c), s.enableRotate = !0, s.target.copy(d));
|
|
2683
2642
|
};
|
|
2684
2643
|
}
|
|
2685
2644
|
/**
|
|
@@ -2692,7 +2651,7 @@ let dt = class extends Se {
|
|
|
2692
2651
|
super.destroy(), this.exitEdit(), this.renderer.scene.remove(this.container), this.domElement.remove(), this.app?.unmount();
|
|
2693
2652
|
}
|
|
2694
2653
|
};
|
|
2695
|
-
class
|
|
2654
|
+
class Ls extends O {
|
|
2696
2655
|
static name = "PointDrag";
|
|
2697
2656
|
container = new m.Group();
|
|
2698
2657
|
interruptKeys = ["escape"];
|
|
@@ -2707,12 +2666,12 @@ class ko extends O {
|
|
|
2707
2666
|
* @param next
|
|
2708
2667
|
*/
|
|
2709
2668
|
selectPoint(e) {
|
|
2710
|
-
let t = null, n = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 16711935 })),
|
|
2669
|
+
let t = null, n = new m.Mesh(new m.SphereGeometry(0.04), new m.MeshBasicMaterial({ color: 16711935 })), s = null;
|
|
2711
2670
|
this.addEventRecord("selectPointStart").add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
2712
|
-
const { point:
|
|
2713
|
-
this.dispatchEvent({ type: "pointerMove", point:
|
|
2671
|
+
const { point: o, line: a, find: c, mode: d } = this.editor.renderManager.adsorption();
|
|
2672
|
+
this.dispatchEvent({ type: "pointerMove", point: o }), c && d === "point" ? (this.domElement.style.cursor = "none", n.position.copy(o), s = a, t = o.clone(), this.container.add(n)) : (this.domElement.style.cursor = "no-drop", t = null, n.removeFromParent());
|
|
2714
2673
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
2715
|
-
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), n.material.color.set(65280), e({ point: t, line:
|
|
2674
|
+
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), n.material.color.set(65280), e({ point: t, line: s }));
|
|
2716
2675
|
})), this.addEventRecord("clear").add(() => n.removeFromParent());
|
|
2717
2676
|
}
|
|
2718
2677
|
/** 拖拽点
|
|
@@ -2722,32 +2681,32 @@ class ko extends O {
|
|
|
2722
2681
|
*/
|
|
2723
2682
|
drag(e, { point: t, line: n }) {
|
|
2724
2683
|
this.domElement.style.cursor = "crosshair";
|
|
2725
|
-
const
|
|
2726
|
-
this.container.add(
|
|
2684
|
+
const s = n.start.equal(_.from(t)) ? "start" : "end", o = s == "start" ? new m.Vector3(n.end.x, n.end.y, 0) : new m.Vector3(n.start.x, n.start.y, 0), a = t.clone(), c = new we([o, a], 16711935), d = new m.Mesh(new m.SphereGeometry(0.03), new m.MeshBasicMaterial({ color: 16711935 }));
|
|
2685
|
+
this.container.add(c), this.addEventRecord("clear").add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
2727
2686
|
let { point: i, find: r } = this.editor.renderManager.adsorption(), h = "none";
|
|
2728
2687
|
if (i) {
|
|
2729
2688
|
if (this.dispatchEvent({ type: "pointerMove", point: i }), this.eventInput.isKeyDown("shift")) {
|
|
2730
|
-
const
|
|
2731
|
-
i.set(
|
|
2689
|
+
const y = n.projectPoint(_.from(i), !1);
|
|
2690
|
+
i.set(y?.x ?? i.x, y?.y ?? i.y, 0), r = !0, h = "crosshair";
|
|
2732
2691
|
}
|
|
2733
|
-
r ? (
|
|
2692
|
+
r ? (d.position.copy(i), this.container.add(d)) : (d.removeFromParent(), h = "crosshair"), a.copy(i), c.setPoint(o, a), this.domElement.style.cursor = h;
|
|
2734
2693
|
}
|
|
2735
2694
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
2736
|
-
this.eventInput.isKeyDown("mouse_0") && (this.canceEventRecord("selectPointStart"), e({ point: a, oldPoint:
|
|
2737
|
-
})).add(() =>
|
|
2695
|
+
this.eventInput.isKeyDown("mouse_0") && (this.canceEventRecord("selectPointStart"), e({ point: a, oldPoint: s === "end" ? n.end.clone() : n.start.clone(), line: n, mode: s }));
|
|
2696
|
+
})).add(() => d.removeFromParent()).add(() => c.removeFromParent());
|
|
2738
2697
|
}
|
|
2739
2698
|
/** 执行完成
|
|
2740
2699
|
*/
|
|
2741
2700
|
completed(e) {
|
|
2742
|
-
const { line: t, point: n, mode:
|
|
2743
|
-
this.renderManager.removeLine(t),
|
|
2701
|
+
const { line: t, point: n, mode: s } = e;
|
|
2702
|
+
this.renderManager.removeLine(t), s === "end" ? t.end.set(n.x, n.y) : s === "start" && t.start.set(n.x, n.y), this.renderManager.addLine(t), this.renderManager.draw();
|
|
2744
2703
|
}
|
|
2745
2704
|
/** 回滚操作
|
|
2746
2705
|
* @param data
|
|
2747
2706
|
*/
|
|
2748
2707
|
rollback(e) {
|
|
2749
|
-
const { line: t, oldPoint: n, mode:
|
|
2750
|
-
return
|
|
2708
|
+
const { line: t, oldPoint: n, mode: s } = e;
|
|
2709
|
+
return s === "end" ? t.end.set(n.x, n.y) : s === "start" && t.start.set(n.x, n.y), this.renderManager.addLine(t), this.renderManager.draw(), e;
|
|
2751
2710
|
}
|
|
2752
2711
|
/** 撤回回滚
|
|
2753
2712
|
* @param lines
|
|
@@ -2757,15 +2716,15 @@ class ko extends O {
|
|
|
2757
2716
|
return this.completed(e), e;
|
|
2758
2717
|
}
|
|
2759
2718
|
}
|
|
2760
|
-
function
|
|
2761
|
-
|
|
2719
|
+
function Je(l, e = {}) {
|
|
2720
|
+
l.addComponent(new lt(e.viewPermission)), l.addComponent(new ss()), l.addComponent(new rt()), l.addComponent(new yn()), l.addComponent(new os()), l.addComponent(new as()), l.addComponent(new Ls()), l.addComponent(new ee()), l.addComponent(new $()), l.addComponent(new le()), l.addComponent(new te()), l.addComponent(new ne()), l.addComponent(new se()), l.addComponent(new oe()), l.addComponent(new ae()), l.addComponent(new ie()), l.addComponent(new dt());
|
|
2762
2721
|
}
|
|
2763
|
-
const
|
|
2764
|
-
create(
|
|
2765
|
-
return (e) =>
|
|
2722
|
+
const Bs = Object.assign(Je, {
|
|
2723
|
+
create(l = {}) {
|
|
2724
|
+
return (e) => Je(e, l);
|
|
2766
2725
|
}
|
|
2767
2726
|
});
|
|
2768
2727
|
export {
|
|
2769
|
-
|
|
2770
|
-
|
|
2728
|
+
Bs as Editor,
|
|
2729
|
+
Je as Editor_
|
|
2771
2730
|
};
|