build-dxf 0.0.39 → 0.0.41
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/README.md +26 -24
- package/package.json +1 -1
- package/src/build.js +561 -566
- package/src/index.css +1 -1
- package/src/index3.js +377 -378
- package/src/utils/CommandManager/CommandManager.d.ts +1 -0
- package/src/utils/DxfSystem/components/Dxf.d.ts +11 -2
- package/src/utils/DxfSystem/utils/originalDataToLineData.d.ts +7 -0
- package/src/utils/Quadtree/LineSegment.d.ts +1 -0
package/src/index3.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import * as u from "three";
|
|
2
|
-
import { i as ut, n as pt, r as Ue, t as qe, c as Pe, d as gt, e as vt, f as De, g as Q, _ as Ze, u as ft, h as fe, j as
|
|
3
|
-
import { C as Ae, P as M, L as N, B as Ye, E as Xe, b as
|
|
2
|
+
import { i as ut, n as pt, r as Ue, t as qe, c as Pe, d as gt, e as vt, f as De, g as Q, _ as Ze, u as ft, h as fe, j as _e, w as yt, k as wt, l as bt, p as xt, m as Ct, o as Et, T as Ne, q as Be, s as Mt, v as Lt, x as Re, y as Ie, z as Le, A as kt, B as It, L as ye, D as Pt, b as Oe, E as re, S as Dt } from "./selectLocalFile.js";
|
|
3
|
+
import { C as Ae, P as M, L as N, B as Ye, E as Xe, b as Fe, Q as ze, u as At, A as St, r as Ke, W as _t, T as Nt } 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 _, defineComponent as me, computed as A, createElementBlock as R, openBlock as D, normalizeClass as j, unref as v, renderSlot as be, createVNode as z, Transition as xe, withCtx as V, withDirectives as $e, createElementVNode as P, normalizeStyle as Se, createTextVNode as X, toDisplayString as de, vShow as et, shallowReactive as Bt, onMounted as tt, createBlock as ge, createCommentVNode as q, resolveDynamicComponent as Rt, Fragment as ve, withModifiers as Ot, nextTick as we, isVNode as nt, render as Te, toRaw as Ft, onUnmounted as zt, renderList as ke, createStaticVNode as Kt, TransitionGroup as Tt, createApp as Vt } from "vue";
|
|
8
|
+
function st(d) {
|
|
9
9
|
var e;
|
|
10
10
|
const t = Ue(d);
|
|
11
11
|
return (e = t?.$el) != null ? e : t;
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
let e, t, n,
|
|
16
|
-
if (ut(d[0]) || Array.isArray(d[0]) ? ([t, n,
|
|
13
|
+
const ot = Pe ? window : void 0;
|
|
14
|
+
function jt(...d) {
|
|
15
|
+
let e, t, n, s;
|
|
16
|
+
if (ut(d[0]) || Array.isArray(d[0]) ? ([t, n, s] = d, e = ot) : [e, t, n, s] = d, !e)
|
|
17
17
|
return pt;
|
|
18
18
|
Array.isArray(t) || (t = [t]), Array.isArray(n) || (n = [n]);
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
}, l = (c, m, y, f) => (c.addEventListener(m, y, f), () => c.removeEventListener(m, y, f)), r = J(() => [
|
|
22
|
-
a(), c &&
|
|
19
|
+
const o = [], a = () => {
|
|
20
|
+
o.forEach((c) => c()), o.length = 0;
|
|
21
|
+
}, l = (c, m, y, f) => (c.addEventListener(m, y, f), () => c.removeEventListener(m, y, f)), r = J(() => [st(e), Ue(s)], ([c, m]) => {
|
|
22
|
+
a(), c && o.push(...t.flatMap((y) => n.map((f) => l(c, y, f, m))));
|
|
23
23
|
}, { immediate: !0, flush: "post" }), i = () => {
|
|
24
24
|
r(), a();
|
|
25
25
|
};
|
|
26
26
|
return qe(i), i;
|
|
27
27
|
}
|
|
28
28
|
function Gt(d, e = !1) {
|
|
29
|
-
const t =
|
|
29
|
+
const t = _(), n = () => t.value = !!d();
|
|
30
30
|
return n(), gt(n, e), t;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
je
|
|
32
|
+
const Ve = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, je = "__vueuse_ssr_handlers__";
|
|
33
|
+
Ve[je] = Ve[je] || {};
|
|
34
34
|
var Ge = Object.getOwnPropertySymbols, Qt = Object.prototype.hasOwnProperty, Ht = Object.prototype.propertyIsEnumerable, Wt = (d, e) => {
|
|
35
35
|
var t = {};
|
|
36
36
|
for (var n in d)
|
|
@@ -41,12 +41,12 @@ var Ge = Object.getOwnPropertySymbols, Qt = Object.prototype.hasOwnProperty, Ht
|
|
|
41
41
|
return t;
|
|
42
42
|
};
|
|
43
43
|
function Jt(d, e, t = {}) {
|
|
44
|
-
const n = t, { window:
|
|
44
|
+
const n = t, { window: s = ot } = n, o = Wt(n, ["window"]);
|
|
45
45
|
let a;
|
|
46
|
-
const l = Gt(() =>
|
|
46
|
+
const l = Gt(() => s && "ResizeObserver" in s), r = () => {
|
|
47
47
|
a && (a.disconnect(), a = void 0);
|
|
48
|
-
}, i = J(() =>
|
|
49
|
-
r(), l.value &&
|
|
48
|
+
}, i = J(() => st(d), (m) => {
|
|
49
|
+
r(), l.value && s && m && (a = new ResizeObserver(e), a.observe(m, o));
|
|
50
50
|
}, { immediate: !0, flush: "post" }), c = () => {
|
|
51
51
|
r(), i();
|
|
52
52
|
};
|
|
@@ -131,34 +131,34 @@ const $t = (d) => d, en = {
|
|
|
131
131
|
}
|
|
132
132
|
}), nn = me({
|
|
133
133
|
name: "ElBadge"
|
|
134
|
-
}),
|
|
134
|
+
}), sn = /* @__PURE__ */ me({
|
|
135
135
|
...nn,
|
|
136
136
|
props: tn,
|
|
137
137
|
setup(d, { expose: e }) {
|
|
138
|
-
const t = d, n = ft("badge"),
|
|
138
|
+
const t = d, n = ft("badge"), s = A(() => t.isDot ? "" : fe(t.value) && fe(t.max) ? t.max < t.value ? `${t.max}+` : `${t.value}` : `${t.value}`), o = A(() => {
|
|
139
139
|
var a, l, r, i, c;
|
|
140
140
|
return [
|
|
141
141
|
{
|
|
142
142
|
backgroundColor: t.color,
|
|
143
|
-
marginRight:
|
|
144
|
-
marginTop:
|
|
143
|
+
marginRight: _e(-((l = (a = t.offset) == null ? void 0 : a[0]) != null ? l : 0)),
|
|
144
|
+
marginTop: _e((i = (r = t.offset) == null ? void 0 : r[1]) != null ? i : 0)
|
|
145
145
|
},
|
|
146
146
|
(c = t.badgeStyle) != null ? c : {}
|
|
147
147
|
];
|
|
148
148
|
});
|
|
149
149
|
return e({
|
|
150
|
-
content:
|
|
150
|
+
content: s
|
|
151
151
|
}), (a, l) => (D(), R("div", {
|
|
152
|
-
class:
|
|
152
|
+
class: j(v(n).b())
|
|
153
153
|
}, [
|
|
154
154
|
be(a.$slots, "default"),
|
|
155
|
-
|
|
155
|
+
z(xe, {
|
|
156
156
|
name: `${v(n).namespace.value}-zoom-in-center`,
|
|
157
157
|
persisted: ""
|
|
158
158
|
}, {
|
|
159
|
-
default:
|
|
159
|
+
default: V(() => [
|
|
160
160
|
$e(P("sup", {
|
|
161
|
-
class:
|
|
161
|
+
class: j([
|
|
162
162
|
v(n).e("content"),
|
|
163
163
|
v(n).em("content", a.type),
|
|
164
164
|
v(n).is("fixed", !!a.$slots.default),
|
|
@@ -166,13 +166,13 @@ const $t = (d) => d, en = {
|
|
|
166
166
|
v(n).is("hide-zero", !a.showZero && t.value === 0),
|
|
167
167
|
a.badgeClass
|
|
168
168
|
]),
|
|
169
|
-
style:
|
|
169
|
+
style: Se(v(o))
|
|
170
170
|
}, [
|
|
171
|
-
be(a.$slots, "content", { value: v(
|
|
172
|
-
X(de(v(
|
|
171
|
+
be(a.$slots, "content", { value: v(s) }, () => [
|
|
172
|
+
X(de(v(s)), 1)
|
|
173
173
|
])
|
|
174
174
|
], 6), [
|
|
175
|
-
[et, !a.hidden && (v(
|
|
175
|
+
[et, !a.hidden && (v(s) || a.isDot || a.$slots.content)]
|
|
176
176
|
])
|
|
177
177
|
]),
|
|
178
178
|
_: 3
|
|
@@ -180,8 +180,8 @@ const $t = (d) => d, en = {
|
|
|
180
180
|
], 2));
|
|
181
181
|
}
|
|
182
182
|
});
|
|
183
|
-
var
|
|
184
|
-
const an = yt(
|
|
183
|
+
var on = /* @__PURE__ */ Ze(sn, [["__file", "badge.vue"]]);
|
|
184
|
+
const an = yt(on), rn = De({
|
|
185
185
|
a11y: {
|
|
186
186
|
type: Boolean,
|
|
187
187
|
default: !0
|
|
@@ -225,8 +225,8 @@ me({
|
|
|
225
225
|
setup(d, { slots: e }) {
|
|
226
226
|
const t = xt(d);
|
|
227
227
|
return J(() => d.message, (n) => {
|
|
228
|
-
var
|
|
229
|
-
Object.assign(T, (
|
|
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
|
});
|
|
@@ -317,7 +317,7 @@ const at = [
|
|
|
317
317
|
}), ln = {
|
|
318
318
|
destroy: () => !0
|
|
319
319
|
}, H = Bt([]), cn = (d) => {
|
|
320
|
-
const e = H.findIndex((
|
|
320
|
+
const e = H.findIndex((s) => s.id === d), t = H[e];
|
|
321
321
|
let n;
|
|
322
322
|
return e > 0 && (n = H[e - 1]), { current: t, prev: n };
|
|
323
323
|
}, mn = (d) => {
|
|
@@ -330,7 +330,7 @@ const at = [
|
|
|
330
330
|
props: dn,
|
|
331
331
|
emits: ln,
|
|
332
332
|
setup(d, { expose: e, emit: t }) {
|
|
333
|
-
const n = d, { Close:
|
|
333
|
+
const n = d, { Close: s } = Mt, o = _(!1), { ns: a, zIndex: l } = Et("message"), { currentZIndex: r, nextZIndex: i } = l, c = _(), m = _(!1), y = _(0);
|
|
334
334
|
let f;
|
|
335
335
|
const g = A(() => n.type ? n.type === "error" ? "danger" : n.type : "info"), h = A(() => {
|
|
336
336
|
const b = n.type;
|
|
@@ -341,51 +341,51 @@ const at = [
|
|
|
341
341
|
}));
|
|
342
342
|
function Z() {
|
|
343
343
|
n.duration !== 0 && ({ stop: f } = Lt(() => {
|
|
344
|
-
|
|
344
|
+
S();
|
|
345
345
|
}, n.duration));
|
|
346
346
|
}
|
|
347
347
|
function G() {
|
|
348
348
|
f?.();
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function S() {
|
|
351
351
|
m.value = !1, we(() => {
|
|
352
352
|
var b;
|
|
353
|
-
|
|
353
|
+
o.value || ((b = n.onClose) == null || b.call(n), t("destroy"));
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
function L({ code: b }) {
|
|
357
|
-
b === en.esc &&
|
|
357
|
+
b === en.esc && S();
|
|
358
358
|
}
|
|
359
359
|
return tt(() => {
|
|
360
360
|
Z(), i(), m.value = !0;
|
|
361
361
|
}), J(() => n.repeatNum, () => {
|
|
362
362
|
G(), Z();
|
|
363
|
-
}),
|
|
363
|
+
}), jt(document, "keydown", L), Jt(c, () => {
|
|
364
364
|
y.value = c.value.getBoundingClientRect().height;
|
|
365
365
|
}), e({
|
|
366
366
|
visible: m,
|
|
367
367
|
bottom: K,
|
|
368
|
-
close:
|
|
369
|
-
}), (b,
|
|
368
|
+
close: S
|
|
369
|
+
}), (b, F) => (D(), ge(xe, {
|
|
370
370
|
name: v(a).b("fade"),
|
|
371
|
-
onBeforeEnter: (W) =>
|
|
371
|
+
onBeforeEnter: (W) => o.value = !0,
|
|
372
372
|
onBeforeLeave: b.onClose,
|
|
373
373
|
onAfterLeave: (W) => b.$emit("destroy"),
|
|
374
374
|
persisted: ""
|
|
375
375
|
}, {
|
|
376
|
-
default:
|
|
376
|
+
default: V(() => [
|
|
377
377
|
$e(P("div", {
|
|
378
378
|
id: b.id,
|
|
379
379
|
ref_key: "messageRef",
|
|
380
380
|
ref: c,
|
|
381
|
-
class:
|
|
381
|
+
class: j([
|
|
382
382
|
v(a).b(),
|
|
383
383
|
{ [v(a).m(b.type)]: b.type },
|
|
384
384
|
v(a).is("closable", b.showClose),
|
|
385
385
|
v(a).is("plain", b.plain),
|
|
386
386
|
b.customClass
|
|
387
387
|
]),
|
|
388
|
-
style:
|
|
388
|
+
style: Se(v(Y)),
|
|
389
389
|
role: "alert",
|
|
390
390
|
onMouseenter: G,
|
|
391
391
|
onMouseleave: Z
|
|
@@ -394,13 +394,13 @@ const at = [
|
|
|
394
394
|
key: 0,
|
|
395
395
|
value: b.repeatNum,
|
|
396
396
|
type: v(g),
|
|
397
|
-
class:
|
|
397
|
+
class: j(v(a).e("badge"))
|
|
398
398
|
}, null, 8, ["value", "type", "class"])) : q("v-if", !0),
|
|
399
399
|
v(E) ? (D(), ge(v(Be), {
|
|
400
400
|
key: 1,
|
|
401
|
-
class:
|
|
401
|
+
class: j([v(a).e("icon"), v(h)])
|
|
402
402
|
}, {
|
|
403
|
-
default:
|
|
403
|
+
default: V(() => [
|
|
404
404
|
(D(), ge(Rt(v(E))))
|
|
405
405
|
]),
|
|
406
406
|
_: 1
|
|
@@ -409,21 +409,21 @@ const at = [
|
|
|
409
409
|
b.dangerouslyUseHTMLString ? (D(), R(ve, { key: 1 }, [
|
|
410
410
|
q(" Caution here, message could've been compromised, never use user's input as message "),
|
|
411
411
|
P("p", {
|
|
412
|
-
class:
|
|
412
|
+
class: j(v(a).e("content")),
|
|
413
413
|
innerHTML: b.message
|
|
414
414
|
}, null, 10, ["innerHTML"])
|
|
415
415
|
], 2112)) : (D(), R("p", {
|
|
416
416
|
key: 0,
|
|
417
|
-
class:
|
|
417
|
+
class: j(v(a).e("content"))
|
|
418
418
|
}, de(b.message), 3))
|
|
419
419
|
]),
|
|
420
420
|
b.showClose ? (D(), ge(v(Be), {
|
|
421
421
|
key: 2,
|
|
422
|
-
class:
|
|
423
|
-
onClick: Ot(
|
|
422
|
+
class: j(v(a).e("closeBtn")),
|
|
423
|
+
onClick: Ot(S, ["stop"])
|
|
424
424
|
}, {
|
|
425
|
-
default:
|
|
426
|
-
|
|
425
|
+
default: V(() => [
|
|
426
|
+
z(v(s))
|
|
427
427
|
]),
|
|
428
428
|
_: 1
|
|
429
429
|
}, 8, ["class", "onClick"])) : q("v-if", !0)
|
|
@@ -457,19 +457,19 @@ const it = (d) => {
|
|
|
457
457
|
const { handler: t } = d;
|
|
458
458
|
t.close();
|
|
459
459
|
}, yn = ({ appendTo: d, ...e }, t) => {
|
|
460
|
-
const n = `message_${vn++}`,
|
|
460
|
+
const n = `message_${vn++}`, s = e.onClose, o = document.createElement("div"), a = {
|
|
461
461
|
...e,
|
|
462
462
|
id: n,
|
|
463
463
|
onClose: () => {
|
|
464
|
-
|
|
464
|
+
s?.(), fn(c);
|
|
465
465
|
},
|
|
466
466
|
onDestroy: () => {
|
|
467
|
-
Te(null,
|
|
467
|
+
Te(null, o);
|
|
468
468
|
}
|
|
469
|
-
}, l =
|
|
469
|
+
}, l = z(gn, a, Ie(a.message) || nt(a.message) ? {
|
|
470
470
|
default: Ie(a.message) ? a.message : () => a.message
|
|
471
471
|
} : null);
|
|
472
|
-
l.appContext = t || ce._context, Te(l,
|
|
472
|
+
l.appContext = t || ce._context, Te(l, o), d.appendChild(o.firstElementChild);
|
|
473
473
|
const r = l.component, c = {
|
|
474
474
|
id: n,
|
|
475
475
|
vnode: l,
|
|
@@ -488,12 +488,12 @@ const it = (d) => {
|
|
|
488
488
|
} };
|
|
489
489
|
const t = it(d);
|
|
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: () => {
|
|
@@ -582,9 +582,9 @@ class O extends Ae {
|
|
|
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
|
}
|
|
@@ -604,14 +604,14 @@ class O extends Ae {
|
|
|
604
604
|
*/
|
|
605
605
|
createPointerMove(e) {
|
|
606
606
|
const t = this.editor, n = new M();
|
|
607
|
-
let
|
|
607
|
+
let s = null, o = null, a = null;
|
|
608
608
|
const l = t.addEventListener("pointerPositionChange", () => {
|
|
609
609
|
const r = M.from(t.pointerPosition);
|
|
610
|
-
if (
|
|
611
|
-
const i = Math.abs(r.x -
|
|
612
|
-
i > c ? n.set(r.x,
|
|
613
|
-
} else if (
|
|
614
|
-
const i =
|
|
610
|
+
if (s && t.eventInput.isKeyDown("shift")) {
|
|
611
|
+
const i = Math.abs(r.x - s.x), c = Math.abs(r.y - s.y);
|
|
612
|
+
i > c ? n.set(r.x, s.y) : n.set(s.x, r.y), e(n, !1);
|
|
613
|
+
} else if (o && a && t.eventInput.isKeyDown("alt")) {
|
|
614
|
+
const i = o.projectPoint(r, !1), c = a.projectPoint(r, !1);
|
|
615
615
|
i && c ? r.distance(i) < r.distance(c) ? n.copy(i) : n.copy(c) : i ? n.copy(i) : c && n.copy(c), e(n, !1);
|
|
616
616
|
} else {
|
|
617
617
|
const { point: i, find: c, line: m } = t.renderManager.adsorption();
|
|
@@ -623,7 +623,7 @@ class O extends Ae {
|
|
|
623
623
|
l();
|
|
624
624
|
},
|
|
625
625
|
setBaseLine(r, i) {
|
|
626
|
-
if (
|
|
626
|
+
if (o = r, s = i, r && i) {
|
|
627
627
|
const c = r.normal();
|
|
628
628
|
a = new N(
|
|
629
629
|
i.clone().add(c.clone().multiplyScalar(10)),
|
|
@@ -651,7 +651,7 @@ class bn 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 = this.renderer.createCircle(M.zero(), { color: 65280 }), l = t.domContainer.domElement, r = new ye([], 16711935), i = new ye([
|
|
655
655
|
new u.Vector3(-1e4, 0, 0),
|
|
656
656
|
new u.Vector3(1e4, 0, 0),
|
|
657
657
|
new u.Vector3(0, -1e4, 0),
|
|
@@ -664,11 +664,11 @@ class bn extends O {
|
|
|
664
664
|
linewidth: 0.1
|
|
665
665
|
}), this.container.add(r);
|
|
666
666
|
const c = () => {
|
|
667
|
-
r.setPoint(...
|
|
667
|
+
r.setPoint(...o, n, s), i.position.copy(s), this.container.add(i), i.computeLineDistances();
|
|
668
668
|
}, m = new u.Vector3();
|
|
669
669
|
let y;
|
|
670
670
|
const f = this.createPointerMove((g, h, E) => {
|
|
671
|
-
m.set(g.x, g.y, 0), this.dispatchEvent({ type: "pointerMove", point: m }), y = E, h ? (a.position.set(g.x, g.y, 0), this.container.add(a), l.style.cursor = "none") : (a.removeFromParent(), l.style.cursor = "crosshair"), n &&
|
|
671
|
+
m.set(g.x, g.y, 0), this.dispatchEvent({ type: "pointerMove", point: m }), y = E, h ? (a.position.set(g.x, g.y, 0), this.container.add(a), l.style.cursor = "none") : (a.removeFromParent(), l.style.cursor = "crosshair"), n && s && (c(), s.copy(m));
|
|
672
672
|
});
|
|
673
673
|
this.addEventRecord(
|
|
674
674
|
"clear",
|
|
@@ -676,21 +676,21 @@ class bn extends O {
|
|
|
676
676
|
t.eventInput.addEventListener("codeChange", async () => {
|
|
677
677
|
if (t.eventInput.isKeyDown("mouse_0")) {
|
|
678
678
|
if (!n) {
|
|
679
|
-
n = m.clone(),
|
|
679
|
+
n = m.clone(), s = m.clone(), c(), f.setBaseLine(y ?? null, M.from(n));
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
682
|
-
|
|
683
|
-
const g = new N(M.from(n), M.from(
|
|
684
|
-
f.setBaseLine(g, g.end), n.copy(
|
|
682
|
+
s = m.clone(), o.push(n.clone(), s.clone());
|
|
683
|
+
const g = new N(M.from(n), M.from(s));
|
|
684
|
+
f.setBaseLine(g, g.end), n.copy(s), c();
|
|
685
685
|
} else if (t.eventInput.isOnlyKeyDowns(this.withdrawalKeys)) {
|
|
686
|
-
if (
|
|
686
|
+
if (o.length) {
|
|
687
687
|
const { point: g } = t.renderManager.adsorption();
|
|
688
|
-
if (
|
|
689
|
-
const h = new N(M.from(
|
|
688
|
+
if (o.pop(), s?.copy(g), n?.copy(o.pop()), c(), o.length >= 2) {
|
|
689
|
+
const h = new N(M.from(o[o.length - 2]), M.from(o[o.length - 1]));
|
|
690
690
|
f.setBaseLine(h, h.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
|
r.removeFromParent(), a.removeFromParent(), i.removeFromParent();
|
|
@@ -702,8 +702,8 @@ class bn extends O {
|
|
|
702
702
|
*/
|
|
703
703
|
end(e, t) {
|
|
704
704
|
const n = [];
|
|
705
|
-
for (let
|
|
706
|
-
n.push(new N(M.from(t[
|
|
705
|
+
for (let s = 0; s < t.length; s += 2)
|
|
706
|
+
n.push(new N(M.from(t[s]), M.from(t[s + 1])));
|
|
707
707
|
e(n);
|
|
708
708
|
}
|
|
709
709
|
/** 执行完成
|
|
@@ -778,8 +778,8 @@ class rt extends O {
|
|
|
778
778
|
* @param next
|
|
779
779
|
*/
|
|
780
780
|
start() {
|
|
781
|
-
const e = this.editor, t = e.eventInput, n = new u.Mesh(),
|
|
782
|
-
let
|
|
781
|
+
const e = this.editor, t = e.eventInput, n = new u.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 u.MeshBasicMaterial({ color: 55561 });
|
|
784
784
|
const a = () => {
|
|
785
785
|
const r = e.pointerPosition.clone(), i = e.pointerPosition.clone(), c = new u.Mesh();
|
|
@@ -830,24 +830,24 @@ class rt extends O {
|
|
|
830
830
|
const { line: r } = e.renderManager.adsorption();
|
|
831
831
|
if (r) {
|
|
832
832
|
const i = r.expandToRectangle(0.025, "bothSides");
|
|
833
|
-
n.geometry = e.renderManager.createGeometry({ position: i.createGeometry() }, 6), this.container.add(n),
|
|
833
|
+
n.geometry = e.renderManager.createGeometry({ position: i.createGeometry() }, 6), this.container.add(n), s.style.cursor = "pointer", o = r;
|
|
834
834
|
const c = r.center;
|
|
835
835
|
l.element.innerText = parseInt(r.length() * 1e3 + "") + " mm", l.position.set(c.x, c.y, 0), l.visible = !0;
|
|
836
836
|
} else
|
|
837
|
-
n.removeFromParent(),
|
|
837
|
+
n.removeFromParent(), s.style.cursor = "default", o = null, l.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() {
|
|
@@ -934,25 +934,25 @@ class Cn extends Xe {
|
|
|
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 (
|
|
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((l) => {
|
|
945
945
|
this.resolve = l, a(l, 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 Cn extends Xe {
|
|
|
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,12 +988,15 @@ class Cn extends Xe {
|
|
|
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}`);
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
|
+
destroy() {
|
|
998
|
+
this.cancel(), this.commandFlowMap.clear(), this.lock = !1, this.abortController = null, this.resolve = null, this.executionResolve = null, this.executionPromise = null, this.currentName = null, this.operationList.length = 0, this.rollbackList.length = 0;
|
|
999
|
+
}
|
|
997
1000
|
}
|
|
998
1001
|
const En = "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%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='5569'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M522.1888%20811.3152a412.1088%20412.1088%200%200%200-114.5344-269.7728l-244.48%20269.7728h359.0144zM450.816%20493.824c83.5072%2085.3504%20132.7104%20197.4784%20136.5504%20317.4912h417.5872v63.232H18.9952L676.1472%20149.4016l48.9472%2041.7792-274.2784%20302.6432z'%20%3e%3c/path%3e%3c/svg%3e", Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
999
1002
|
__proto__: null,
|
|
@@ -1007,24 +1010,24 @@ const En = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
|
|
|
1007
1010
|
}, Symbol.toStringTag, { value: "Module" })), Dn = "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='M909.050991%20169.476903l-217.554898%200%200-31.346939c0-39.5866-32.205493-71.792093-71.793116-71.792093L408.15591%2066.337871c-39.5866%200-71.792093%2032.205493-71.792093%2071.792093l0%2031.346939L113.349581%20169.476903c-11.013845%200-19.942191%208.940626-19.942191%2019.954471s8.928347%2019.954471%2019.942191%2019.954471l84.264149%200%200%20640.687918c0%2060.479443%2049.203632%20109.683075%20109.683075%20109.683075l416.474366%200c60.479443%200%20109.683075-49.203632%20109.683075-109.683075L833.454246%20209.385844l75.595722%200c11.012821%200%2019.942191-8.940626%2019.942191-19.954471S920.063813%20169.476903%20909.050991%20169.476903zM376.2482%20138.130987c0-17.593703%2014.314007-31.907711%2031.907711-31.907711l211.547067%200c17.593703%200%2031.907711%2014.314007%2031.907711%2031.907711l0%2031.346939L376.2482%20169.477926%20376.2482%20138.130987zM793.569864%20850.074785c0%2038.486546-31.312146%2069.798692-69.798692%2069.798692L307.297828%20919.873478c-38.486546%200-69.798692-31.312146-69.798692-69.798692L237.499136%20211.042577l556.070728%200L793.569864%20850.074785zM510.662539%20861.276918c11.012821%200%2019.954471-8.92937%2019.954471-19.942191L530.61701%20294.912753c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471%208.928347-19.954471%2019.942191L490.708068%20841.334727C490.708068%20852.347548%20499.649717%20861.276918%20510.662539%20861.276918zM374.562814%20801.449321c11.012821%200%2019.954471-8.92937%2019.954471-19.942191L394.517285%20354.74035c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471%208.928347-19.954471%2019.942191l0%20426.76678C354.608344%20792.519951%20363.549993%20801.449321%20374.562814%20801.449321zM649.832182%20801.449321c11.012821%200%2019.954471-8.92937%2019.954471-19.942191L669.786653%20354.74035c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471%208.928347-19.954471%2019.942191l0%20426.76678C629.877711%20792.519951%20638.81936%20801.449321%20649.832182%20801.449321z'%20%3e%3c/path%3e%3c/svg%3e", An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1008
1011
|
__proto__: null,
|
|
1009
1012
|
default: Dn
|
|
1010
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1013
|
+
}, Symbol.toStringTag, { value: "Module" })), Sn = "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='M220.451548%20913.518482V318.145854c0-27.62038%2022.505495-50.125874%2050.125875-50.125874H865.95005c27.62038%200%2050.125874%2022.505495%2050.125874%2050.125874v218.917083h59.332667V318.145854c0-60.355644-49.102897-109.458541-109.458541-109.458541h-39.896104v-99.228772C826.053946%2049.102897%20776.951049%200%20716.595405%200H121.222777C60.867133%200%2011.764236%2049.102897%2011.764236%20109.458541V705.854146c0%2060.355644%2049.102897%20109.458541%20109.458541%20109.458541h39.896104v99.228772c0%2060.355644%2049.102897%20109.458541%20109.458542%20109.458541h257.790209v-59.332667H269.554446c-26.597403-1.022977-49.102897-23.528472-49.102898-51.148851z%20m-59.332667-595.372628v436.811189h-39.896104c-27.62038%200-50.125874-22.505495-50.125874-50.125874V109.458541c0-27.62038%2022.505495-50.125874%2050.125874-50.125874H716.595405c27.62038%200%2050.125874%2022.505495%2050.125874%2050.125874v99.228772H269.554446c-59.332667%200-108.435564%2049.102897-108.435565%20109.458541z'%20%3e%3c/path%3e%3cpath%20d='M902.777223%20854.185814l98.205794-98.205794c15.344655-15.344655%2015.344655-40.919081%200-56.263736s-40.919081-15.344655-56.263736%200L846.513487%20797.922078%20747.284715%20699.716284c-15.344655-15.344655-40.919081-15.344655-56.263736%200s-15.344655%2040.919081%200%2056.263736l98.205794%2098.205794-98.205794%2098.205794c-15.344655%2015.344655-15.344655%2040.919081%200%2056.263737s40.919081%2015.344655%2056.263736%200l98.205794-98.205795%2098.205795%2098.205795c15.344655%2015.344655%2040.919081%2015.344655%2056.263736%200s15.344655-40.919081%200-56.263737l-97.182817-98.205794z'%20%3e%3c/path%3e%3c/svg%3e", _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1011
1014
|
__proto__: null,
|
|
1012
|
-
default:
|
|
1015
|
+
default: Sn
|
|
1013
1016
|
}, Symbol.toStringTag, { value: "Module" })), Nn = "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='1757902601497'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='9801'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M761.344%20119.296H226.816c-18.944%200-39.424%2011.776-39.424%2030.72V921.6h614.4V148.48c0.512-18.944-22.016-29.184-40.448-29.184z%20m-537.6%20768c-2.048%200-2.048%200%200%200L221.696%20163.84c0-5.12%205.12-10.24%2010.24-10.24h522.24c8.704%200%2013.824%205.12%2013.824%2013.824v720.384s0%201.536-1.536%201.536h-15.36V194.56c0-16.896-8.704-24.064-29.184-24.064H266.24c-18.944%200-27.136%208.704-27.136%2024.064v692.736h-15.36z%20m49.152%200V204.8H716.8v682.496H272.896z'%20p-id='9802'%3e%3c/path%3e%3cpath%20d='M648.704%20508.416c-16.896%200-32.256%2013.824-32.256%2032.256%200%2016.896%2013.824%2032.256%2032.256%2032.256s32.256-13.824%2032.256-32.256c0-16.896-13.824-32.256-32.256-32.256z'%20p-id='9803'%3e%3c/path%3e%3c/svg%3e", Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1014
1017
|
__proto__: null,
|
|
1015
1018
|
default: Nn
|
|
1016
1019
|
}, Symbol.toStringTag, { value: "Module" })), Rn = "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='M491.80027198%20557.44938977c-10.0998647-15.14979706-20.19972802-25.24966037-35.34952507-35.34952507-15.14979706-10.0998647-30.29959271-15.14979706-50.49932211-15.14979704-55.54925309%200-100.99864286%2045.44938977-100.99864287%20100.99864285%200%2015.14979706%205.04993234%2035.34952507%2015.14979568%2050.49932212%2010.0998647%2015.14979706%2020.19972802%2030.29959271%2035.34952506%2035.34952508%2015.14979706%2010.0998647%2035.34952507%2015.14979706%2050.49932213%2015.14979567%2055.54925309%200%20100.99864286-45.44938977%20100.99864286-100.99864287%200-15.14979706-5.04993234-35.34952507-15.14979568-50.49932074z%20m-85.84884718%20100.99864286h-15.14979706c-20.19972802-5.04993234-30.29959271-20.19972802-35.34952507-35.34952507V612.99864286c0-30.29959271%2025.24966037-50.49932212%2050.49932213-50.49932074h10.09986469c15.14979706%205.04993234%2030.29959271%2015.14979706%2035.34952507%2035.34952507v15.14979567c5.04993234%2025.24966037-20.19972802%2045.44938977-45.44938976%2045.44938977z'%3e%3c/path%3e%3cpath%20d='M390.80162774%20658.44803263l-40.39945604%2040.39945743-227.24694747%20222.19701373-35.34952506-35.34952508%20227.24694745-227.24694608%2040.39945605-40.39945743c5.04993234%2020.19972802%2020.19972802%2035.34952507%2035.34952507%2040.39945743zM648.34816793%20405.9514248l-40.39945742%2040.3994574-116.14843853%20116.14843992-40.39945742%2035.34952507c-5.04993234-20.19972802-20.19972802-30.29959271-35.34952507-35.34952507l40.39945742-40.39945742%20116.14843853-111.09850756%2035.34952507-35.34952507c10.0998647%2015.14979706%2020.19972802%2025.24966037%2040.39945742%2030.29959273zM926.09443614%20133.25508894L749.34681078%20310.00271428l-40.3994574%2040.39945742c-5.04993234-20.19972802-15.14979706-35.34952507-30.29959272-40.39945742l35.34952506-40.39945742%20176.74762534-176.74762535%2035.34952508%2040.39945743z'%20%3e%3c/path%3e%3cpath%20d='M749.34681078%20310.00271428c-10.0998647-15.14979706-20.19972802-30.29959271-35.34952506-35.34952506-15.14979706-10.0998647-35.34952507-15.14979706-55.54925309-15.14979706-55.54925309%200-100.99864286%2045.44938977-100.99864286%20100.99864286%200%2020.19972802%205.04993234%2040.39945743%2015.14979567%2055.54925447%2010.0998647%2015.14979706%2020.19972802%2025.24966037%2035.34952507%2035.34952507%2015.14979706%2010.0998647%2030.29959271%2015.14979706%2050.49932212%2015.14979567%2055.54925309%200%20100.99864286-45.44938977%20100.99864286-100.99864286%200-25.24966037-5.04993234-40.39945743-10.09986471-55.54925309z%20m-90.89877815%2095.94871052h-10.0998647c-20.19972802-5.04993234-35.34952507-15.14979706-40.39945742-35.34952509%200-5.04993234-5.04993234-10.0998647-5.04993234-15.14979704%200-30.29959271%2025.24966037-50.49932212%2050.49932212-50.49932074%205.04993234%200%2010.0998647%200%2015.14979704%205.04993235%2015.14979706%205.04993234%2030.29959271%2020.19972802%2030.29959273%2040.39945742v10.09986332c10.0998647%2025.24966037-15.14979706%2045.44938977-40.39945743%2045.44938978z'%20%3e%3c/path%3e%3c/svg%3e", On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1017
1020
|
__proto__: null,
|
|
1018
1021
|
default: Rn
|
|
1019
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1022
|
+
}, Symbol.toStringTag, { value: "Module" })), Fn = "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", zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1020
1023
|
__proto__: null,
|
|
1021
|
-
default:
|
|
1024
|
+
default: Fn
|
|
1022
1025
|
}, 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", Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1023
1026
|
__proto__: null,
|
|
1024
1027
|
default: Kn
|
|
1025
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1028
|
+
}, Symbol.toStringTag, { value: "Module" })), Vn = "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
1029
|
__proto__: null,
|
|
1027
|
-
default:
|
|
1030
|
+
default: Vn
|
|
1028
1031
|
}, Symbol.toStringTag, { value: "Module" })), Gn = "data:image/svg+xml,%3csvg%20viewBox='0%200%201048%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M310.04722%20451.334244A49.95122%2049.95122%200%200%201%20239.416195%20521.990244L27.473171%20310.04722a49.95122%2049.95122%200%200%201%200-70.631025L239.416195%2027.473171a49.95122%2049.95122%200%200%201%2070.631025%2070.631024l-126.651318%20126.626342L649.365854%20224.780488c220.709463%200%20399.609756%20178.900293%20399.609756%20399.609756s-178.900293%20399.609756-399.609756%20399.609756H124.878049a49.95122%2049.95122%200%201%201%200-99.902439h524.487805c165.513366%200%20299.707317-134.193951%20299.707317-299.707317s-134.193951-299.707317-299.707317-299.707317H183.395902l126.651318%20126.651317z'%3e%3c/path%3e%3c/svg%3e", Qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1029
1032
|
__proto__: null,
|
|
1030
1033
|
default: Gn
|
|
@@ -1040,17 +1043,17 @@ const En = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
|
|
|
1040
1043
|
}, Symbol.toStringTag, { value: "Module" })), Yn = "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='1759051895215'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1800'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M272.5888%20886.784v70.8608H203.2128V886.784h69.376z%20m416.256-256.6144l270.6944%20152.5248-270.6944%20148.1216v-114.8928H64.4608v-70.8608h624.384v-114.8928z%20m-416.256-26.88v70.912H203.2128v-70.912h69.376z%20m0-141.7216V532.48H203.2128V461.568h69.376z%20m-34.7136-398.336L385.024%20319.7952H272.5888V390.656H203.2128V319.8464H90.7776l147.0976-256.6656z'%20fill='%23444444'%20p-id='1801'%3e%3c/path%3e%3cpath%20d='M566.272%2073.3184l173.2608%20264.192V512h71.8848V337.5104l173.2608-264.192H898.048l-122.2656%20197.2224-122.88-197.2224H566.272z'%20fill='%230077FF'%20p-id='1802'%3e%3c/path%3e%3c/svg%3e", Xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1041
1044
|
__proto__: null,
|
|
1042
1045
|
default: Yn
|
|
1043
|
-
}, Symbol.toStringTag, { value: "Module" })), $n = "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",
|
|
1046
|
+
}, Symbol.toStringTag, { value: "Module" })), $n = "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", es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1044
1047
|
__proto__: null,
|
|
1045
1048
|
default: $n
|
|
1046
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1047
|
-
class
|
|
1049
|
+
}, Symbol.toStringTag, { value: "Module" })), ts = "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==", ns = new u.TextureLoader(), ss = ns.load(ts);
|
|
1050
|
+
class os extends Ae {
|
|
1048
1051
|
static name = "RenderManager";
|
|
1049
1052
|
container = new u.Group();
|
|
1050
1053
|
lines = [];
|
|
1051
|
-
pointVirtualGrid = new
|
|
1052
|
-
quadtree = new
|
|
1053
|
-
verticalReferenceLineFlag = new u.Mesh(new u.PlaneGeometry(0.3, 0.3), new u.MeshBasicMaterial({ map:
|
|
1054
|
+
pointVirtualGrid = new Fe();
|
|
1055
|
+
quadtree = new ze(new Ye());
|
|
1056
|
+
verticalReferenceLineFlag = new u.Mesh(new u.PlaneGeometry(0.3, 0.3), new u.MeshBasicMaterial({ map: ss, color: 58111, transparent: !0 }));
|
|
1054
1057
|
onAddFromParent() {
|
|
1055
1058
|
const e = this.dxfLineModel;
|
|
1056
1059
|
this.editor.container.add(this.container), this.editor.container.add(e.dxfModelGroup), e.dxfLineModel.material = new u.LineBasicMaterial({
|
|
@@ -1070,17 +1073,11 @@ class so extends Ae {
|
|
|
1070
1073
|
return;
|
|
1071
1074
|
} else
|
|
1072
1075
|
this.updatedMode = "dxf";
|
|
1073
|
-
this.pointVirtualGrid = new
|
|
1076
|
+
this.pointVirtualGrid = new Fe();
|
|
1074
1077
|
const e = this.dxf.box.clone().expansion(Math.max(this.dxf.box.width, this.dxf.box.height) * 2);
|
|
1075
|
-
(e.width === 0 || e.height === 0) && e.set(-200, -200, 200, 200), this.quadtree = new
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
const n = t.clone();
|
|
1079
|
-
n.userData = {
|
|
1080
|
-
isDoor: !0,
|
|
1081
|
-
doorDirectConnection: !0
|
|
1082
|
-
}, this.addLine(n);
|
|
1083
|
-
}), this.draw();
|
|
1078
|
+
(e.width === 0 || e.height === 0) && e.set(-200, -200, 200, 200), this.quadtree = new ze(e), this.lines.length = 0;
|
|
1079
|
+
const t = this.dxf.getLineSegments();
|
|
1080
|
+
this.addLines(t), this.draw();
|
|
1084
1081
|
}
|
|
1085
1082
|
/** 添加线段
|
|
1086
1083
|
* @param line
|
|
@@ -1101,11 +1098,11 @@ class so extends Ae {
|
|
|
1101
1098
|
for (let t = 0; t < e.length; t++) {
|
|
1102
1099
|
const n = e[t];
|
|
1103
1100
|
this.lines.push(n), this.pointVirtualGrid.insert(n.start, n), this.pointVirtualGrid.insert(n.end, n);
|
|
1104
|
-
const
|
|
1101
|
+
const s = {
|
|
1105
1102
|
line: n,
|
|
1106
1103
|
userData: void 0
|
|
1107
1104
|
};
|
|
1108
|
-
n.userData.quadtreeNode =
|
|
1105
|
+
n.userData.quadtreeNode = s, this.quadtree.insert(s);
|
|
1109
1106
|
}
|
|
1110
1107
|
}
|
|
1111
1108
|
/** 移除线段
|
|
@@ -1124,8 +1121,8 @@ class so extends Ae {
|
|
|
1124
1121
|
for (let t = 0; t < e.length; t++) {
|
|
1125
1122
|
const n = e[t];
|
|
1126
1123
|
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(
|
|
1124
|
+
const s = this.lines.indexOf(n);
|
|
1125
|
+
this.lines.splice(s, 1);
|
|
1129
1126
|
}
|
|
1130
1127
|
this.draw();
|
|
1131
1128
|
}
|
|
@@ -1134,15 +1131,15 @@ class so extends Ae {
|
|
|
1134
1131
|
*/
|
|
1135
1132
|
draw(e = !0) {
|
|
1136
1133
|
this.container.clear();
|
|
1137
|
-
const t = [], n = [],
|
|
1138
|
-
this.lines.forEach((
|
|
1139
|
-
if (
|
|
1140
|
-
|
|
1141
|
-
}),
|
|
1142
|
-
const r = M.from(l), i =
|
|
1143
|
-
|
|
1144
|
-
}),
|
|
1145
|
-
const a =
|
|
1134
|
+
const t = [], n = [], s = [];
|
|
1135
|
+
this.lines.forEach((o) => {
|
|
1136
|
+
if (o.points.forEach((a) => {
|
|
1137
|
+
o.userData.isDoor ? n.push(a.x, a.y, 0) : t.push(a.x, a.y, 0);
|
|
1138
|
+
}), o.userData.isWindow && o.userData.drawWindow && o.userData.drawWindow.forEach(({ width: a, p: l }) => {
|
|
1139
|
+
const r = M.from(l), i = o.direction(), c = r.clone().add(i.clone().multiplyScalar(a * 0.5)), m = r.clone().add(i.clone().multiplyScalar(-a * 0.5));
|
|
1140
|
+
s.push(c.x, c.y, 1e-3), s.push(m.x, m.y, 1e-3);
|
|
1141
|
+
}), o.userData.isVerticalReferenceLine) {
|
|
1142
|
+
const a = o.center;
|
|
1146
1143
|
this.verticalReferenceLineFlag.position.set(a.x, a.y, 0), this.container.add(this.verticalReferenceLineFlag);
|
|
1147
1144
|
}
|
|
1148
1145
|
}), t.length && this.renderer.createLineSegments({
|
|
@@ -1153,9 +1150,9 @@ class so extends Ae {
|
|
|
1153
1150
|
position: n
|
|
1154
1151
|
}, n.length / 3, {
|
|
1155
1152
|
color: 16776960
|
|
1156
|
-
}, this.container),
|
|
1157
|
-
position:
|
|
1158
|
-
},
|
|
1153
|
+
}, this.container), s.length && this.renderer.createLineSegments({
|
|
1154
|
+
position: s
|
|
1155
|
+
}, s.length / 3, {
|
|
1159
1156
|
color: 16711935
|
|
1160
1157
|
}, this.container), e && this.synchronizeDxf();
|
|
1161
1158
|
}
|
|
@@ -1164,18 +1161,18 @@ class so extends Ae {
|
|
|
1164
1161
|
* @returns
|
|
1165
1162
|
*/
|
|
1166
1163
|
adsorption(e = 0.04, t = this.pointVirtualGrid, n = this.quadtree) {
|
|
1167
|
-
const
|
|
1168
|
-
let a = n.queryCircle(
|
|
1164
|
+
const s = this.parent?.findComponentByName("Editor"), o = M.from(s.pointerPosition);
|
|
1165
|
+
let a = n.queryCircle(o, e);
|
|
1169
1166
|
if (a.length) {
|
|
1170
|
-
let l = a.map((r) => r.line.projectPoint(
|
|
1171
|
-
if (a = a.filter((r, i) => !!l[i]), l = l.filter((r, i) => !!l[i]), l.sort((r, i) => r && i ? r.distance(
|
|
1167
|
+
let l = a.map((r) => r.line.projectPoint(o));
|
|
1168
|
+
if (a = a.filter((r, i) => !!l[i]), l = l.filter((r, i) => !!l[i]), l.sort((r, i) => r && i ? r.distance(o) - i.distance(o) : 0), l.length) {
|
|
1172
1169
|
const r = a[0].line, i = l[0];
|
|
1173
|
-
return r.start.distance(
|
|
1170
|
+
return r.start.distance(o) < e * 1.5 ? {
|
|
1174
1171
|
point: new u.Vector3(r.start.x, r.start.y, 0),
|
|
1175
1172
|
find: !0,
|
|
1176
1173
|
mode: "point",
|
|
1177
1174
|
line: r
|
|
1178
|
-
} : r.end.distance(
|
|
1175
|
+
} : r.end.distance(o) < e * 1.5 ? {
|
|
1179
1176
|
point: new u.Vector3(r.end.x, r.end.y, 0),
|
|
1180
1177
|
find: !0,
|
|
1181
1178
|
mode: "point",
|
|
@@ -1189,7 +1186,7 @@ class so extends Ae {
|
|
|
1189
1186
|
}
|
|
1190
1187
|
}
|
|
1191
1188
|
return {
|
|
1192
|
-
point: new u.Vector3(
|
|
1189
|
+
point: new u.Vector3(s.pointerPosition.x, s.pointerPosition.y, 0),
|
|
1193
1190
|
find: !1
|
|
1194
1191
|
};
|
|
1195
1192
|
}
|
|
@@ -1198,8 +1195,8 @@ class so extends Ae {
|
|
|
1198
1195
|
*/
|
|
1199
1196
|
createGeometry(e, t) {
|
|
1200
1197
|
const n = new u.BufferGeometry();
|
|
1201
|
-
return Object.keys(e).forEach((
|
|
1202
|
-
n.setAttribute("position", new u.BufferAttribute(new Float32Array(e[
|
|
1198
|
+
return Object.keys(e).forEach((s) => {
|
|
1199
|
+
n.setAttribute("position", new u.BufferAttribute(new Float32Array(e[s]), e[s].length / t));
|
|
1203
1200
|
}), n;
|
|
1204
1201
|
}
|
|
1205
1202
|
/**
|
|
@@ -1207,21 +1204,21 @@ class so extends Ae {
|
|
|
1207
1204
|
*/
|
|
1208
1205
|
toJson() {
|
|
1209
1206
|
return this.lines.map((e) => {
|
|
1210
|
-
const t = e.userData, n = t.drawWindow,
|
|
1207
|
+
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) }));
|
|
1211
1208
|
return {
|
|
1212
1209
|
start: e.start.toJson(this.dxf.originalZAverage),
|
|
1213
1210
|
end: e.end.toJson(this.dxf.originalZAverage),
|
|
1214
|
-
insetionArr:
|
|
1211
|
+
insetionArr: s,
|
|
1215
1212
|
isDoor: t.isDoor,
|
|
1216
1213
|
doorDirectConnection: t.isDoor,
|
|
1217
1214
|
length: e.length(),
|
|
1218
1215
|
isWindow: t.isWindow,
|
|
1219
1216
|
isVerticalReferenceLine: t.isVerticalReferenceLine,
|
|
1220
1217
|
wallWidth: e.userData.wallWidth,
|
|
1221
|
-
drawWindow: n && n.map((
|
|
1222
|
-
p: { x:
|
|
1223
|
-
width:
|
|
1224
|
-
full:
|
|
1218
|
+
drawWindow: n && n.map((o) => ({
|
|
1219
|
+
p: { x: o.p.x, y: o.p.y, z: o.p.z },
|
|
1220
|
+
width: o.width,
|
|
1221
|
+
full: o.full
|
|
1225
1222
|
}))
|
|
1226
1223
|
};
|
|
1227
1224
|
});
|
|
@@ -1262,7 +1259,7 @@ class so extends Ae {
|
|
|
1262
1259
|
return this.parent?.findComponentByName("DxfLineModel");
|
|
1263
1260
|
}
|
|
1264
1261
|
}
|
|
1265
|
-
class
|
|
1262
|
+
class as extends O {
|
|
1266
1263
|
static name = "DrawDoorLine";
|
|
1267
1264
|
container = new u.Group();
|
|
1268
1265
|
interruptKeys = ["escape"];
|
|
@@ -1270,18 +1267,18 @@ class ao extends O {
|
|
|
1270
1267
|
commandName = "draw-door-line";
|
|
1271
1268
|
onAddFromParent(e) {
|
|
1272
1269
|
super.onAddFromParent(e);
|
|
1273
|
-
const t = e.findComponentByName("Editor"), n = t.eventInput,
|
|
1270
|
+
const t = e.findComponentByName("Editor"), n = t.eventInput, s = t.commandManager;
|
|
1274
1271
|
this.editor.container.add(this.container);
|
|
1275
|
-
const
|
|
1276
|
-
n.addKeyCombination(this.commandName, this.shortcutKeys),
|
|
1277
|
-
n.isKeyCombination(this.commandName) && await
|
|
1272
|
+
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));
|
|
1273
|
+
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 () => {
|
|
1274
|
+
n.isKeyCombination(this.commandName) && await s.start(this.commandName);
|
|
1278
1275
|
});
|
|
1279
1276
|
}
|
|
1280
1277
|
/** 选择点
|
|
1281
1278
|
* @param next
|
|
1282
1279
|
*/
|
|
1283
1280
|
selectPoint(e) {
|
|
1284
|
-
let t = this.parent?.findComponentByName("Editor"), n = null,
|
|
1281
|
+
let t = this.parent?.findComponentByName("Editor"), n = null, s = this.renderer.createCircle(M.zero(), { color: 65280 }), o = new ye([], 16711935), a = new ye([
|
|
1285
1282
|
new u.Vector3(-1e4, 0, 0),
|
|
1286
1283
|
new u.Vector3(1e4, 0, 0),
|
|
1287
1284
|
new u.Vector3(0, -1e4, 0),
|
|
@@ -1292,13 +1289,13 @@ class ao extends O {
|
|
|
1292
1289
|
dashSize: 0.1,
|
|
1293
1290
|
gapSize: 0.1,
|
|
1294
1291
|
linewidth: 0.1
|
|
1295
|
-
}), this.container.add(
|
|
1292
|
+
}), this.container.add(o);
|
|
1296
1293
|
let l = null;
|
|
1297
1294
|
this.addEventRecord(
|
|
1298
1295
|
"clear",
|
|
1299
1296
|
t.addEventListener("pointerPositionChange", () => {
|
|
1300
1297
|
const { point: r, find: i } = t.renderManager.adsorption();
|
|
1301
|
-
n &&
|
|
1298
|
+
n && o.setPoint(n, r), this.dispatchEvent({ type: "pointerMove", point: r }), i ? (s.position.set(r.x, r.y, 0), this.container.add(s), this.domElement.style.cursor = "none", l = r.clone()) : (l = null, s.removeFromParent(), this.domElement.style.cursor = "no-drop");
|
|
1302
1299
|
}),
|
|
1303
1300
|
t.eventInput.addEventListener("codeChange", async () => {
|
|
1304
1301
|
if (t.eventInput.isKeyDown("mouse_0") && l) {
|
|
@@ -1310,7 +1307,7 @@ class ao extends O {
|
|
|
1310
1307
|
}
|
|
1311
1308
|
}),
|
|
1312
1309
|
function() {
|
|
1313
|
-
|
|
1310
|
+
o.removeFromParent(), s.removeFromParent(), a.removeFromParent();
|
|
1314
1311
|
}
|
|
1315
1312
|
);
|
|
1316
1313
|
}
|
|
@@ -1321,21 +1318,21 @@ class ao extends O {
|
|
|
1321
1318
|
*/
|
|
1322
1319
|
end(e, t) {
|
|
1323
1320
|
const n = [];
|
|
1324
|
-
for (let
|
|
1325
|
-
const
|
|
1321
|
+
for (let s = 0; s < t.length; s += 2) {
|
|
1322
|
+
const o = M.from(t[s]), a = M.from(t[s + 1]), l = this.renderManager.quadtree.queryCircle(o, 1e-3)[0].line, r = this.renderManager.quadtree.queryCircle(a, 1e-3)[0].line;
|
|
1326
1323
|
let i = null;
|
|
1327
1324
|
l === r && (i = {
|
|
1328
1325
|
oldLine: l,
|
|
1329
1326
|
newLine1: new N(
|
|
1330
1327
|
l.start,
|
|
1331
|
-
l.start.distance(
|
|
1328
|
+
l.start.distance(o) < l.start.distance(a) ? o.clone() : a.clone()
|
|
1332
1329
|
),
|
|
1333
1330
|
newLine2: new N(
|
|
1334
1331
|
l.end,
|
|
1335
|
-
l.end.distance(
|
|
1332
|
+
l.end.distance(o) < l.end.distance(a) ? o.clone() : a.clone()
|
|
1336
1333
|
)
|
|
1337
1334
|
});
|
|
1338
|
-
const c = new N(
|
|
1335
|
+
const c = new N(o, a);
|
|
1339
1336
|
c.userData.isDoor = !0, c.userData.doorDirectConnection = !0, n.push({
|
|
1340
1337
|
line: c,
|
|
1341
1338
|
option: i
|
|
@@ -1366,7 +1363,7 @@ class ao extends O {
|
|
|
1366
1363
|
return this.completed(e), e;
|
|
1367
1364
|
}
|
|
1368
1365
|
}
|
|
1369
|
-
class
|
|
1366
|
+
class is extends O {
|
|
1370
1367
|
static name = "DrawWindow";
|
|
1371
1368
|
container = new u.Group();
|
|
1372
1369
|
interruptKeys = ["escape"];
|
|
@@ -1381,24 +1378,24 @@ class io extends O {
|
|
|
1381
1378
|
* @param next
|
|
1382
1379
|
*/
|
|
1383
1380
|
selectPointStart(e) {
|
|
1384
|
-
let t = null, n = this.renderer.createCircle(M.zero(), { color: 16711935 }),
|
|
1381
|
+
let t = null, n = this.renderer.createCircle(M.zero(), { color: 16711935 }), s = null;
|
|
1385
1382
|
this.addEventRecord("selectPointStart").add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
1386
|
-
const { point:
|
|
1387
|
-
this.dispatchEvent({ type: "pointerMove", point:
|
|
1383
|
+
const { point: o, line: a, find: l } = this.editor.renderManager.adsorption();
|
|
1384
|
+
this.dispatchEvent({ type: "pointerMove", point: o }), l ? (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());
|
|
1388
1385
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
1389
|
-
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), e({ point: t, line:
|
|
1386
|
+
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), e({ point: t, line: s }));
|
|
1390
1387
|
})), this.addEventRecord("clear").add(() => n.removeFromParent());
|
|
1391
1388
|
}
|
|
1392
1389
|
/** 选择结束点
|
|
1393
1390
|
* @param next
|
|
1394
1391
|
*/
|
|
1395
1392
|
selectPointEnd(e, { point: t, line: n }) {
|
|
1396
|
-
let
|
|
1397
|
-
this.addEventRecord("clear").add(() =>
|
|
1393
|
+
let s = null, o = this.renderer.createCircle(M.zero(), { color: 16711935 });
|
|
1394
|
+
this.addEventRecord("clear").add(() => o.removeFromParent()).add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
1398
1395
|
const { point: a, find: l, line: r } = this.editor.renderManager.adsorption();
|
|
1399
|
-
this.dispatchEvent({ type: "pointerMove", point: a }), l && r === n ? (this.domElement.style.cursor = "none",
|
|
1396
|
+
this.dispatchEvent({ type: "pointerMove", point: a }), l && r === 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());
|
|
1400
1397
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
1401
|
-
this.eventInput.isKeyDown("mouse_0") &&
|
|
1398
|
+
this.eventInput.isKeyDown("mouse_0") && s && e({ line: n, start: t, end: s });
|
|
1402
1399
|
}));
|
|
1403
1400
|
}
|
|
1404
1401
|
/**
|
|
@@ -1406,13 +1403,13 @@ class io extends O {
|
|
|
1406
1403
|
* @param next
|
|
1407
1404
|
* @param points
|
|
1408
1405
|
*/
|
|
1409
|
-
end(e, { start: t, end: n, line:
|
|
1410
|
-
const
|
|
1406
|
+
end(e, { start: t, end: n, line: s }) {
|
|
1407
|
+
const o = new N(M.from(t), M.from(n)), a = o.center, l = o.length(), r = {
|
|
1411
1408
|
p: new u.Vector3(a.x, a.y, 0),
|
|
1412
1409
|
width: l,
|
|
1413
|
-
full: Math.abs(l -
|
|
1410
|
+
full: Math.abs(l - s.length()) < 0.01
|
|
1414
1411
|
};
|
|
1415
|
-
e({ line:
|
|
1412
|
+
e({ line: s, doorDataItem: r });
|
|
1416
1413
|
}
|
|
1417
1414
|
/** 执行完成
|
|
1418
1415
|
*/
|
|
@@ -1425,8 +1422,8 @@ class io extends O {
|
|
|
1425
1422
|
rollback(e) {
|
|
1426
1423
|
const { doorDataItem: t, line: n } = e;
|
|
1427
1424
|
if (n.userData.drawWindow) {
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1425
|
+
const s = n.userData.drawWindow.indexOf(t);
|
|
1426
|
+
s !== -1 && (n.userData.drawWindow.splice(s, 1), n.userData.drawWindow.length === 0 && (delete n.userData.drawWindow, delete n.userData.isWindow), this.renderManager.draw());
|
|
1430
1427
|
}
|
|
1431
1428
|
return e;
|
|
1432
1429
|
}
|
|
@@ -1474,19 +1471,19 @@ class le extends O {
|
|
|
1474
1471
|
* @param id
|
|
1475
1472
|
* @returns
|
|
1476
1473
|
*/
|
|
1477
|
-
setLinePoint(e, t, n,
|
|
1474
|
+
setLinePoint(e, t, n, s = "all", o = [], a = At()) {
|
|
1478
1475
|
if (e.userData.setLinePointUUid === a) return [];
|
|
1479
1476
|
e.userData.setLinePointUUid = a;
|
|
1480
1477
|
let l = [], r = [];
|
|
1481
|
-
(
|
|
1478
|
+
(s === "start" || s === "all") && (l = this.renderManager.pointVirtualGrid.queryPoint(e.start).filter((y) => y.userData !== e)), (s === "end" || s === "all") && (r = this.renderManager.pointVirtualGrid.queryPoint(e.end).filter((y) => y.userData !== e));
|
|
1482
1479
|
const i = e.clone();
|
|
1483
1480
|
let c = "";
|
|
1484
|
-
t && (e.start.equal(t) || (c = "start"),
|
|
1481
|
+
t && (e.start.equal(t) || (c = "start"), o.push({
|
|
1485
1482
|
point: e.start,
|
|
1486
1483
|
oldPoint: e.start.clone(),
|
|
1487
1484
|
newPoint: t,
|
|
1488
1485
|
line: e
|
|
1489
|
-
}), e.start.copy(t)), n && (e.end.equal(n) || (c = c === "start" ? "all" : "end"),
|
|
1486
|
+
}), e.start.copy(t)), n && (e.end.equal(n) || (c = c === "start" ? "all" : "end"), o.push({
|
|
1490
1487
|
point: e.end,
|
|
1491
1488
|
oldPoint: e.end.clone(),
|
|
1492
1489
|
newPoint: n,
|
|
@@ -1498,17 +1495,17 @@ class le extends O {
|
|
|
1498
1495
|
if (x.directionEqual(i))
|
|
1499
1496
|
if (I === "start") {
|
|
1500
1497
|
const K = e.projectPoint(x.end, !1);
|
|
1501
|
-
if (K) return this.setLinePoint(x, f, K, "end",
|
|
1498
|
+
if (K) return this.setLinePoint(x, f, K, "end", o, a);
|
|
1502
1499
|
} else {
|
|
1503
1500
|
const K = e.projectPoint(x.start, !1);
|
|
1504
|
-
if (K) return this.setLinePoint(x, K, f, "start",
|
|
1501
|
+
if (K) return this.setLinePoint(x, K, f, "start", o, a);
|
|
1505
1502
|
}
|
|
1506
1503
|
(c === "all" || g === c) && this.setLinePoint(
|
|
1507
1504
|
x,
|
|
1508
1505
|
x.start === E ? f : x.start,
|
|
1509
1506
|
x.end === E ? f : x.end,
|
|
1510
1507
|
x.start === E ? "end" : "start",
|
|
1511
|
-
|
|
1508
|
+
o,
|
|
1512
1509
|
a
|
|
1513
1510
|
);
|
|
1514
1511
|
});
|
|
@@ -1527,16 +1524,16 @@ class le extends O {
|
|
|
1527
1524
|
*/
|
|
1528
1525
|
correction(e, t = [], n = /* @__PURE__ */ new Set()) {
|
|
1529
1526
|
n.add(e);
|
|
1530
|
-
const
|
|
1527
|
+
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, l] = s.reduce((i, c) => {
|
|
1531
1528
|
const [m, y] = i;
|
|
1532
1529
|
return c.sameEndpoint(e) ? m.push(c) : y.push(c), i;
|
|
1533
1530
|
}, [[], []]);
|
|
1534
1531
|
a.forEach((i) => {
|
|
1535
|
-
const c = i.direction(), m =
|
|
1532
|
+
const c = i.direction(), m = o.angleBetween(c, "angle");
|
|
1536
1533
|
if (Math.abs(90 - m) > 45) return !1;
|
|
1537
1534
|
const f = e.sameEndpointAsStart(i) ? e.start : e.end, g = i.sameEndpointAsStart(e) ? i.end : i.start, h = new N(
|
|
1538
|
-
g.clone().add(
|
|
1539
|
-
g.clone().add(
|
|
1535
|
+
g.clone().add(o.clone().multiplyScalar(1)),
|
|
1536
|
+
g.clone().add(o.clone().multiplyScalar(-1))
|
|
1540
1537
|
), E = h.projectPoint(f, !1);
|
|
1541
1538
|
if (E) {
|
|
1542
1539
|
const x = [];
|
|
@@ -1549,14 +1546,14 @@ class le extends O {
|
|
|
1549
1546
|
), t.push(x);
|
|
1550
1547
|
}
|
|
1551
1548
|
return n.add(i), !1;
|
|
1552
|
-
}),
|
|
1549
|
+
}), o.copy(e.direction());
|
|
1553
1550
|
const r = (i, c, m) => {
|
|
1554
1551
|
const y = e.projectPoint(c);
|
|
1555
1552
|
if (y) i.copy(y);
|
|
1556
1553
|
else {
|
|
1557
1554
|
const f = new N(
|
|
1558
|
-
c.clone().add(
|
|
1559
|
-
c.clone().add(
|
|
1555
|
+
c.clone().add(o.clone().multiplyScalar(1)),
|
|
1556
|
+
c.clone().add(o.clone().multiplyScalar(-1))
|
|
1560
1557
|
), g = f.projectPoint(i, !1);
|
|
1561
1558
|
if (g) {
|
|
1562
1559
|
const h = [];
|
|
@@ -1579,16 +1576,16 @@ class le extends O {
|
|
|
1579
1576
|
const c = e.getIntersection(i);
|
|
1580
1577
|
if (c) {
|
|
1581
1578
|
const m = new N(
|
|
1582
|
-
i.start.clone().add(
|
|
1583
|
-
i.start.clone().add(
|
|
1579
|
+
i.start.clone().add(o.clone().multiplyScalar(1)),
|
|
1580
|
+
i.start.clone().add(o.clone().multiplyScalar(-1))
|
|
1584
1581
|
), y = m.projectPoint(c, !1);
|
|
1585
1582
|
if (y) {
|
|
1586
1583
|
const h = [];
|
|
1587
1584
|
this.setLinePoint(i, y, i.end, "start", h), t.push(h);
|
|
1588
1585
|
}
|
|
1589
1586
|
const f = new N(
|
|
1590
|
-
i.end.clone().add(
|
|
1591
|
-
i.end.clone().add(
|
|
1587
|
+
i.end.clone().add(o.clone().multiplyScalar(1)),
|
|
1588
|
+
i.end.clone().add(o.clone().multiplyScalar(-1))
|
|
1592
1589
|
), g = f.projectPoint(c, !1);
|
|
1593
1590
|
if (g) {
|
|
1594
1591
|
const h = [];
|
|
@@ -1604,7 +1601,7 @@ class le extends O {
|
|
|
1604
1601
|
*/
|
|
1605
1602
|
axisAlignmentCorrection(e) {
|
|
1606
1603
|
const t = [...this.renderManager.lines];
|
|
1607
|
-
return { newLines:
|
|
1604
|
+
return { newLines: St.correction(t, e, { groupMethod: "cross", fittingMethod: "max", crossAxistThreshold: 0.08 }), oldLines: t };
|
|
1608
1605
|
}
|
|
1609
1606
|
/** 开始
|
|
1610
1607
|
* @param next
|
|
@@ -1620,9 +1617,9 @@ class le extends O {
|
|
|
1620
1617
|
if (Array.isArray(e)) {
|
|
1621
1618
|
const t = [];
|
|
1622
1619
|
e.forEach((n) => {
|
|
1623
|
-
n.forEach((
|
|
1624
|
-
const { line:
|
|
1625
|
-
l.copy(a), this.renderManager.removeLine(
|
|
1620
|
+
n.forEach((s) => {
|
|
1621
|
+
const { line: o, newPoint: a, point: l } = s;
|
|
1622
|
+
l.copy(a), this.renderManager.removeLine(o), this.renderManager.addLine(o), o.userData.isWindow && t.push(o);
|
|
1626
1623
|
});
|
|
1627
1624
|
}), Ke(...t);
|
|
1628
1625
|
} else
|
|
@@ -1636,9 +1633,9 @@ class le extends O {
|
|
|
1636
1633
|
if (Array.isArray(e)) {
|
|
1637
1634
|
const t = [];
|
|
1638
1635
|
for (let n = e.length - 1; n >= 0; n--) {
|
|
1639
|
-
const
|
|
1640
|
-
for (let
|
|
1641
|
-
const a = o
|
|
1636
|
+
const s = e[n];
|
|
1637
|
+
for (let o = s.length - 1; o >= 0; o--) {
|
|
1638
|
+
const a = s[o], { line: l, oldPoint: r, point: i } = a;
|
|
1642
1639
|
i.copy(r), this.renderManager.removeLine(l), this.renderManager.addLine(l), l.userData.isWindow && t.push(l);
|
|
1643
1640
|
}
|
|
1644
1641
|
}
|
|
@@ -1677,9 +1674,9 @@ class $ extends O {
|
|
|
1677
1674
|
* @todo 合并所有
|
|
1678
1675
|
*/
|
|
1679
1676
|
mergeLines(e, t) {
|
|
1680
|
-
t = t.filter((
|
|
1681
|
-
const { newLines: n, deleteLines:
|
|
1682
|
-
n.length ? (e({ newLines: n, deleteLines:
|
|
1677
|
+
t = t.filter((o) => !o.userData.isDoor);
|
|
1678
|
+
const { newLines: n, deleteLines: s } = N.autoMergeLines(t);
|
|
1679
|
+
n.length ? (e({ newLines: n, deleteLines: s }), k({ message: "已合并", type: "success" })) : (k({ message: "合并失败,未找到共用点", type: "warning" }), this.commandManager.cancel());
|
|
1683
1680
|
}
|
|
1684
1681
|
/** 执行完成
|
|
1685
1682
|
* @param data
|
|
@@ -1758,14 +1755,14 @@ class te extends O {
|
|
|
1758
1755
|
* @param next
|
|
1759
1756
|
*/
|
|
1760
1757
|
connection(e, t) {
|
|
1761
|
-
let n,
|
|
1758
|
+
let n, s, o = 1 / 0;
|
|
1762
1759
|
for (let a = 0; a < 2; a++)
|
|
1763
1760
|
for (let l = 0; l < 2; l++) {
|
|
1764
1761
|
const r = t[0].points[a], i = t[1].points[l], c = r.distance(i);
|
|
1765
|
-
c <
|
|
1762
|
+
c < o && (n = r, s = i, o = c);
|
|
1766
1763
|
}
|
|
1767
|
-
if (n &&
|
|
1768
|
-
const a = new N(n.clone(),
|
|
1764
|
+
if (n && s) {
|
|
1765
|
+
const a = new N(n.clone(), s.clone());
|
|
1769
1766
|
e(a), k({ message: "连接成功", type: "success" });
|
|
1770
1767
|
} else this.cancel();
|
|
1771
1768
|
}
|
|
@@ -1811,26 +1808,26 @@ class ne extends O {
|
|
|
1811
1808
|
* @param next
|
|
1812
1809
|
*/
|
|
1813
1810
|
connection(e, t) {
|
|
1814
|
-
const n = t[0],
|
|
1815
|
-
if (!
|
|
1816
|
-
const a = n.points.map((c) => c.clone()), l =
|
|
1817
|
-
n.start.distance(
|
|
1818
|
-
const r = n.points.map((c) => c.clone()), i =
|
|
1819
|
-
e({ line1: n, line2:
|
|
1811
|
+
const n = t[0], s = t[1], o = t[0].getIntersection(t[1]);
|
|
1812
|
+
if (!o) return;
|
|
1813
|
+
const a = n.points.map((c) => c.clone()), l = s.points.map((c) => c.clone());
|
|
1814
|
+
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);
|
|
1815
|
+
const r = n.points.map((c) => c.clone()), i = s.points.map((c) => c.clone());
|
|
1816
|
+
e({ line1: n, line2: s, oldLine1: a, oldLine2: l, newLine1: r, newLine2: i }), k({ message: "连接成功", type: "success" });
|
|
1820
1817
|
}
|
|
1821
1818
|
/** 执行完成
|
|
1822
1819
|
* @param next
|
|
1823
1820
|
* @param selectLines
|
|
1824
1821
|
*/
|
|
1825
|
-
completed({ line1: e, line2: t, newLine1: n, newLine2:
|
|
1826
|
-
this.renderManager.removeLine(e), this.renderManager.removeLine(t), e.set(...n), t.set(...
|
|
1822
|
+
completed({ line1: e, line2: t, newLine1: n, newLine2: s }) {
|
|
1823
|
+
this.renderManager.removeLine(e), this.renderManager.removeLine(t), e.set(...n), t.set(...s), this.renderManager.addLines([e, t]), this.renderManager.draw();
|
|
1827
1824
|
}
|
|
1828
1825
|
/** 回滚操作
|
|
1829
1826
|
* @param data
|
|
1830
1827
|
*/
|
|
1831
1828
|
rollback(e) {
|
|
1832
|
-
const { line1: t, line2: n, oldLine1:
|
|
1833
|
-
return this.renderManager.removeLine(t), this.renderManager.removeLine(n), t.set(...
|
|
1829
|
+
const { line1: t, line2: n, oldLine1: s, oldLine2: o } = e;
|
|
1830
|
+
return this.renderManager.removeLine(t), this.renderManager.removeLine(n), t.set(...s), n.set(...o), this.renderManager.addLines([t, n]), this.renderManager.draw(), e;
|
|
1834
1831
|
}
|
|
1835
1832
|
/** 撤回回滚
|
|
1836
1833
|
* @param lines
|
|
@@ -1840,15 +1837,15 @@ class ne extends O {
|
|
|
1840
1837
|
return this.completed(e), e;
|
|
1841
1838
|
}
|
|
1842
1839
|
}
|
|
1843
|
-
class
|
|
1840
|
+
class se extends O {
|
|
1844
1841
|
static name = "DeleteSelectWindow";
|
|
1845
1842
|
shortcutKeys = ["Q", "Delete"];
|
|
1846
1843
|
static commandName = "deleteSelectWindow";
|
|
1847
1844
|
onAddFromParent(e) {
|
|
1848
1845
|
super.onAddFromParent(e);
|
|
1849
|
-
const t = this.commandManager.addCommandFlow(
|
|
1850
|
-
t.addEventListener("finally", this.createFinally()), t.addEventListener("completed", (n) => this.completed(n.data)), this.eventInput.addKeyCombination(
|
|
1851
|
-
this.eventInput.isKeyCombination(
|
|
1846
|
+
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));
|
|
1847
|
+
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 () => {
|
|
1848
|
+
this.eventInput.isKeyCombination(se.commandName) && await this.commandManager.start(se.commandName, [...this.default.selectLines]);
|
|
1852
1849
|
}), this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
|
|
1853
1850
|
}
|
|
1854
1851
|
/**
|
|
@@ -1861,13 +1858,13 @@ class oe extends O {
|
|
|
1861
1858
|
* @param next
|
|
1862
1859
|
*/
|
|
1863
1860
|
end(e, t) {
|
|
1864
|
-
let n = !1,
|
|
1865
|
-
t.forEach((
|
|
1866
|
-
|
|
1867
|
-
line:
|
|
1868
|
-
drawDoorData:
|
|
1861
|
+
let n = !1, s = [];
|
|
1862
|
+
t.forEach((o) => {
|
|
1863
|
+
o.userData.isWindow && (s.push({
|
|
1864
|
+
line: o,
|
|
1865
|
+
drawDoorData: o.userData.drawDoorData
|
|
1869
1866
|
}), n = !0);
|
|
1870
|
-
}), n && k({ message: "删除窗户成功", type: "success" }), e(
|
|
1867
|
+
}), n && k({ message: "删除窗户成功", type: "success" }), e(s);
|
|
1871
1868
|
}
|
|
1872
1869
|
/**
|
|
1873
1870
|
* 完成
|
|
@@ -1897,16 +1894,16 @@ class oe extends O {
|
|
|
1897
1894
|
return this.completed(e), e;
|
|
1898
1895
|
}
|
|
1899
1896
|
}
|
|
1900
|
-
class
|
|
1897
|
+
class oe extends O {
|
|
1901
1898
|
static name = "SelectAll";
|
|
1902
1899
|
container = new u.Group();
|
|
1903
1900
|
shortcutKeys = ["control", "a"];
|
|
1904
1901
|
static commandName = "selectAll";
|
|
1905
1902
|
onAddFromParent(e) {
|
|
1906
1903
|
super.onAddFromParent(e), this.editor.container.add(this.container), this.container.position.z = 1e-3;
|
|
1907
|
-
const t = this.commandManager.addCommandFlow(
|
|
1908
|
-
t.writeOperationList = !1, t.addEventListener("finally", this.createFinally()), t.addEventListener("completed", (n) => this.completed(n.data)), this.eventInput.addKeyCombination(
|
|
1909
|
-
this.eventInput.isKeyCombination(
|
|
1904
|
+
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));
|
|
1905
|
+
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 () => {
|
|
1906
|
+
this.eventInput.isKeyCombination(oe.commandName) && await this.commandManager.start(oe.commandName);
|
|
1910
1907
|
}), this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
|
|
1911
1908
|
}
|
|
1912
1909
|
/** 开始
|
|
@@ -1957,19 +1954,19 @@ class ae extends O {
|
|
|
1957
1954
|
* @param selectLines
|
|
1958
1955
|
*/
|
|
1959
1956
|
viewAngle(e, t) {
|
|
1960
|
-
const [n,
|
|
1957
|
+
const [n, s] = t, o = Math.min(n.length() * 0.8, s.length() * 0.8);
|
|
1961
1958
|
let a, l, r, i = 0, c = 0;
|
|
1962
|
-
n.sameEndpointAsStart(
|
|
1963
|
-
function m(
|
|
1964
|
-
const b = L.x -
|
|
1965
|
-
let W = Math.atan2(
|
|
1959
|
+
n.sameEndpointAsStart(s) ? (a = n.start, l = n.end) : (a = n.end, l = n.start), s.sameEndpointAsStart(n) ? r = s.end : r = s.start;
|
|
1960
|
+
function m(S, L) {
|
|
1961
|
+
const b = L.x - S.x, F = L.y - S.y;
|
|
1962
|
+
let W = Math.atan2(F, b) * (180 / Math.PI);
|
|
1966
1963
|
return W < 0 && (W += 360), W;
|
|
1967
1964
|
}
|
|
1968
1965
|
const y = m(a, l), f = m(a, r), g = Math.min(y, f), h = Math.max(y, f), E = [];
|
|
1969
|
-
function x(
|
|
1970
|
-
for (let b =
|
|
1971
|
-
const
|
|
1972
|
-
E.push(
|
|
1966
|
+
function x(S, L) {
|
|
1967
|
+
for (let b = S; b <= L; b++) {
|
|
1968
|
+
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;
|
|
1969
|
+
E.push(F, W, 0, he, Ce, 0);
|
|
1973
1970
|
}
|
|
1974
1971
|
}
|
|
1975
1972
|
h - g > 180 ? (x(0, g), x(h, 360), i = 360 - (h - g), c = (h + i / 2) % 360) : (x(g, h), i = h - g, c = g + i / 2);
|
|
@@ -1977,7 +1974,7 @@ class ae extends O {
|
|
|
1977
1974
|
I.geometry = this.renderManager.createGeometry({
|
|
1978
1975
|
position: E
|
|
1979
1976
|
}, E.length / 3), I.material = new u.LineBasicMaterial({ color: 16711935 }), this.renderManager.container.add(I);
|
|
1980
|
-
const K = Math.cos(c * Math.PI / 180) *
|
|
1977
|
+
const K = Math.cos(c * Math.PI / 180) * o + a.x, Y = Math.sin(c * Math.PI / 180) * o + a.y, Z = this.renderer.createText(Number(i.toFixed(2)), new u.Vector3(K, Y, 0), {
|
|
1981
1978
|
textShadow: "0px 0px 2px #000"
|
|
1982
1979
|
}, this.renderManager.container);
|
|
1983
1980
|
let G = 0;
|
|
@@ -2001,24 +1998,24 @@ class dt extends O {
|
|
|
2001
1998
|
* @param next
|
|
2002
1999
|
*/
|
|
2003
2000
|
selectPointStart(e) {
|
|
2004
|
-
let t = null, n = this.renderer.createCircle(M.zero(), { color: 16711935 }),
|
|
2001
|
+
let t = null, n = this.renderer.createCircle(M.zero(), { color: 16711935 }), s = null;
|
|
2005
2002
|
this.addEventRecord("selectPointStart").add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
2006
|
-
const { point:
|
|
2007
|
-
this.dispatchEvent({ type: "pointerMove", point:
|
|
2003
|
+
const { point: o, line: a, find: l } = this.editor.renderManager.adsorption();
|
|
2004
|
+
this.dispatchEvent({ type: "pointerMove", point: o }), l ? (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());
|
|
2008
2005
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
2009
|
-
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), e({ point: t, line:
|
|
2006
|
+
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), e({ point: t, line: s }));
|
|
2010
2007
|
})), this.addEventRecord("clear").add(() => n.removeFromParent());
|
|
2011
2008
|
}
|
|
2012
2009
|
/** 选择结束点
|
|
2013
2010
|
* @param next
|
|
2014
2011
|
*/
|
|
2015
2012
|
selectPointEnd(e, { point: t, line: n }) {
|
|
2016
|
-
let
|
|
2017
|
-
this.addEventRecord("clear").add(() =>
|
|
2013
|
+
let s = null, o = this.renderer.createCircle(M.zero(), { color: 16711935 });
|
|
2014
|
+
this.addEventRecord("clear").add(() => o.removeFromParent()).add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
2018
2015
|
const { point: a, find: l, line: r } = this.editor.renderManager.adsorption();
|
|
2019
|
-
this.dispatchEvent({ type: "pointerMove", point: a }), l && r === n ? (this.domElement.style.cursor = "none",
|
|
2016
|
+
this.dispatchEvent({ type: "pointerMove", point: a }), l && r === 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());
|
|
2020
2017
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
2021
|
-
this.eventInput.isKeyDown("mouse_0") &&
|
|
2018
|
+
this.eventInput.isKeyDown("mouse_0") && s && e({ line: n, start: t, end: s });
|
|
2022
2019
|
}));
|
|
2023
2020
|
}
|
|
2024
2021
|
/**
|
|
@@ -2026,17 +2023,17 @@ class dt extends O {
|
|
|
2026
2023
|
* @param next
|
|
2027
2024
|
* @param points
|
|
2028
2025
|
*/
|
|
2029
|
-
end(e, { start: t, end: n, line:
|
|
2030
|
-
const
|
|
2026
|
+
end(e, { start: t, end: n, line: s }) {
|
|
2027
|
+
const o = M.from(t), a = M.from(n);
|
|
2031
2028
|
e({
|
|
2032
|
-
oldLine:
|
|
2029
|
+
oldLine: s,
|
|
2033
2030
|
newLine1: new N(
|
|
2034
|
-
|
|
2035
|
-
|
|
2031
|
+
s.start,
|
|
2032
|
+
s.start.distance(o) < s.start.distance(a) ? o.clone() : a.clone()
|
|
2036
2033
|
),
|
|
2037
2034
|
newLine2: new N(
|
|
2038
|
-
|
|
2039
|
-
|
|
2035
|
+
s.end,
|
|
2036
|
+
s.end.distance(o) < s.end.distance(a) ? o.clone() : a.clone()
|
|
2040
2037
|
)
|
|
2041
2038
|
});
|
|
2042
2039
|
}
|
|
@@ -2087,22 +2084,22 @@ class ie extends O {
|
|
|
2087
2084
|
}), t[0].userData.isVerticalReferenceLine = !0, e(), this.renderManager.draw();
|
|
2088
2085
|
}
|
|
2089
2086
|
}
|
|
2090
|
-
const
|
|
2087
|
+
const rs = {
|
|
2091
2088
|
key: 0,
|
|
2092
2089
|
class: "mt-[5px] text-[#ccc] text-[11px] absolute left-[10px] bottom-[10px] rounded-[8px] min-w-[150px] bg-black/15 p-[10px]"
|
|
2093
|
-
},
|
|
2090
|
+
}, ds = { class: "text-start max-w-[150px]" }, ls = { class: "inline-block ml-[10px] text-[var(--color-primary)]" }, cs = {
|
|
2094
2091
|
key: 0,
|
|
2095
2092
|
class: "p-[5px] max-w-[200px]"
|
|
2096
|
-
},
|
|
2093
|
+
}, ms = { class: "text-[14px] flex flex-col" }, hs = ["onClick"], us = { class: "flex flex-row items-center" }, ps = { class: "flex justify-center items-center size-[20px] bg-[#f0f0f0] rounded-[2px] mr-[10px]" }, gs = ["src"], vs = { class: "text-wrap" }, fs = {
|
|
2097
2094
|
key: 1,
|
|
2098
2095
|
class: "text-[#999]"
|
|
2099
|
-
},
|
|
2096
|
+
}, ys = {
|
|
2100
2097
|
style: { "--el-color-primary": "var(--primary-color)" },
|
|
2101
|
-
class: "flex flex-row items-center justify-between gap-[
|
|
2102
|
-
},
|
|
2098
|
+
class: "flex flex-row items-center justify-between gap-[5px] mt-[10px] text-[10px]"
|
|
2099
|
+
}, ws = {
|
|
2103
2100
|
key: 0,
|
|
2104
2101
|
class: "flex flex-row items-center flex-wrap justify-between gap-[10px] mt-[10px] text-[10px]"
|
|
2105
|
-
},
|
|
2102
|
+
}, bs = { class: "flex-wrap border-t-1 border-t-[#eee] mt-[5px] pt-[5px] flex items-center gap-[10px]" }, xs = ["onClick", "title"], Cs = ["src"], Es = /* @__PURE__ */ me({
|
|
2106
2103
|
__name: "EditorTool",
|
|
2107
2104
|
props: {
|
|
2108
2105
|
dxfSystem: {},
|
|
@@ -2111,7 +2108,7 @@ const ro = {
|
|
|
2111
2108
|
setup(d) {
|
|
2112
2109
|
function e(C, p, w = m.value.getBoundingClientRect(), U = y.value.getBoundingClientRect()) {
|
|
2113
2110
|
const ue = w.width - U.width, pe = 0, Me = w.height - U.height;
|
|
2114
|
-
C = Math.max(0, Math.min(C, ue)), p = Math.max(pe, Math.min(p, Me)),
|
|
2111
|
+
C = Math.max(0, Math.min(C, ue)), p = Math.max(pe, Math.min(p, Me)), S.value = { left: C, top: p };
|
|
2115
2112
|
}
|
|
2116
2113
|
function t(C) {
|
|
2117
2114
|
g.value !== C.command && (g.value !== "default" && x.commandManager.cancel(), setTimeout(() => x.commandManager.start(C.command)));
|
|
@@ -2126,11 +2123,11 @@ const ro = {
|
|
|
2126
2123
|
}
|
|
2127
2124
|
}
|
|
2128
2125
|
}
|
|
2129
|
-
async function
|
|
2126
|
+
async function s() {
|
|
2130
2127
|
const C = await Dt.json();
|
|
2131
2128
|
Array.isArray(C) && (localStorage.removeItem("orbitControls"), n(C));
|
|
2132
2129
|
}
|
|
2133
|
-
function
|
|
2130
|
+
function o({ offsetX: C, offsetY: p }) {
|
|
2134
2131
|
E.mouseMoveEventProxylock = !0;
|
|
2135
2132
|
const w = document.body.style.cursor;
|
|
2136
2133
|
document.body.style.cursor = "move";
|
|
@@ -2147,7 +2144,7 @@ const ro = {
|
|
|
2147
2144
|
};
|
|
2148
2145
|
document.body.addEventListener("mousemove", U), document.addEventListener("mouseup", Ee);
|
|
2149
2146
|
}
|
|
2150
|
-
const a = d, l =
|
|
2147
|
+
const a = d, l = _(!0), r = _(!0), i = _(!0), c = _(!1), m = _(), y = _(), f = _(!0), g = _(""), h = Ft(a.dxfSystem), E = h.findComponentByType(Pt), x = h.findComponentByType(lt), I = h.findComponentByType(rt), K = h.findComponentByType(_t), Y = h.findComponentByType(Nt), Z = _(0), G = _(0), S = _({ left: 10, top: 100 }), L = /* @__PURE__ */ Object.assign({ "./assets/images/angle.svg": Mn, "./assets/images/connection.svg": kn, "./assets/images/cutLine.svg": Pn, "./assets/images/deleteSelectLine.svg": An, "./assets/images/deleteSelectWindow.svg": _n, "./assets/images/door.svg": Bn, "./assets/images/intersectionConnection.svg": On, "./assets/images/line.svg": zn, "./assets/images/mergeLine.svg": Tn, "./assets/images/revokeRollback.svg": jn, "./assets/images/rollback.svg": Qn, "./assets/images/selectAll.svg": Wn, "./assets/images/selectPoint.svg": Un, "./assets/images/verticalCorrection.svg": Zn, "./assets/images/verticalLine.svg": Xn, "./assets/images/window.svg": es }), b = _(!1), F = _(0), W = _(!1), he = new ResizeObserver(() => e(S.value.left, S.value.top)), Ce = [
|
|
2151
2148
|
{ name: "开启绘制线段命令", shortcut: "Ctrl + L" },
|
|
2152
2149
|
{ name: "开启绘制门线命令", shortcut: "Ctrl + M" },
|
|
2153
2150
|
{ name: "开启绘制窗户线命令", shortcut: "Ctrl + Q" },
|
|
@@ -2235,27 +2232,27 @@ const ro = {
|
|
|
2235
2232
|
command: $.commandName,
|
|
2236
2233
|
name: "合并",
|
|
2237
2234
|
src: L["./assets/images/mergeLine.svg"].default,
|
|
2238
|
-
show: A(() =>
|
|
2235
|
+
show: A(() => F.value === 2),
|
|
2239
2236
|
shortcut: "Ctrl + G"
|
|
2240
2237
|
},
|
|
2241
2238
|
{
|
|
2242
2239
|
command: te.commandName,
|
|
2243
2240
|
name: "两点连接",
|
|
2244
|
-
show: A(() =>
|
|
2241
|
+
show: A(() => F.value === 2),
|
|
2245
2242
|
src: L["./assets/images/connection.svg"].default,
|
|
2246
2243
|
shortcut: "Shift + L"
|
|
2247
2244
|
},
|
|
2248
2245
|
{
|
|
2249
2246
|
command: ne.commandName,
|
|
2250
2247
|
name: "延长线交点连接",
|
|
2251
|
-
show: A(() =>
|
|
2248
|
+
show: A(() => F.value === 2),
|
|
2252
2249
|
src: L["./assets/images/intersectionConnection.svg"].default,
|
|
2253
2250
|
shortcut: "Ctrl + Shift + L"
|
|
2254
2251
|
},
|
|
2255
2252
|
{
|
|
2256
2253
|
command: le.commandName,
|
|
2257
2254
|
name: "线段垂直纠正",
|
|
2258
|
-
show: A(() =>
|
|
2255
|
+
show: A(() => F.value === 1),
|
|
2259
2256
|
src: L["./assets/images/verticalCorrection.svg"].default,
|
|
2260
2257
|
shortcut: `
|
|
2261
2258
|
Ctrl + C 垂直纠正
|
|
@@ -2266,7 +2263,7 @@ const ro = {
|
|
|
2266
2263
|
command: ie.commandName,
|
|
2267
2264
|
name: "y轴垂直基准线",
|
|
2268
2265
|
show: A(
|
|
2269
|
-
() =>
|
|
2266
|
+
() => F.value === 1 && !I.selectLines[0].userData.isDoor
|
|
2270
2267
|
),
|
|
2271
2268
|
src: L["./assets/images/verticalLine.svg"].default,
|
|
2272
2269
|
shortcut: "V"
|
|
@@ -2274,19 +2271,19 @@ const ro = {
|
|
|
2274
2271
|
{
|
|
2275
2272
|
command: ae.commandName,
|
|
2276
2273
|
name: "角度显示",
|
|
2277
|
-
show: A(() =>
|
|
2274
|
+
show: A(() => F.value === 2 && I.selectLines[0].sameEndpoint(I.selectLines[1])),
|
|
2278
2275
|
src: L["./assets/images/angle.svg"].default,
|
|
2279
2276
|
shortcut: "r"
|
|
2280
2277
|
},
|
|
2281
2278
|
{
|
|
2282
|
-
command:
|
|
2279
|
+
command: oe.commandName,
|
|
2283
2280
|
name: "全选",
|
|
2284
|
-
show: A(() =>
|
|
2281
|
+
show: A(() => F.value !== x.renderManager.lines.length),
|
|
2285
2282
|
src: L["./assets/images/selectAll.svg"].default,
|
|
2286
2283
|
shortcut: "Ctrl + A"
|
|
2287
2284
|
},
|
|
2288
2285
|
{
|
|
2289
|
-
command:
|
|
2286
|
+
command: se.commandName,
|
|
2290
2287
|
name: "清除窗户",
|
|
2291
2288
|
show: A(() => W.value),
|
|
2292
2289
|
src: L["./assets/images/deleteSelectWindow.svg"].default,
|
|
@@ -2295,14 +2292,16 @@ const ro = {
|
|
|
2295
2292
|
{
|
|
2296
2293
|
command: ee.commandName,
|
|
2297
2294
|
name: "删除",
|
|
2298
|
-
show: A(() =>
|
|
2295
|
+
show: A(() => F.value > 0),
|
|
2299
2296
|
src: L["./assets/images/deleteSelectLine.svg"].default,
|
|
2300
2297
|
shortcut: "Delete"
|
|
2301
2298
|
}
|
|
2302
2299
|
];
|
|
2303
|
-
J(
|
|
2304
|
-
localStorage.setItem("toolBarExpand", f.value + ""), f.value && we(() => e(
|
|
2305
|
-
}), J(l, () => h.Variable.set("originalLineVisible", l.value)), J(r, () =>
|
|
2300
|
+
J(S, () => localStorage.setItem("editorToolPosition", JSON.stringify(S.value))), J(b, () => localStorage.setItem("showShortcutKey", b.value + "")), J(f, () => {
|
|
2301
|
+
localStorage.setItem("toolBarExpand", f.value + ""), f.value && we(() => e(S.value.left, S.value.top));
|
|
2302
|
+
}), J(l, () => h.Variable.set("originalLineVisible", l.value)), J(r, () => {
|
|
2303
|
+
localStorage.setItem("dxfVisible", r.value + ""), h.Variable.set("dxfVisible", r.value);
|
|
2304
|
+
}), J(i, () => h.Variable.set("whiteModelVisible", i.value)), h.Variable.addEventListener("isLook", (C) => c.value = C.value), h.Variable.addEventListener("originalLineVisible", (C) => l.value = C.value), h.Variable.addEventListener("dxfVisible", (C) => r.value = C.value), h.Variable.addEventListener("whiteModelVisible", (C) => i.value = C.value);
|
|
2306
2305
|
const ht = x.commandManager.addEventListener("started", (C) => {
|
|
2307
2306
|
g.value = C.name;
|
|
2308
2307
|
});
|
|
@@ -2314,30 +2313,30 @@ const ro = {
|
|
|
2314
2313
|
} else
|
|
2315
2314
|
we(() => he.observe(m.value));
|
|
2316
2315
|
}, 100), I.addEventListener("selectLineChange", () => {
|
|
2317
|
-
|
|
2316
|
+
F.value = I.selectLines.length, W.value = I.selectLines.some((C) => C.userData.isWindow);
|
|
2318
2317
|
}), ["rollback", "completed", "revokeRollback"].forEach((C) => {
|
|
2319
2318
|
x.commandManager.addEventListener(C, () => {
|
|
2320
2319
|
setTimeout(() => {
|
|
2321
2320
|
Z.value = x.commandManager.operationList.length, G.value = x.commandManager.rollbackList.length;
|
|
2322
2321
|
});
|
|
2323
2322
|
});
|
|
2324
|
-
});
|
|
2325
|
-
}),
|
|
2323
|
+
}), localStorage.getItem("dxfVisible") && (r.value = localStorage.getItem("dxfVisible") == "true");
|
|
2324
|
+
}), zt(() => {
|
|
2326
2325
|
E.mouseMoveEventProxylock = !1, ht(), he.disconnect();
|
|
2327
2326
|
}), (C, p) => (D(), R("div", {
|
|
2328
2327
|
ref_key: "elRef",
|
|
2329
2328
|
ref: m,
|
|
2330
2329
|
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]"
|
|
2331
2330
|
}, [
|
|
2332
|
-
|
|
2333
|
-
default:
|
|
2334
|
-
b.value ? (D(), R("div",
|
|
2331
|
+
z(xe, null, {
|
|
2332
|
+
default: V(() => [
|
|
2333
|
+
b.value ? (D(), R("div", rs, [
|
|
2335
2334
|
(D(), R(ve, null, ke(Ce, (w) => P("div", {
|
|
2336
2335
|
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",
|
|
2337
2336
|
key: w.name
|
|
2338
2337
|
}, [
|
|
2339
|
-
P("p",
|
|
2340
|
-
P("span",
|
|
2338
|
+
P("p", ds, de(w.name), 1),
|
|
2339
|
+
P("span", ls, de(w.shortcut), 1)
|
|
2341
2340
|
])), 64))
|
|
2342
2341
|
])) : q("", !0)
|
|
2343
2342
|
]),
|
|
@@ -2346,15 +2345,15 @@ const ro = {
|
|
|
2346
2345
|
P("div", {
|
|
2347
2346
|
ref_key: "toolBarRef",
|
|
2348
2347
|
ref: y,
|
|
2349
|
-
style:
|
|
2350
|
-
class:
|
|
2348
|
+
style: Se({ left: S.value.left + "px", top: S.value.top + "px" }),
|
|
2349
|
+
class: j(["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 }]),
|
|
2351
2350
|
onMousedown: p[10] || (p[10] = (w) => w.stopPropagation())
|
|
2352
2351
|
}, [
|
|
2353
2352
|
P("div", {
|
|
2354
|
-
onMousedown:
|
|
2355
|
-
class:
|
|
2353
|
+
onMousedown: o,
|
|
2354
|
+
class: j([{ "border-b-[#eee] border-b-1": f.value }, "flex flex-row justify-between header text-[14px] font-bold p-[10px 0px]"])
|
|
2356
2355
|
}, [
|
|
2357
|
-
p[12] || (p[12] = Kt('<div class="flex flex-row" data-v-
|
|
2356
|
+
p[12] || (p[12] = Kt('<div class="flex flex-row" data-v-1a5a6c9b><div class="p-[2px_5px] flex items-center pointer-events-none" data-v-1a5a6c9b><svg fill="#aaa" width="20" height="20" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" data-v-1a5a6c9b><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-1a5a6c9b></path></svg></div><h5 class="flex text-nowrap text-[12px] items-center pointer-events-none" data-v-1a5a6c9b>绘制工具</h5></div>', 1)),
|
|
2358
2357
|
P("div", {
|
|
2359
2358
|
onMousedown: p[0] || (p[0] = (w) => w.stopPropagation()),
|
|
2360
2359
|
onClick: p[1] || (p[1] = (w) => f.value = !f.value),
|
|
@@ -2362,7 +2361,7 @@ const ro = {
|
|
|
2362
2361
|
}, [
|
|
2363
2362
|
(D(), R("svg", {
|
|
2364
2363
|
fill: "#666",
|
|
2365
|
-
class:
|
|
2364
|
+
class: j([{ "rotate-90": f.value }, "transition-all"]),
|
|
2366
2365
|
viewBox: "0 0 1024 1024",
|
|
2367
2366
|
version: "1.1",
|
|
2368
2367
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2373,29 +2372,29 @@ const ro = {
|
|
|
2373
2372
|
]), 2))
|
|
2374
2373
|
], 32)
|
|
2375
2374
|
], 34),
|
|
2376
|
-
f.value ? (D(), R("div",
|
|
2377
|
-
P("ul",
|
|
2375
|
+
f.value ? (D(), R("div", cs, [
|
|
2376
|
+
P("ul", ms, [
|
|
2378
2377
|
(D(), R(ve, null, ke(ct, (w) => (D(), R(ve, {
|
|
2379
2378
|
key: w.command
|
|
2380
2379
|
}, [
|
|
2381
2380
|
w.show ? (D(), R("li", {
|
|
2382
2381
|
key: 0,
|
|
2383
2382
|
onClick: (U) => t(w),
|
|
2384
|
-
class:
|
|
2383
|
+
class: j([{
|
|
2385
2384
|
"!bg-[var(--primary-color)] text-[#fff]": g.value === w.command
|
|
2386
2385
|
// '!cursor-no-drop': currentCommand !== item.command && currentCommand !== 'default',
|
|
2387
2386
|
}, "gap-[10px] text-[12px] hover:bg-[#ddd] transition-all rounded-[6px] p-[5px] flex flex-row items-center justify-between cursor-pointer"])
|
|
2388
2387
|
}, [
|
|
2389
|
-
P("div",
|
|
2390
|
-
P("div",
|
|
2388
|
+
P("div", us, [
|
|
2389
|
+
P("div", ps, [
|
|
2391
2390
|
P("img", {
|
|
2392
2391
|
class: "size-[14px]",
|
|
2393
2392
|
src: w.src,
|
|
2394
2393
|
alt: "",
|
|
2395
2394
|
srcset: ""
|
|
2396
|
-
}, null, 8,
|
|
2395
|
+
}, null, 8, gs)
|
|
2397
2396
|
]),
|
|
2398
|
-
P("span",
|
|
2397
|
+
P("span", vs, de(w.name), 1)
|
|
2399
2398
|
]),
|
|
2400
2399
|
g.value === w.command ? (D(), R("div", {
|
|
2401
2400
|
key: 0,
|
|
@@ -2414,107 +2413,107 @@ const ro = {
|
|
|
2414
2413
|
P("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" }),
|
|
2415
2414
|
P("path", { d: "M236.437333 463.914667l549.333333 0 0 96.874667-549.333333 0 0-96.874667Z" })
|
|
2416
2415
|
], -1)
|
|
2417
|
-
]))) : w.shortcut ? (D(), R("div",
|
|
2418
|
-
], 10,
|
|
2416
|
+
]))) : w.shortcut ? (D(), R("div", fs, de(w.shortcut), 1)) : q("", !0)
|
|
2417
|
+
], 10, hs)) : q("", !0)
|
|
2419
2418
|
], 64))), 64))
|
|
2420
2419
|
]),
|
|
2421
|
-
P("div",
|
|
2422
|
-
|
|
2420
|
+
P("div", ys, [
|
|
2421
|
+
z(v(Oe), {
|
|
2423
2422
|
size: "small",
|
|
2424
2423
|
modelValue: b.value,
|
|
2425
2424
|
"onUpdate:modelValue": p[3] || (p[3] = (w) => b.value = w),
|
|
2426
2425
|
label: "快捷键提示"
|
|
2427
2426
|
}, null, 8, ["modelValue"]),
|
|
2428
|
-
|
|
2427
|
+
z(v(Oe), {
|
|
2429
2428
|
size: "small",
|
|
2430
2429
|
modelValue: r.value,
|
|
2431
2430
|
"onUpdate:modelValue": p[4] || (p[4] = (w) => r.value = w),
|
|
2432
2431
|
label: "dxf"
|
|
2433
2432
|
}, null, 8, ["modelValue"])
|
|
2434
2433
|
]),
|
|
2435
|
-
C.permission === "admin" ? (D(), R("div",
|
|
2436
|
-
|
|
2434
|
+
C.permission === "admin" ? (D(), R("div", ws, [
|
|
2435
|
+
z(v(re), {
|
|
2437
2436
|
style: { padding: "5px", "font-size": "10px" },
|
|
2438
2437
|
size: "small",
|
|
2439
2438
|
type: "success",
|
|
2440
|
-
onClick:
|
|
2439
|
+
onClick: s
|
|
2441
2440
|
}, {
|
|
2442
|
-
default:
|
|
2441
|
+
default: V(() => p[14] || (p[14] = [
|
|
2443
2442
|
X(" 选择文件 ", -1)
|
|
2444
2443
|
])),
|
|
2445
2444
|
_: 1,
|
|
2446
2445
|
__: [14]
|
|
2447
2446
|
}),
|
|
2448
|
-
|
|
2447
|
+
z(v(re), {
|
|
2449
2448
|
style: { padding: "5px", "font-size": "10px" },
|
|
2450
2449
|
size: "small",
|
|
2451
2450
|
type: "primary",
|
|
2452
2451
|
onClick: p[5] || (p[5] = (w) => v(h).Dxf.downloadOriginalData("json.json"))
|
|
2453
2452
|
}, {
|
|
2454
|
-
default:
|
|
2453
|
+
default: V(() => p[15] || (p[15] = [
|
|
2455
2454
|
X(" 下载Json ", -1)
|
|
2456
2455
|
])),
|
|
2457
2456
|
_: 1,
|
|
2458
2457
|
__: [15]
|
|
2459
2458
|
}),
|
|
2460
|
-
|
|
2459
|
+
z(v(re), {
|
|
2461
2460
|
style: { padding: "5px", "font-size": "10px" },
|
|
2462
2461
|
size: "small",
|
|
2463
2462
|
type: "primary",
|
|
2464
2463
|
onClick: p[6] || (p[6] = (w) => v(h).AngleCorrectionDxf.download("test.dxf"))
|
|
2465
2464
|
}, {
|
|
2466
|
-
default:
|
|
2465
|
+
default: V(() => p[16] || (p[16] = [
|
|
2467
2466
|
X(" 下载DXF ", -1)
|
|
2468
2467
|
])),
|
|
2469
2468
|
_: 1,
|
|
2470
2469
|
__: [16]
|
|
2471
2470
|
}),
|
|
2472
|
-
|
|
2471
|
+
z(v(re), {
|
|
2473
2472
|
style: { padding: "5px", "font-size": "10px" },
|
|
2474
2473
|
size: "small",
|
|
2475
2474
|
type: "primary",
|
|
2476
2475
|
onClick: p[7] || (p[7] = (w) => v(h).AngleCorrectionDxf.downloadImage("dxf.jpg"))
|
|
2477
2476
|
}, {
|
|
2478
|
-
default:
|
|
2477
|
+
default: V(() => p[17] || (p[17] = [
|
|
2479
2478
|
X(" 下载JPG ", -1)
|
|
2480
2479
|
])),
|
|
2481
2480
|
_: 1,
|
|
2482
2481
|
__: [17]
|
|
2483
2482
|
}),
|
|
2484
|
-
|
|
2483
|
+
z(v(re), {
|
|
2485
2484
|
style: { padding: "5px", "font-size": "10px" },
|
|
2486
2485
|
size: "small",
|
|
2487
2486
|
type: "primary",
|
|
2488
2487
|
onClick: p[8] || (p[8] = (w) => v(K).downloadGltf("test.glb", !0))
|
|
2489
2488
|
}, {
|
|
2490
|
-
default:
|
|
2489
|
+
default: V(() => p[18] || (p[18] = [
|
|
2491
2490
|
X(" 下载白膜 ", -1)
|
|
2492
2491
|
])),
|
|
2493
2492
|
_: 1,
|
|
2494
2493
|
__: [18]
|
|
2495
2494
|
}),
|
|
2496
|
-
|
|
2495
|
+
z(v(re), {
|
|
2497
2496
|
style: { padding: "5px", "font-size": "10px" },
|
|
2498
2497
|
size: "small",
|
|
2499
2498
|
type: "primary",
|
|
2500
2499
|
onClick: p[9] || (p[9] = (w) => v(Y).download())
|
|
2501
2500
|
}, {
|
|
2502
|
-
default:
|
|
2501
|
+
default: V(() => p[19] || (p[19] = [
|
|
2503
2502
|
X(" 下载三维家JSON ", -1)
|
|
2504
2503
|
])),
|
|
2505
2504
|
_: 1,
|
|
2506
2505
|
__: [19]
|
|
2507
2506
|
})
|
|
2508
2507
|
])) : q("", !0),
|
|
2509
|
-
|
|
2510
|
-
default:
|
|
2511
|
-
P("div",
|
|
2512
|
-
|
|
2513
|
-
default:
|
|
2508
|
+
z(xe, null, {
|
|
2509
|
+
default: V(() => [
|
|
2510
|
+
P("div", bs, [
|
|
2511
|
+
z(Tt, null, {
|
|
2512
|
+
default: V(() => [
|
|
2514
2513
|
(D(), R(ve, null, ke(mt, (w) => P("div", {
|
|
2515
2514
|
onClick: (U) => w.show.value && g.value === "default" && (w.action ? w.action() : v(x).commandManager.start(w.command, [...v(I).selectLines])),
|
|
2516
2515
|
title: `${w.name}(${w.shortcut})`,
|
|
2517
|
-
class:
|
|
2516
|
+
class: j(["size-[20px] flex justify-center items-center relative overflow-hidden active:scale-[0.8] border-1 border-[#ccc] rounded-[4px] transition-all cursor-pointer", {
|
|
2518
2517
|
"opacity-30 bg-[#ccc] !cursor-no-drop active:!scale-[1]": !w.show.value || g.value !== "default",
|
|
2519
2518
|
[w.class ?? ""]: !0
|
|
2520
2519
|
}]),
|
|
@@ -2523,8 +2522,8 @@ const ro = {
|
|
|
2523
2522
|
P("img", {
|
|
2524
2523
|
class: "size-[14px]",
|
|
2525
2524
|
src: w.src
|
|
2526
|
-
}, null, 8,
|
|
2527
|
-
], 10,
|
|
2525
|
+
}, null, 8, Cs)
|
|
2526
|
+
], 10, xs)), 64))
|
|
2528
2527
|
]),
|
|
2529
2528
|
_: 1
|
|
2530
2529
|
})
|
|
@@ -2536,12 +2535,12 @@ const ro = {
|
|
|
2536
2535
|
], 38)
|
|
2537
2536
|
], 512));
|
|
2538
2537
|
}
|
|
2539
|
-
}),
|
|
2538
|
+
}), Ms = (d, e) => {
|
|
2540
2539
|
const t = d.__vccOpts || d;
|
|
2541
|
-
for (const [n,
|
|
2542
|
-
t[n] =
|
|
2540
|
+
for (const [n, s] of e)
|
|
2541
|
+
t[n] = s;
|
|
2543
2542
|
return t;
|
|
2544
|
-
},
|
|
2543
|
+
}, Ls = /* @__PURE__ */ Ms(Es, [["__scopeId", "data-v-1a5a6c9b"]]);
|
|
2545
2544
|
let lt = class extends Ae {
|
|
2546
2545
|
static name = "Editor";
|
|
2547
2546
|
container = new u.Group();
|
|
@@ -2596,20 +2595,20 @@ let lt = class extends Ae {
|
|
|
2596
2595
|
this.domContainer.domElement.parentElement && (this.domContainer.domElement.parentElement.appendChild(this.domElement), this.domContainer.domElement.parentElement.appendChild(this.imgEl), n());
|
|
2597
2596
|
});
|
|
2598
2597
|
setTimeout(() => {
|
|
2599
|
-
this.app =
|
|
2598
|
+
this.app = Vt(Ls, { dxfSystem: this.parent, permission: this.viewPermission }), this.app.mount(this.domElement);
|
|
2600
2599
|
}), e.AngleCorrectionDxf.addEventListener("lineOffset", async () => {
|
|
2601
2600
|
this.imgEl.src && URL.revokeObjectURL(this.imgEl.src), setTimeout(async () => {
|
|
2602
2601
|
this.imgEl.src = URL.createObjectURL(await e.AngleCorrectionDxf.toDxfImageBlob("Centimeters", "image/png", "transparent"));
|
|
2603
2602
|
});
|
|
2604
|
-
}), this.domEventRegister.addEventListener("mousedown", (
|
|
2605
|
-
|
|
2603
|
+
}), this.domEventRegister.addEventListener("mousedown", (s) => {
|
|
2604
|
+
s.x < this.imgWidth + 10 && s.x > 10 && s.y < this.imgWidth && s.y > 10 && Object.assign(this.imgEl.style, {
|
|
2606
2605
|
width: `${Math.min(this.imgWidth * 10, this.renderer.width * 0.9)}px`,
|
|
2607
2606
|
height: `${Math.min(this.imgWidth * 10, this.renderer.height * 0.9)}px`,
|
|
2608
2607
|
background: "rgba(0,0,0,1)",
|
|
2609
2608
|
zIndex: 100
|
|
2610
2609
|
});
|
|
2611
|
-
}), this.domEventRegister.addEventListener("mousemove", (
|
|
2612
|
-
|
|
2610
|
+
}), this.domEventRegister.addEventListener("mousemove", (s) => {
|
|
2611
|
+
s.x < this.imgWidth + 10 && s.x > 10 && s.y < this.imgWidth && s.y > 10 || Object.assign(this.imgEl.style, {
|
|
2613
2612
|
width: `${this.imgWidth}px`,
|
|
2614
2613
|
height: `${this.imgWidth}px`,
|
|
2615
2614
|
background: "rgba(255,255,255,0.2)",
|
|
@@ -2632,8 +2631,8 @@ let lt = class extends Ae {
|
|
|
2632
2631
|
* 打开编辑器
|
|
2633
2632
|
*/
|
|
2634
2633
|
openEdit() {
|
|
2635
|
-
const e = this.renderer, t = this.domEventRegister, n = this.dxf,
|
|
2636
|
-
this.container.position.z = n.originalZAverage, e.scene.add(this.container),
|
|
2634
|
+
const e = this.renderer, t = this.domEventRegister, n = this.dxf, s = e.orbitControls, o = e.camera, a = n.box.center, l = e.camera.position.clone(), r = s?.target?.clone(), i = new u.Vector2(), c = new u.Raycaster(), m = this.coords, y = this.pointerPosition;
|
|
2635
|
+
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);
|
|
2637
2636
|
const f = () => {
|
|
2638
2637
|
e.renderer.getSize(i);
|
|
2639
2638
|
const g = t.pointer.x / i.x * 2 - 1, h = -(t.pointer.y / i.y * 2 - 1);
|
|
@@ -2645,7 +2644,7 @@ let lt = class extends Ae {
|
|
|
2645
2644
|
}));
|
|
2646
2645
|
};
|
|
2647
2646
|
t.addEventListener("mousemove", f), this.commandManager.disabled = !1, this.commandManager.start("default"), this._exitEditCallBack = () => {
|
|
2648
|
-
t.removeEventListener("mousemove", f),
|
|
2647
|
+
t.removeEventListener("mousemove", f), s && (o.position.copy(l), s.enableRotate = !0, s.target.copy(r));
|
|
2649
2648
|
};
|
|
2650
2649
|
}
|
|
2651
2650
|
/**
|
|
@@ -2655,10 +2654,10 @@ let lt = class extends Ae {
|
|
|
2655
2654
|
typeof this._exitEditCallBack == "function" && (this._exitEditCallBack(), this._exitEditCallBack = void 0, this.commandManager.disabled = !0);
|
|
2656
2655
|
}
|
|
2657
2656
|
destroy() {
|
|
2658
|
-
super.destroy(), this.exitEdit(), this.renderer.scene.remove(this.container), this.domElement.remove(), this.app?.unmount();
|
|
2657
|
+
super.destroy(), this.exitEdit(), this.renderer.scene.remove(this.container), this.domElement.remove(), this.app?.unmount(), this.commandManager.destroy();
|
|
2659
2658
|
}
|
|
2660
2659
|
};
|
|
2661
|
-
class
|
|
2660
|
+
class ks extends O {
|
|
2662
2661
|
static name = "PointDrag";
|
|
2663
2662
|
container = new u.Group();
|
|
2664
2663
|
interruptKeys = ["escape"];
|
|
@@ -2673,15 +2672,15 @@ class Io extends O {
|
|
|
2673
2672
|
* @param next
|
|
2674
2673
|
*/
|
|
2675
2674
|
selectPoint(e) {
|
|
2676
|
-
let t = null, n = this.renderer.createCircle(M.zero(), { color: 16711935 }),
|
|
2677
|
-
const
|
|
2675
|
+
let t = null, n = this.renderer.createCircle(M.zero(), { color: 16711935 }), s = null;
|
|
2676
|
+
const o = this.editor.addEventListener("pointerPositionChange", () => {
|
|
2678
2677
|
const { point: a, line: l, find: r, mode: i } = this.editor.renderManager.adsorption();
|
|
2679
|
-
this.dispatchEvent({ type: "pointerMove", point: a }), r && i === "point" ? (this.domElement.style.cursor = "none", n.position.copy(a),
|
|
2678
|
+
this.dispatchEvent({ type: "pointerMove", point: a }), r && i === "point" ? (this.domElement.style.cursor = "none", n.position.copy(a), s = l, t = a.clone(), this.container.add(n)) : (this.domElement.style.cursor = "no-drop", t = null, n.removeFromParent());
|
|
2680
2679
|
});
|
|
2681
|
-
this.addEventRecord("selectPointStart").add(
|
|
2682
|
-
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), n.material.color.set(65280), e({ point: t, line:
|
|
2680
|
+
this.addEventRecord("selectPointStart").add(o).add(this.eventInput.addEventListener("codeChange", () => {
|
|
2681
|
+
this.eventInput.isKeyDown("mouse_0") && t && (this.canceEventRecord("selectPointStart"), n.material.color.set(65280), e({ point: t, line: s }));
|
|
2683
2682
|
})), this.addEventRecord("clear").add(() => {
|
|
2684
|
-
n.removeFromParent(),
|
|
2683
|
+
n.removeFromParent(), o();
|
|
2685
2684
|
});
|
|
2686
2685
|
}
|
|
2687
2686
|
/** 拖拽点
|
|
@@ -2691,7 +2690,7 @@ class Io extends O {
|
|
|
2691
2690
|
*/
|
|
2692
2691
|
drag(e, { point: t, line: n }) {
|
|
2693
2692
|
this.domElement.style.cursor = "crosshair";
|
|
2694
|
-
const
|
|
2693
|
+
const s = n.start.equal(M.from(t)) ? "start" : "end", o = s == "start" ? new u.Vector3(n.end.x, n.end.y, 0) : new u.Vector3(n.start.x, n.start.y, 0), a = t.clone(), l = new ye([o, a], 16711935), r = this.renderer.createCircle(M.zero(), { color: 16711935, size: 10 });
|
|
2695
2694
|
this.container.add(l), this.addEventRecord("clear").add(this.editor.addEventListener("pointerPositionChange", () => {
|
|
2696
2695
|
let { point: i, find: c } = this.editor.renderManager.adsorption(), m = "none";
|
|
2697
2696
|
if (i) {
|
|
@@ -2699,24 +2698,24 @@ class Io extends O {
|
|
|
2699
2698
|
const y = n.projectPoint(M.from(i), !1);
|
|
2700
2699
|
i.set(y?.x ?? i.x, y?.y ?? i.y, 0), c = !0, m = "crosshair";
|
|
2701
2700
|
}
|
|
2702
|
-
c ? (r.position.copy(i), this.container.add(r)) : (r.removeFromParent(), m = "crosshair"), a.copy(i), l.setPoint(
|
|
2701
|
+
c ? (r.position.copy(i), this.container.add(r)) : (r.removeFromParent(), m = "crosshair"), a.copy(i), l.setPoint(o, a), this.domElement.style.cursor = m;
|
|
2703
2702
|
}
|
|
2704
2703
|
})).add(this.eventInput.addEventListener("codeChange", () => {
|
|
2705
|
-
this.eventInput.isKeyDown("mouse_0") && (this.canceEventRecord("selectPointStart"), e({ point: a, oldPoint:
|
|
2704
|
+
this.eventInput.isKeyDown("mouse_0") && (this.canceEventRecord("selectPointStart"), e({ point: a, oldPoint: s === "end" ? n.end.clone() : n.start.clone(), line: n, mode: s }));
|
|
2706
2705
|
})).add(() => r.removeFromParent()).add(() => l.removeFromParent());
|
|
2707
2706
|
}
|
|
2708
2707
|
/** 执行完成
|
|
2709
2708
|
*/
|
|
2710
2709
|
completed(e) {
|
|
2711
|
-
const { line: t, point: n, mode:
|
|
2712
|
-
this.renderManager.removeLine(t),
|
|
2710
|
+
const { line: t, point: n, mode: s } = e;
|
|
2711
|
+
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(), this.commandManager.currentName === this.commandName && setTimeout(() => this.commandManager.start(this.commandName));
|
|
2713
2712
|
}
|
|
2714
2713
|
/** 回滚操作
|
|
2715
2714
|
* @param data
|
|
2716
2715
|
*/
|
|
2717
2716
|
rollback(e) {
|
|
2718
|
-
const { line: t, oldPoint: n, mode:
|
|
2719
|
-
return
|
|
2717
|
+
const { line: t, oldPoint: n, mode: s } = e;
|
|
2718
|
+
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;
|
|
2720
2719
|
}
|
|
2721
2720
|
/** 撤回回滚
|
|
2722
2721
|
* @param lines
|
|
@@ -2727,14 +2726,14 @@ class Io extends O {
|
|
|
2727
2726
|
}
|
|
2728
2727
|
}
|
|
2729
2728
|
function Je(d, e = {}) {
|
|
2730
|
-
d.addComponent(new lt(e.viewPermission)), d.addComponent(new
|
|
2729
|
+
d.addComponent(new lt(e.viewPermission)), d.addComponent(new os()), d.addComponent(new rt()), d.addComponent(new bn()), d.addComponent(new as()), d.addComponent(new is()), d.addComponent(new ks()), d.addComponent(new ee()), d.addComponent(new $()), d.addComponent(new le()), d.addComponent(new te()), d.addComponent(new ne()), d.addComponent(new se()), d.addComponent(new oe()), d.addComponent(new ae()), d.addComponent(new ie()), d.addComponent(new dt());
|
|
2731
2730
|
}
|
|
2732
|
-
const
|
|
2731
|
+
const Bs = Object.assign(Je, {
|
|
2733
2732
|
create(d = {}) {
|
|
2734
2733
|
return (e) => Je(e, d);
|
|
2735
2734
|
}
|
|
2736
2735
|
});
|
|
2737
2736
|
export {
|
|
2738
|
-
|
|
2737
|
+
Bs as Editor,
|
|
2739
2738
|
Je as Editor_
|
|
2740
2739
|
};
|