@ccpc/core 0.1.15 → 0.1.17
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/index.js +363 -291
- package/package.json +1 -1
- package/types/index.d.ts +3 -0
- package/types/toolkit/signal.d.ts +16 -0
- package/types/toolkit/signal_hook.d.ts +15 -0
- package/types/types/type_define.d.ts +10 -0
package/index.js
CHANGED
|
@@ -27,30 +27,30 @@ class m {
|
|
|
27
27
|
this._id = t.id;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const j = {
|
|
31
31
|
C_GREP: "C_GRep",
|
|
32
32
|
VISIBLE: "visible"
|
|
33
|
-
},
|
|
34
|
-
newGeoArray: () => [
|
|
35
|
-
newGeoObject: () =>
|
|
33
|
+
}, b = /* @__PURE__ */ Symbol("math"), Ft = {
|
|
34
|
+
newGeoArray: () => [b],
|
|
35
|
+
newGeoObject: () => b
|
|
36
36
|
};
|
|
37
|
-
class
|
|
38
|
-
static assert(t, e, s,
|
|
37
|
+
class c {
|
|
38
|
+
static assert(t, e, s, i) {
|
|
39
39
|
if (!t) {
|
|
40
|
-
const
|
|
40
|
+
const r = `${e}
|
|
41
41
|
报告人:${s}
|
|
42
|
-
报告时间:${
|
|
42
|
+
报告时间:${i}
|
|
43
43
|
点击确定可debug`;
|
|
44
|
-
throw new Error(
|
|
44
|
+
throw new Error(r);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
static warn(t, e, s,
|
|
47
|
+
static warn(t, e, s, i) {
|
|
48
48
|
if (!t) {
|
|
49
|
-
const
|
|
49
|
+
const r = `${e}
|
|
50
50
|
报告人:${s}
|
|
51
|
-
报告时间:${
|
|
51
|
+
报告时间:${i}
|
|
52
52
|
点击确定可debug`;
|
|
53
|
-
console.warn(
|
|
53
|
+
console.warn(r);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -62,7 +62,7 @@ class H {
|
|
|
62
62
|
* 注册类
|
|
63
63
|
*/
|
|
64
64
|
registerCls(t, e) {
|
|
65
|
-
this._kvMap.get(t) &&
|
|
65
|
+
this._kvMap.get(t) && c.assert(!1, `${String(e)}已注册,请检查`, "wg", "2026-03-05"), this._kvMap.set(t, e), this._vkMap.set(e, t);
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* 获取类
|
|
@@ -72,7 +72,7 @@ class H {
|
|
|
72
72
|
}
|
|
73
73
|
getClsEnsure(t) {
|
|
74
74
|
const e = this.getCls(t);
|
|
75
|
-
return
|
|
75
|
+
return c.assert(e, `未获取到键为${String(t)}对应的类`, "wg", "2026-03-05"), e;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* 获取标识
|
|
@@ -82,7 +82,7 @@ class H {
|
|
|
82
82
|
}
|
|
83
83
|
getClsNameEnsure(t) {
|
|
84
84
|
const e = this.getClsName(t);
|
|
85
|
-
return
|
|
85
|
+
return c.assert(e, `未获取到值为${String(t)}对应的标识`, "wg", "2026-03-05"), e;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* 获取所有类
|
|
@@ -97,12 +97,12 @@ class H {
|
|
|
97
97
|
return this._kvMap.size;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
class
|
|
100
|
+
class F {
|
|
101
101
|
constructor() {
|
|
102
102
|
this._elements = /* @__PURE__ */ new Map(), this._eleClsMgr = new H();
|
|
103
103
|
}
|
|
104
104
|
static instance() {
|
|
105
|
-
return this._instance || (this._instance = new
|
|
105
|
+
return this._instance || (this._instance = new F()), this._instance;
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* 注册Element
|
|
@@ -135,7 +135,7 @@ class k {
|
|
|
135
135
|
this._elements.clear();
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
const Z =
|
|
138
|
+
const Z = F.instance(), u = class u {
|
|
139
139
|
constructor() {
|
|
140
140
|
this._unstablePool = [], this._tmpPool = [], this._currentStableIndex = 0, this.reset();
|
|
141
141
|
}
|
|
@@ -167,7 +167,7 @@ const Z = k.instance(), u = class u {
|
|
|
167
167
|
}
|
|
168
168
|
genStableId() {
|
|
169
169
|
const t = ++this._currentStableIndex;
|
|
170
|
-
return
|
|
170
|
+
return c.assert(t < u.MAX_UNSTABLE_OFFSET, "stable id资源已耗尽", "wg", "2026-03-04"), new m(t);
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* 重置稳定ID的起始计数
|
|
@@ -180,7 +180,7 @@ const Z = k.instance(), u = class u {
|
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
182
|
u.MAX_TMP_NUM = 1e3, u.MAX_TMP_OFFSET = 2 ** 32 - u.MAX_TMP_NUM, u.MAX_UNSTABLE_NUM = 1e6, u.MAX_UNSTABLE_OFFSET = 2 ** 32 - u.MAX_UNSTABLE_NUM - u.MAX_TMP_NUM;
|
|
183
|
-
let
|
|
183
|
+
let k = u;
|
|
184
184
|
var _ = /* @__PURE__ */ ((n) => (n.NOT_STARTED = "not-started", n.STARTED = "started", n.COMMITTED = "committed", n.ROLLED_BACK = "rolled_back", n))(_ || {});
|
|
185
185
|
class Q {
|
|
186
186
|
constructor(t, e) {
|
|
@@ -191,7 +191,7 @@ class Q {
|
|
|
191
191
|
}
|
|
192
192
|
getStartParent() {
|
|
193
193
|
const t = this.doc.transactionMgr.getCurrentTransactionGroup();
|
|
194
|
-
return
|
|
194
|
+
return c.assert(t, "没有找到TransactionGroup", "wg", "2026-03-05"), t.startTransaction(this), t;
|
|
195
195
|
}
|
|
196
196
|
getStatus() {
|
|
197
197
|
return this._status;
|
|
@@ -206,7 +206,7 @@ class Q {
|
|
|
206
206
|
return this instanceof t;
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
var
|
|
209
|
+
var h = /* @__PURE__ */ ((n) => (n[n.ELEMENT_CREATE = 0] = "ELEMENT_CREATE", n[n.ELEMENT_UPDATE = 1] = "ELEMENT_UPDATE", n[n.ELEMENT_DELETE = 2] = "ELEMENT_DELETE", n))(h || {}), I = /* @__PURE__ */ ((n) => (n[n.UNKOWN = 0] = "UNKOWN", n[n.POINT = 1] = "POINT", n[n.EDGE = 2] = "EDGE", n[n.GROUP = 5] = "GROUP", n))(I || {}), v = /* @__PURE__ */ ((n) => (n.UNDER_SCORE = "_", n.C_UNDER_SCORE = "C_", n))(v || {}), B = /* @__PURE__ */ ((n) => (n.UNDO = "core.undo", n.REDO = "core.redo", n))(B || {});
|
|
210
210
|
class _t {
|
|
211
211
|
constructor(t) {
|
|
212
212
|
this._added = /* @__PURE__ */ new Set(), this._deleted = /* @__PURE__ */ new Set(), this._modified = /* @__PURE__ */ new Set(), this._modifiedProperties = /* @__PURE__ */ new Map(), this._doc = t;
|
|
@@ -253,36 +253,36 @@ class _t {
|
|
|
253
253
|
* 合并其它提交
|
|
254
254
|
*/
|
|
255
255
|
merge(t) {
|
|
256
|
-
const e = /* @__PURE__ */ new Set([...t._added]), s = /* @__PURE__ */ new Set([...t._deleted]),
|
|
257
|
-
t._modifiedProperties.forEach((
|
|
258
|
-
for (const
|
|
259
|
-
|
|
260
|
-
for (const
|
|
261
|
-
|
|
262
|
-
!e.has(
|
|
256
|
+
const e = /* @__PURE__ */ new Set([...t._added]), s = /* @__PURE__ */ new Set([...t._deleted]), i = /* @__PURE__ */ new Map();
|
|
257
|
+
t._modifiedProperties.forEach((r, o) => i.set(o, r));
|
|
258
|
+
for (const r of [...this._added])
|
|
259
|
+
c.assert(!e.has(r), "不可能发生", "wg", "2026-03-05"), s.has(r) ? (this._added.delete(r), s.delete(r)) : i.delete(r.id.asInt());
|
|
260
|
+
for (const r of [...this._deleted])
|
|
261
|
+
c.assert(
|
|
262
|
+
!e.has(r) && !s.has(r) && !i.has(r.id.asInt()),
|
|
263
263
|
"不可能发生",
|
|
264
264
|
"wg",
|
|
265
265
|
"2026-03-05"
|
|
266
266
|
);
|
|
267
|
-
for (const [
|
|
268
|
-
if ([...e].find((a) => a.id.asInt() ===
|
|
269
|
-
|
|
270
|
-
else if (
|
|
271
|
-
|
|
272
|
-
const y = o.find((M) => M.propertyName ===
|
|
273
|
-
y ? y.newValue =
|
|
274
|
-
}),
|
|
275
|
-
else if ([...s].find((a) => a.id.asInt() ===
|
|
276
|
-
this._modifiedProperties.delete(
|
|
277
|
-
const a = [...s].find((
|
|
278
|
-
o.forEach(({ propertyName:
|
|
279
|
-
const M =
|
|
280
|
-
a && (a.db[M] =
|
|
267
|
+
for (const [r, o] of this._modifiedProperties)
|
|
268
|
+
if ([...e].find((a) => a.id.asInt() === r))
|
|
269
|
+
c.assert(!1, "不可能发生", "wg", "2026-03-05");
|
|
270
|
+
else if (i.has(r))
|
|
271
|
+
i.get(r)?.forEach((d) => {
|
|
272
|
+
const y = o.find((M) => M.propertyName === d.propertyName);
|
|
273
|
+
y ? y.newValue = d.newValue : o.push(d);
|
|
274
|
+
}), i.delete(r);
|
|
275
|
+
else if ([...s].find((a) => a.id.asInt() === r)) {
|
|
276
|
+
this._modifiedProperties.delete(r);
|
|
277
|
+
const a = [...s].find((d) => d.id.asInt() === r);
|
|
278
|
+
o.forEach(({ propertyName: d, oldValue: y }) => {
|
|
279
|
+
const M = d, V = y;
|
|
280
|
+
a && (a.db[M] = V);
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
|
-
e.forEach((
|
|
284
|
-
this._modifiedProperties.set(o,
|
|
285
|
-
}), this._modified.clear(), this._modifiedProperties.forEach((
|
|
283
|
+
e.forEach((r) => this._added.add(r)), s.forEach((r) => this._deleted.add(r)), i.forEach((r, o) => {
|
|
284
|
+
this._modifiedProperties.set(o, r);
|
|
285
|
+
}), this._modified.clear(), this._modifiedProperties.forEach((r, o) => {
|
|
286
286
|
const a = this._doc.getElementByIdEnsure(o);
|
|
287
287
|
this._modified.add(a);
|
|
288
288
|
});
|
|
@@ -294,8 +294,8 @@ class _t {
|
|
|
294
294
|
const t = [...this._added], e = [...this._deleted];
|
|
295
295
|
this._added.clear(), this._deleted.clear(), t.forEach((s) => this._deleted.add(s)), e.forEach((s) => this._added.add(s));
|
|
296
296
|
for (const [, s] of this._modifiedProperties)
|
|
297
|
-
for (const
|
|
298
|
-
[
|
|
297
|
+
for (const i of s)
|
|
298
|
+
[i.oldValue, i.newValue] = [i.newValue, i.oldValue];
|
|
299
299
|
}
|
|
300
300
|
/**
|
|
301
301
|
* 正向执行
|
|
@@ -304,9 +304,9 @@ class _t {
|
|
|
304
304
|
this._handleElementsFromDB(!1, ...this._added);
|
|
305
305
|
for (const [t, e] of this._modifiedProperties) {
|
|
306
306
|
const s = this._doc.getElementByIdEnsure(t);
|
|
307
|
-
for (const
|
|
308
|
-
const
|
|
309
|
-
s.db[
|
|
307
|
+
for (const i of e) {
|
|
308
|
+
const r = i.propertyName, o = i.newValue;
|
|
309
|
+
s.db[r] = o;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
this._handleElementsFromDB(!0, ...this._deleted), this._updateViewCache();
|
|
@@ -334,8 +334,8 @@ class _t {
|
|
|
334
334
|
*/
|
|
335
335
|
_handleElementsFromDB(t, ...e) {
|
|
336
336
|
const s = this._doc.elementMgr;
|
|
337
|
-
e.forEach((
|
|
338
|
-
t ? s.delete(
|
|
337
|
+
e.forEach((i) => {
|
|
338
|
+
t ? s.delete(i.id.asInt()) : s.add(i);
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
@@ -354,10 +354,10 @@ class _t {
|
|
|
354
354
|
_updateViewCache() {
|
|
355
355
|
const t = /* @__PURE__ */ new Set();
|
|
356
356
|
for (const [e, s] of this._modifiedProperties) {
|
|
357
|
-
const
|
|
358
|
-
s.find(({ propertyName:
|
|
357
|
+
const i = this._doc.getElementByIdEnsure(e);
|
|
358
|
+
s.find(({ propertyName: r }) => i?.propShouldCacheToView(r)) && t.add(i);
|
|
359
359
|
}
|
|
360
|
-
this._doc.cacheForViewElementChanged(
|
|
360
|
+
this._doc.cacheForViewElementChanged(h.ELEMENT_CREATE, [...this._added]), this._doc.cacheForViewElementChanged(h.ELEMENT_UPDATE, [...t]), this._doc.cacheForViewElementChanged(h.ELEMENT_DELETE, [...this._deleted]);
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
class S extends Q {
|
|
@@ -391,25 +391,25 @@ class f extends Q {
|
|
|
391
391
|
return super.start(), this.isRoot || (this.doc.transactionMgr.getLastLeafTranGroup(!0)?.clearRedoList(), this.parent = this.getStartParent()), !0;
|
|
392
392
|
}
|
|
393
393
|
startTransaction(t) {
|
|
394
|
-
|
|
394
|
+
c.assert(
|
|
395
395
|
this.getStatus() === _.STARTED,
|
|
396
396
|
"事务组已完成,不能再启动事务",
|
|
397
397
|
"wg",
|
|
398
398
|
"2026-03-05"
|
|
399
399
|
);
|
|
400
400
|
const e = this.getCurrentTransaction()?.name, s = t.name;
|
|
401
|
-
|
|
401
|
+
c.assert(
|
|
402
402
|
this.getStatus() === _.STARTED && !this.getCurrentTransaction(),
|
|
403
403
|
`事务不能嵌套, 新事务${s}, 未完成的事务${e}`,
|
|
404
404
|
"wg",
|
|
405
405
|
"2025-03-05"
|
|
406
406
|
), this.undoList.push(t), this.redoList.splice(0);
|
|
407
|
-
const
|
|
408
|
-
if (this.undoList.length <=
|
|
407
|
+
const i = Math.max(this.getMaxUndoStackSize(), 4);
|
|
408
|
+
if (this.undoList.length <= i)
|
|
409
409
|
return;
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
412
|
-
const o = this._toTransaction(
|
|
410
|
+
const r = this.undoList.shift();
|
|
411
|
+
if (r && this.parent) {
|
|
412
|
+
const o = this._toTransaction(r), a = this._toTransaction(this.undoList[0]);
|
|
413
413
|
this.undoList[0] = o.merge(a);
|
|
414
414
|
}
|
|
415
415
|
}
|
|
@@ -430,9 +430,9 @@ class f extends Q {
|
|
|
430
430
|
const t = this.undoList[0].name + "->" + this.undoList[this.undoList.length - 1].name;
|
|
431
431
|
for (; this.undoList.length > 1; ) {
|
|
432
432
|
const s = this.undoList.pop();
|
|
433
|
-
|
|
434
|
-
const
|
|
435
|
-
this.undoList[this.undoList.length - 1] =
|
|
433
|
+
c.assert(s, "undoList不应该为空", "wg", "2026-03-05");
|
|
434
|
+
const i = this._toTransaction(s), r = this._toTransaction(this.undoList[this.undoList.length - 1]);
|
|
435
|
+
this.undoList[this.undoList.length - 1] = r, r.merge(i);
|
|
436
436
|
}
|
|
437
437
|
const e = this.undoList[0];
|
|
438
438
|
return e.name = t, e.canUndo = !0, e;
|
|
@@ -458,7 +458,7 @@ class f extends Q {
|
|
|
458
458
|
return t.reverseAndExecute(), this.undoList.pop(), !0;
|
|
459
459
|
}
|
|
460
460
|
replaceTailTransaction(t, e) {
|
|
461
|
-
return
|
|
461
|
+
return c.assert(
|
|
462
462
|
this.undoList[this.undoList.length - 1] === t,
|
|
463
463
|
"只能替换栈顶事务",
|
|
464
464
|
"wg",
|
|
@@ -497,7 +497,7 @@ class f extends Q {
|
|
|
497
497
|
this.redoList.splice(0);
|
|
498
498
|
}
|
|
499
499
|
popTransaction(t) {
|
|
500
|
-
return
|
|
500
|
+
return c.assert(this.undoList.pop() === t, "只能pop栈顶事务", "wg", "2026-03-05"), !0;
|
|
501
501
|
}
|
|
502
502
|
getCurrentTransaction() {
|
|
503
503
|
const t = this.undoList[this.undoList.length - 1];
|
|
@@ -576,7 +576,7 @@ class ft {
|
|
|
576
576
|
*/
|
|
577
577
|
getCurrentUndoRedoEntity() {
|
|
578
578
|
const t = this.getCurrentTransaction();
|
|
579
|
-
return
|
|
579
|
+
return c.assert(t, "没有事务", "wg", "2025-11-18"), t.undoRedoEntity;
|
|
580
580
|
}
|
|
581
581
|
/**
|
|
582
582
|
* 撤销
|
|
@@ -624,7 +624,7 @@ class O {
|
|
|
624
624
|
this._requestClsMgr.registerCls(t, e);
|
|
625
625
|
}
|
|
626
626
|
startSession(t = "") {
|
|
627
|
-
|
|
627
|
+
c.assert(!this._transGroup, "请先提交上一个 request", "wg", "2026-03-05"), this._transGroup = new f(this._doc, t);
|
|
628
628
|
}
|
|
629
629
|
commitSession() {
|
|
630
630
|
this._transGroup?.assimilate(), this._doc.updateView(), this._transGroup = void 0;
|
|
@@ -638,12 +638,12 @@ class O {
|
|
|
638
638
|
createReq(t, ...e) {
|
|
639
639
|
const s = new t(...e);
|
|
640
640
|
s.setDoc(this._doc);
|
|
641
|
-
const
|
|
642
|
-
return s.canTransact() && (this._transaction = new S(this._doc, `${
|
|
641
|
+
const i = this._requestClsMgr.getClsNameEnsure(t);
|
|
642
|
+
return s.canTransact() && (this._transaction = new S(this._doc, `${i}-start`)), s;
|
|
643
643
|
}
|
|
644
644
|
executeReq(t, e = !0) {
|
|
645
645
|
const s = t.execute();
|
|
646
|
-
return !e || !t.canTransact() ? (this._doc.updateView(), s) : (
|
|
646
|
+
return !e || !t.canTransact() ? (this._doc.updateView(), s) : (c.assert(this._transaction, "请先创建一个 request", "wg", "2026-03-05"), this._transaction?.commit(), this._doc.updateView(), this._transaction = void 0, s);
|
|
647
647
|
}
|
|
648
648
|
cancelReq() {
|
|
649
649
|
this._transaction?.rollBack(), this._doc.updateView(), this._transaction = void 0;
|
|
@@ -669,9 +669,9 @@ class L {
|
|
|
669
669
|
*/
|
|
670
670
|
onBeforeRender(t = !1) {
|
|
671
671
|
const e = [];
|
|
672
|
-
for (const [
|
|
673
|
-
const o =
|
|
674
|
-
o && e.push({ ...o, id:
|
|
672
|
+
for (const [i, r] of this._displayMap) {
|
|
673
|
+
const o = r.onBeforeRender(t);
|
|
674
|
+
o && e.push({ ...o, id: i });
|
|
675
675
|
}
|
|
676
676
|
const s = Array.from(this._removedSet);
|
|
677
677
|
return this._removedSet.clear(), { update: e, remove: s };
|
|
@@ -685,7 +685,7 @@ class L {
|
|
|
685
685
|
return this._instance || (this._instance = new L()), this._instance;
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
|
-
class
|
|
688
|
+
class x {
|
|
689
689
|
constructor() {
|
|
690
690
|
this.style = {}, this.type = I.UNKOWN;
|
|
691
691
|
}
|
|
@@ -702,7 +702,7 @@ class C {
|
|
|
702
702
|
return e.parent = this.parent, e.gnode = this.gnode, e.globalMatrix = this.globalMatrix?.clone(), e;
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
class z extends
|
|
705
|
+
class z extends x {
|
|
706
706
|
constructor() {
|
|
707
707
|
super(...arguments), this.children = [], this.type = I.GROUP;
|
|
708
708
|
}
|
|
@@ -716,19 +716,19 @@ class z extends C {
|
|
|
716
716
|
}), t;
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
|
-
class gt extends
|
|
719
|
+
class gt extends x {
|
|
720
720
|
constructor() {
|
|
721
721
|
super(...arguments), this.type = I.POINT;
|
|
722
722
|
}
|
|
723
723
|
// TODO clone方法
|
|
724
724
|
}
|
|
725
|
-
class tt extends
|
|
725
|
+
class tt extends x {
|
|
726
726
|
constructor() {
|
|
727
727
|
super(...arguments), this.type = I.EDGE;
|
|
728
728
|
}
|
|
729
729
|
// TODO clone方法
|
|
730
730
|
}
|
|
731
|
-
class mt extends
|
|
731
|
+
class mt extends x {
|
|
732
732
|
constructor() {
|
|
733
733
|
super(...arguments), this.text = "", this.opacity = 1, this.position = P.O();
|
|
734
734
|
}
|
|
@@ -737,7 +737,7 @@ class mt extends C {
|
|
|
737
737
|
return t.text = this.text, t.opacity = this.opacity, t.position = new P(this.position), t;
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
class yt extends
|
|
740
|
+
class yt extends x {
|
|
741
741
|
/**
|
|
742
742
|
* 点集,一个点由一个索引组成
|
|
743
743
|
* 离散后的所有顶点, 此数据不渲染,只做存储使用
|
|
@@ -809,15 +809,15 @@ class yt extends C {
|
|
|
809
809
|
merge(t) {
|
|
810
810
|
if (!t.getVerts().length)
|
|
811
811
|
return;
|
|
812
|
-
const e = Array.from(this._verts || []), s = e.length / 3,
|
|
813
|
-
e.push(...
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
const a = Array.from(this._uvs || []),
|
|
817
|
-
a.push(...
|
|
812
|
+
const e = Array.from(this._verts || []), s = e.length / 3, i = Array.from(t.getVerts());
|
|
813
|
+
e.push(...i);
|
|
814
|
+
const r = Array.from(this._normals || []), o = Array.from(t.getNormals());
|
|
815
|
+
r.push(...o);
|
|
816
|
+
const a = Array.from(this._uvs || []), d = Array.from(t.getUVs());
|
|
817
|
+
a.push(...d);
|
|
818
818
|
const y = Array.from(this._indices || []);
|
|
819
819
|
let M = Array.from(t.getIndices());
|
|
820
|
-
M = M.map((
|
|
820
|
+
M = M.map((V) => V + s), y.push(...M), this._verts = new Float32Array(e), this._normals = new Float32Array(r), this._uvs = new Float32Array(a), this._indices = new Uint32Array(y);
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
823
|
class Et {
|
|
@@ -872,7 +872,7 @@ const R = class R {
|
|
|
872
872
|
* GNode->RenderNode入口
|
|
873
873
|
*/
|
|
874
874
|
toRenderNode(t) {
|
|
875
|
-
return this.updateRenderNode(t),
|
|
875
|
+
return this.updateRenderNode(t), c.assert(this._renderNode, "转RenderNode失败", "wg", "2026-03-11"), this._renderNode;
|
|
876
876
|
}
|
|
877
877
|
/**
|
|
878
878
|
* 更新GNode对应的RenderNode
|
|
@@ -943,7 +943,7 @@ const R = class R {
|
|
|
943
943
|
* 从父节点移除
|
|
944
944
|
*/
|
|
945
945
|
removeFromParent() {
|
|
946
|
-
return !this.parent || !(this.parent instanceof
|
|
946
|
+
return !this.parent || !(this.parent instanceof D) ? !1 : this.parent.removeNode(this);
|
|
947
947
|
}
|
|
948
948
|
/**
|
|
949
949
|
* 从其它实例复制状态
|
|
@@ -953,8 +953,8 @@ const R = class R {
|
|
|
953
953
|
}
|
|
954
954
|
};
|
|
955
955
|
R.gId = 0;
|
|
956
|
-
let
|
|
957
|
-
class
|
|
956
|
+
let N = R;
|
|
957
|
+
class D extends N {
|
|
958
958
|
constructor() {
|
|
959
959
|
super(...arguments), this._children = [];
|
|
960
960
|
}
|
|
@@ -992,12 +992,12 @@ class V extends D {
|
|
|
992
992
|
_toRenderNodeWithoutMatrix(t) {
|
|
993
993
|
const e = new z();
|
|
994
994
|
return this._children.forEach((s) => {
|
|
995
|
-
const
|
|
996
|
-
|
|
995
|
+
const i = s.toRenderNode(t);
|
|
996
|
+
i && e.add(i);
|
|
997
997
|
}), e;
|
|
998
998
|
}
|
|
999
999
|
clone(t) {
|
|
1000
|
-
return new
|
|
1000
|
+
return new D()._copyFrom(this, t);
|
|
1001
1001
|
}
|
|
1002
1002
|
_copyFrom(t, e) {
|
|
1003
1003
|
return super._copyFrom(t), t._children.forEach((s) => {
|
|
@@ -1005,7 +1005,7 @@ class V extends D {
|
|
|
1005
1005
|
}), this;
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
class g extends
|
|
1008
|
+
class g extends D {
|
|
1009
1009
|
constructor() {
|
|
1010
1010
|
super(...arguments), this._elementId = m.INVALID;
|
|
1011
1011
|
}
|
|
@@ -1041,8 +1041,8 @@ function et(n) {
|
|
|
1041
1041
|
get() {
|
|
1042
1042
|
return this._dirtyPropsPool.get(s);
|
|
1043
1043
|
},
|
|
1044
|
-
set(
|
|
1045
|
-
this._dirtyPropsPool.get(s) !==
|
|
1044
|
+
set(i) {
|
|
1045
|
+
this._dirtyPropsPool.get(s) !== i && this.dirty(), this._dirtyPropsPool.set(s, i);
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
1048
|
);
|
|
@@ -1086,9 +1086,9 @@ class wt {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
1088
|
var St = Object.defineProperty, Mt = (n, t, e, s) => {
|
|
1089
|
-
for (var
|
|
1090
|
-
(o = n[
|
|
1091
|
-
return
|
|
1089
|
+
for (var i = void 0, r = n.length - 1, o; r >= 0; r--)
|
|
1090
|
+
(o = n[r]) && (i = o(t, e, i) || i);
|
|
1091
|
+
return i && St(t, e, i), i;
|
|
1092
1092
|
}, T;
|
|
1093
1093
|
const st = (T = class extends wt {
|
|
1094
1094
|
constructor() {
|
|
@@ -1125,11 +1125,11 @@ Mt([
|
|
|
1125
1125
|
], st.prototype, "visible");
|
|
1126
1126
|
let Tt = st;
|
|
1127
1127
|
var Lt = Object.defineProperty, vt = (n, t, e, s) => {
|
|
1128
|
-
for (var
|
|
1129
|
-
(o = n[
|
|
1130
|
-
return
|
|
1128
|
+
for (var i = void 0, r = n.length - 1, o; r >= 0; r--)
|
|
1129
|
+
(o = n[r]) && (i = o(t, e, i) || i);
|
|
1130
|
+
return i && Lt(t, e, i), i;
|
|
1131
1131
|
};
|
|
1132
|
-
class
|
|
1132
|
+
class G extends Tt {
|
|
1133
1133
|
getGRep() {
|
|
1134
1134
|
return this.gRep;
|
|
1135
1135
|
}
|
|
@@ -1139,7 +1139,7 @@ class U extends Tt {
|
|
|
1139
1139
|
}
|
|
1140
1140
|
vt([
|
|
1141
1141
|
et()
|
|
1142
|
-
],
|
|
1142
|
+
], G.prototype, "gRep");
|
|
1143
1143
|
class Rt {
|
|
1144
1144
|
drawActives(t) {
|
|
1145
1145
|
throw new Error("Method not implemented.");
|
|
@@ -1163,9 +1163,9 @@ class Rt {
|
|
|
1163
1163
|
class At {
|
|
1164
1164
|
constructor() {
|
|
1165
1165
|
this.container = /* @__PURE__ */ new Map(), [
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1166
|
+
h.ELEMENT_CREATE,
|
|
1167
|
+
h.ELEMENT_DELETE,
|
|
1168
|
+
h.ELEMENT_UPDATE
|
|
1169
1169
|
].forEach((e) => this.container.set(e, /* @__PURE__ */ new Set()));
|
|
1170
1170
|
}
|
|
1171
1171
|
/**
|
|
@@ -1182,11 +1182,11 @@ class At {
|
|
|
1182
1182
|
* 更新/创建+删除 = 删除
|
|
1183
1183
|
*/
|
|
1184
1184
|
cacheElementChanged(t, e) {
|
|
1185
|
-
const s = e.filter((o) => !o.dontShowView()),
|
|
1186
|
-
|
|
1187
|
-
i?.has(o.id.asInt()) && i.delete(o.id.asInt()), r?.add(o.id.asInt());
|
|
1188
|
-
}) : l.ELEMENT_DELETE === t && s.forEach((o) => {
|
|
1185
|
+
const s = e.filter((o) => !o.dontShowView()), i = this.container.get(h.ELEMENT_UPDATE), r = this.container.get(h.ELEMENT_DELETE);
|
|
1186
|
+
h.ELEMENT_CREATE === t || h.ELEMENT_UPDATE === t ? s.forEach((o) => {
|
|
1189
1187
|
r?.has(o.id.asInt()) && r.delete(o.id.asInt()), i?.add(o.id.asInt());
|
|
1188
|
+
}) : h.ELEMENT_DELETE === t && s.forEach((o) => {
|
|
1189
|
+
i?.has(o.id.asInt()) && i.delete(o.id.asInt()), r?.add(o.id.asInt());
|
|
1190
1190
|
});
|
|
1191
1191
|
}
|
|
1192
1192
|
/**
|
|
@@ -1210,7 +1210,7 @@ class At {
|
|
|
1210
1210
|
delete this.highLight, delete this.selection;
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
|
-
var
|
|
1213
|
+
var it = /* @__PURE__ */ ((n) => (n.Left = "left", n.Center = "center", n.Right = "right", n))(it || {}), rt = /* @__PURE__ */ ((n) => (n.Top = "top", n.Middle = "middle", n.Bottom = "bottom", n))(rt || {});
|
|
1214
1214
|
const p = class p {
|
|
1215
1215
|
static mergeStateStyle(t = {}, e = {}) {
|
|
1216
1216
|
return {
|
|
@@ -1267,7 +1267,7 @@ const p = class p {
|
|
|
1267
1267
|
};
|
|
1268
1268
|
}
|
|
1269
1269
|
};
|
|
1270
|
-
p.default_opacity = 1, p.default_point_color = 16777215, p.default_point_size = 8, p.default_line_color = 16777215, p.default_line_width = 2, p.default_face_color = 16777215, p.default_text_color = 16777215, p.default_text_fontSize = 16, p.default_text_anchorX =
|
|
1270
|
+
p.default_opacity = 1, p.default_point_color = 16777215, p.default_point_size = 8, p.default_line_color = 16777215, p.default_line_width = 2, p.default_face_color = 16777215, p.default_text_color = 16777215, p.default_text_fontSize = 16, p.default_text_anchorX = it.Center, p.default_text_anchorY = rt.Middle, p.defaultActiveStyle = {
|
|
1271
1271
|
point: { color: 16738304 },
|
|
1272
1272
|
line: { color: 16738304 },
|
|
1273
1273
|
face: { color: 16738304 },
|
|
@@ -1278,7 +1278,7 @@ p.default_opacity = 1, p.default_point_color = 16777215, p.default_point_size =
|
|
|
1278
1278
|
face: { color: 16729344 },
|
|
1279
1279
|
text: { color: 16729344 }
|
|
1280
1280
|
};
|
|
1281
|
-
let
|
|
1281
|
+
let l = p;
|
|
1282
1282
|
class It {
|
|
1283
1283
|
constructor(t) {
|
|
1284
1284
|
this._renderDirty = !0, this.iRender = new Rt(), this.cacheForView = new At(), this._eid2didMap = /* @__PURE__ */ new Map(), this._doc = t;
|
|
@@ -1306,20 +1306,20 @@ class It {
|
|
|
1306
1306
|
this._eid2didMap.forEach((t, e) => this._removeGRep(e)), this._eid2didMap.clear();
|
|
1307
1307
|
}
|
|
1308
1308
|
_updateElements() {
|
|
1309
|
-
const { container: t } = this.cacheForView, e = t.get(
|
|
1310
|
-
if (!(!e || !s || !
|
|
1311
|
-
for (const
|
|
1312
|
-
const o = this._doc.getElementById(
|
|
1309
|
+
const { container: t } = this.cacheForView, e = t.get(h.ELEMENT_CREATE)?.keys(), s = t.get(h.ELEMENT_UPDATE)?.keys(), i = t.get(h.ELEMENT_DELETE)?.keys();
|
|
1310
|
+
if (!(!e || !s || !i)) {
|
|
1311
|
+
for (const r of e) {
|
|
1312
|
+
const o = this._doc.getElementById(r);
|
|
1313
1313
|
!o || !this._isElementValid(o) || this._addGRep(o.getGRep());
|
|
1314
1314
|
}
|
|
1315
|
-
for (const
|
|
1316
|
-
const o = this._doc.getElementById(
|
|
1315
|
+
for (const r of s) {
|
|
1316
|
+
const o = this._doc.getElementById(r);
|
|
1317
1317
|
if (!o) continue;
|
|
1318
1318
|
const a = o.getGRep();
|
|
1319
|
-
this._isElementValid(o) ? this._updateGRep(a) : this._removeGRep(
|
|
1319
|
+
this._isElementValid(o) ? this._updateGRep(a) : this._removeGRep(r);
|
|
1320
1320
|
}
|
|
1321
|
-
for (const
|
|
1322
|
-
this._removeGRep(
|
|
1321
|
+
for (const r of i)
|
|
1322
|
+
this._removeGRep(r);
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
1325
|
/**
|
|
@@ -1331,13 +1331,13 @@ class It {
|
|
|
1331
1331
|
return e && !e.isEmpty() && t.isElementVisible();
|
|
1332
1332
|
}
|
|
1333
1333
|
_addGRep(t) {
|
|
1334
|
-
const e = t.elementId.asInt(), s = new
|
|
1334
|
+
const e = t.elementId.asInt(), s = new G();
|
|
1335
1335
|
s.gRep = t, s.eId = e, this._eid2didMap.set(e, s.id), L.instance().addDisplay(s), this._renderDirty = !0;
|
|
1336
1336
|
}
|
|
1337
1337
|
_updateGRep(t) {
|
|
1338
1338
|
const e = t.elementId.asInt(), s = this._eid2didMap.get(e);
|
|
1339
|
-
let
|
|
1340
|
-
s ? (
|
|
1339
|
+
let i;
|
|
1340
|
+
s ? (i = L.instance().getDisplay(s), c.assert(i, "未查询到display", "wg", "2026-03-12")) : (i = new G(), L.instance().addDisplay(i), this._eid2didMap.set(e, i.id)), i.gRep = t, i.eId = e, this._renderDirty = !0;
|
|
1341
1341
|
}
|
|
1342
1342
|
_removeGRep(t) {
|
|
1343
1343
|
const e = this._eid2didMap.get(t);
|
|
@@ -1360,28 +1360,28 @@ class It {
|
|
|
1360
1360
|
if (!t) return;
|
|
1361
1361
|
const e = t.getActiveElements(), s = t.getActiveGNodes();
|
|
1362
1362
|
this.iRender.clearActive(), this._renderDirty = !0;
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1363
|
+
const i = this._toGReps(e, s, !1);
|
|
1364
|
+
i.length && this.iRender.drawActives(i);
|
|
1365
1365
|
}
|
|
1366
1366
|
/**
|
|
1367
1367
|
* 高亮选中对象转grep
|
|
1368
1368
|
*/
|
|
1369
1369
|
_toGReps(t, e, s) {
|
|
1370
|
-
const
|
|
1370
|
+
const i = [];
|
|
1371
1371
|
t.forEach((o) => {
|
|
1372
1372
|
const a = s ? o.getGRepWhenSelected() : o.getGRepWhenActive();
|
|
1373
|
-
a.isEmpty() ||
|
|
1373
|
+
a.isEmpty() || i.push(a);
|
|
1374
1374
|
});
|
|
1375
|
-
const
|
|
1375
|
+
const r = new g();
|
|
1376
1376
|
return e.forEach((o) => {
|
|
1377
|
-
const a = o.globalMatrix?.clone(),
|
|
1378
|
-
|
|
1379
|
-
const y = s ?
|
|
1380
|
-
|
|
1381
|
-
}),
|
|
1377
|
+
const a = o.globalMatrix?.clone(), d = o.clone();
|
|
1378
|
+
d.setLocalMatrix(a);
|
|
1379
|
+
const y = s ? l.defaultSelectionStyle : l.defaultActiveStyle;
|
|
1380
|
+
d.setStyle(l.mergeStateStyle(d.getStyle(), y)), r.addNode(d);
|
|
1381
|
+
}), r.updateGlobalMatrix(), i.push(r), i;
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
|
-
class
|
|
1384
|
+
class q {
|
|
1385
1385
|
constructor(t) {
|
|
1386
1386
|
this._doc = t;
|
|
1387
1387
|
}
|
|
@@ -1403,9 +1403,9 @@ class X {
|
|
|
1403
1403
|
syncLoad(t) {
|
|
1404
1404
|
try {
|
|
1405
1405
|
const e = new S(this._doc, "open doc file");
|
|
1406
|
-
return e.canUndo = !1, this._clearDocument(), this._fillDocument(t), this._doc.filterElements().forEach((
|
|
1406
|
+
return e.canUndo = !1, this._clearDocument(), this._fillDocument(t), this._doc.filterElements().forEach((i) => i.onLoad()), e.commit(), !0;
|
|
1407
1407
|
} catch {
|
|
1408
|
-
|
|
1408
|
+
c.warn(!1, "parsing saved doc failed", "wg", "2026-03-30");
|
|
1409
1409
|
}
|
|
1410
1410
|
return !1;
|
|
1411
1411
|
}
|
|
@@ -1418,12 +1418,12 @@ class X {
|
|
|
1418
1418
|
const e = [];
|
|
1419
1419
|
if (t.doc) {
|
|
1420
1420
|
if (t.doc.forEach((s) => {
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1421
|
+
const i = this._doc.elementMgr.getElementClsByCtor(s.ctor);
|
|
1422
|
+
c.assert(i, `cant find element ctor ${s.ctor}`, "wg", "2026-03-30"), E.canCreate = !0;
|
|
1423
|
+
const r = new i();
|
|
1424
|
+
r.setDoc(this._doc), r.load(s), e.push(r), E.canCreate = !1;
|
|
1425
1425
|
}), e.forEach((s) => this._doc.elementMgr.add(s)), this._doc.transactionMgr.getCurrentUndoRedoEntity().onElementsAdded(e), e.length) {
|
|
1426
|
-
const s = Math.max(...e.map((
|
|
1426
|
+
const s = Math.max(...e.map((i) => i.id.asInt()));
|
|
1427
1427
|
this._doc.idPool.clearStableId(s);
|
|
1428
1428
|
}
|
|
1429
1429
|
return this._doc.id = t.id, e;
|
|
@@ -1432,7 +1432,7 @@ class X {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
const A = class A {
|
|
1434
1434
|
constructor() {
|
|
1435
|
-
this.isMainDoc = !1, this.idPool = new
|
|
1435
|
+
this.isMainDoc = !1, this.idPool = new k(), this.elementMgr = Z, this.requestMgr = Y, this._id = ut.uuid(), this.transactionMgr = new ft(), this.transactionMgr.init(this), this.requestMgr.init(this), this.modelView = new It(this);
|
|
1436
1436
|
}
|
|
1437
1437
|
get id() {
|
|
1438
1438
|
return this._id;
|
|
@@ -1446,16 +1446,16 @@ const A = class A {
|
|
|
1446
1446
|
e.setDoc(this);
|
|
1447
1447
|
let s = this.idPool.genId(e);
|
|
1448
1448
|
if (!s) {
|
|
1449
|
-
const
|
|
1450
|
-
this.elementMgr.getAllElementIds().forEach((
|
|
1449
|
+
const i = this.transactionMgr.idPoolGC();
|
|
1450
|
+
this.elementMgr.getAllElementIds().forEach((r) => i.add(r)), this.idPool.reset(i), s = this.idPool.genId(e);
|
|
1451
1451
|
}
|
|
1452
|
-
return
|
|
1452
|
+
return c.assert(s, "Id资源已耗尽", "wg", "2026-03-05"), e.id = s, A.canCreate = !1, c.assert(!this.getElementById(e.id), "该Id已存在", "wg", "2026-03-05"), e.isTemporary() || (this.checkIfCanModifyDoc(), this.transactionMgr.getCurrentUndoRedoEntity().onElementsAdded([e])), this.elementMgr.add(e), e;
|
|
1453
1453
|
}
|
|
1454
1454
|
deleteElementsById(...t) {
|
|
1455
1455
|
const e = this.getElementsByIds(t);
|
|
1456
1456
|
return e.length ? (e.some((s) => !s.isTemporary()) && (this.checkIfCanModifyDoc(), this.transactionMgr.getCurrentUndoRedoEntity().onElementsDeleted(e)), e.forEach((s) => {
|
|
1457
1457
|
this.elementMgr.delete(s.id.asInt());
|
|
1458
|
-
}), this.cacheForViewElementChanged(
|
|
1458
|
+
}), this.cacheForViewElementChanged(h.ELEMENT_DELETE, e), !0) : !1;
|
|
1459
1459
|
}
|
|
1460
1460
|
getElementById(t) {
|
|
1461
1461
|
const e = t instanceof m ? t.asInt() : t;
|
|
@@ -1463,13 +1463,13 @@ const A = class A {
|
|
|
1463
1463
|
}
|
|
1464
1464
|
getElementByIdEnsure(t) {
|
|
1465
1465
|
const e = t instanceof m ? t.asInt() : t, s = this.getElementById(e);
|
|
1466
|
-
return
|
|
1466
|
+
return c.assert(s, `${e}不存在`, "wg", "2026-03-05"), s;
|
|
1467
1467
|
}
|
|
1468
1468
|
getElementsByIds(t) {
|
|
1469
1469
|
const e = [];
|
|
1470
1470
|
return t.forEach((s) => {
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1471
|
+
const i = this.getElementById(s);
|
|
1472
|
+
i && e.push(i);
|
|
1473
1473
|
}), e;
|
|
1474
1474
|
}
|
|
1475
1475
|
// public getElementClsByCtor(ctor:string) {
|
|
@@ -1479,7 +1479,7 @@ const A = class A {
|
|
|
1479
1479
|
return t ? this.elementMgr.getAllElements().filter(t) : this.elementMgr.getAllElements();
|
|
1480
1480
|
}
|
|
1481
1481
|
checkIfCanModifyDoc() {
|
|
1482
|
-
|
|
1482
|
+
c.assert(this.transactionMgr.getCurrentTransaction(), "事务外不可修改文档", "wg", "2025-11-18");
|
|
1483
1483
|
}
|
|
1484
1484
|
cacheForViewElementChanged(t, e) {
|
|
1485
1485
|
this.modelView.cacheForView.cacheElementChanged(t, e);
|
|
@@ -1488,10 +1488,10 @@ const A = class A {
|
|
|
1488
1488
|
return this.modelView.updateView(t), !0;
|
|
1489
1489
|
}
|
|
1490
1490
|
dump() {
|
|
1491
|
-
return new
|
|
1491
|
+
return new q(this).dump();
|
|
1492
1492
|
}
|
|
1493
1493
|
load(t) {
|
|
1494
|
-
return new
|
|
1494
|
+
return new q(this).syncLoad(t), this;
|
|
1495
1495
|
}
|
|
1496
1496
|
// TODO 补充完整
|
|
1497
1497
|
destroy() {
|
|
@@ -1499,7 +1499,7 @@ const A = class A {
|
|
|
1499
1499
|
};
|
|
1500
1500
|
A.canCreate = !1;
|
|
1501
1501
|
let E = A;
|
|
1502
|
-
class
|
|
1502
|
+
class xt {
|
|
1503
1503
|
constructor() {
|
|
1504
1504
|
this._db = {}, this._cache = {};
|
|
1505
1505
|
}
|
|
@@ -1556,20 +1556,20 @@ class Ct {
|
|
|
1556
1556
|
for (const s of this.ownKeys()) {
|
|
1557
1557
|
if (s.startsWith(v.UNDER_SCORE) || s.startsWith(v.C_UNDER_SCORE))
|
|
1558
1558
|
continue;
|
|
1559
|
-
const
|
|
1560
|
-
if (
|
|
1561
|
-
if (Array.isArray(
|
|
1562
|
-
const o =
|
|
1563
|
-
e[s] = this._loadArr(
|
|
1564
|
-
} else if (
|
|
1565
|
-
e[s] = this._loadMap(
|
|
1566
|
-
else if (
|
|
1567
|
-
const o = [...
|
|
1568
|
-
e[s] = this._loadSet(
|
|
1569
|
-
} else if (this._isDumpLoad(
|
|
1570
|
-
const o = new
|
|
1571
|
-
o.load(
|
|
1572
|
-
} else
|
|
1559
|
+
const i = e[s], r = t[s];
|
|
1560
|
+
if (r != null)
|
|
1561
|
+
if (Array.isArray(i)) {
|
|
1562
|
+
const o = i[0];
|
|
1563
|
+
e[s] = this._loadArr(r, o);
|
|
1564
|
+
} else if (i instanceof Map)
|
|
1565
|
+
e[s] = this._loadMap(r, i);
|
|
1566
|
+
else if (i instanceof Set) {
|
|
1567
|
+
const o = [...i.values()];
|
|
1568
|
+
e[s] = this._loadSet(r, o);
|
|
1569
|
+
} else if (this._isDumpLoad(i)) {
|
|
1570
|
+
const o = new i.constructor();
|
|
1571
|
+
o.load(r), e[s] = o;
|
|
1572
|
+
} else i === b ? e[s] = W.load(r) : e[s] = r;
|
|
1573
1573
|
}
|
|
1574
1574
|
}
|
|
1575
1575
|
_dumpData(t) {
|
|
@@ -1577,34 +1577,34 @@ class Ct {
|
|
|
1577
1577
|
const e = new this.constructor();
|
|
1578
1578
|
E.canCreate = !1;
|
|
1579
1579
|
const s = {};
|
|
1580
|
-
return Object.keys(t).forEach((
|
|
1581
|
-
if (
|
|
1580
|
+
return Object.keys(t).forEach((i) => {
|
|
1581
|
+
if (i.startsWith(v.UNDER_SCORE) || i.startsWith(v.C_UNDER_SCORE))
|
|
1582
1582
|
return;
|
|
1583
|
-
const
|
|
1583
|
+
const r = e[i], o = t[i];
|
|
1584
1584
|
if (Array.isArray(o)) {
|
|
1585
|
-
const a = this._dumpArr(
|
|
1586
|
-
if (JSON.stringify(a) === JSON.stringify(
|
|
1587
|
-
s[
|
|
1585
|
+
const a = this._dumpArr(r), d = this._dumpArr(o);
|
|
1586
|
+
if (JSON.stringify(a) === JSON.stringify(d)) return;
|
|
1587
|
+
s[i] = d;
|
|
1588
1588
|
} else if (o instanceof Map) {
|
|
1589
|
-
const a = this._dumpMap(
|
|
1590
|
-
if (JSON.stringify(a) === JSON.stringify(
|
|
1591
|
-
s[
|
|
1589
|
+
const a = this._dumpMap(r), d = this._dumpMap(o);
|
|
1590
|
+
if (JSON.stringify(a) === JSON.stringify(d)) return;
|
|
1591
|
+
s[i] = d;
|
|
1592
1592
|
} else if (o instanceof Set) {
|
|
1593
|
-
const a = this._dumpSet(
|
|
1594
|
-
if (JSON.stringify(a) === JSON.stringify(
|
|
1595
|
-
s[
|
|
1593
|
+
const a = this._dumpSet(r), d = this._dumpSet(o);
|
|
1594
|
+
if (JSON.stringify(a) === JSON.stringify(d)) return;
|
|
1595
|
+
s[i] = d;
|
|
1596
1596
|
} else {
|
|
1597
|
-
const a = this._dumpAProperty(
|
|
1598
|
-
if (JSON.stringify(a) === JSON.stringify(
|
|
1599
|
-
s[
|
|
1597
|
+
const a = this._dumpAProperty(r), d = this._dumpAProperty(o);
|
|
1598
|
+
if (JSON.stringify(a) === JSON.stringify(d)) return;
|
|
1599
|
+
s[i] = d;
|
|
1600
1600
|
}
|
|
1601
1601
|
}), s;
|
|
1602
1602
|
}
|
|
1603
1603
|
_dumpArr(t) {
|
|
1604
1604
|
const e = [...t];
|
|
1605
1605
|
for (let s = 0; s < e.length; s += 1) {
|
|
1606
|
-
const
|
|
1607
|
-
|
|
1606
|
+
const i = t[s];
|
|
1607
|
+
i instanceof Array ? e[s] = this._dumpArr(i) : e[s] = this._dumpAProperty(i);
|
|
1608
1608
|
}
|
|
1609
1609
|
return e;
|
|
1610
1610
|
}
|
|
@@ -1617,16 +1617,16 @@ class Ct {
|
|
|
1617
1617
|
_loadArr(t, e) {
|
|
1618
1618
|
return t.length ? Array.isArray(e) ? t.map((s) => this._loadArr(s, e[0])) : t.map((s) => {
|
|
1619
1619
|
if (this._isDumpLoad(e)) {
|
|
1620
|
-
const
|
|
1621
|
-
return
|
|
1620
|
+
const i = e.constructor, r = new i();
|
|
1621
|
+
return r.load(s), r;
|
|
1622
1622
|
} else {
|
|
1623
|
-
if (e ===
|
|
1623
|
+
if (e === b)
|
|
1624
1624
|
return W.load(s);
|
|
1625
1625
|
{
|
|
1626
|
-
const
|
|
1627
|
-
if (
|
|
1626
|
+
const i = typeof s;
|
|
1627
|
+
if (i === "string" || i === "boolean" || i === "number")
|
|
1628
1628
|
return s;
|
|
1629
|
-
|
|
1629
|
+
c.assert(!1, "暂不支持的类型", "wg", "2026-03-29");
|
|
1630
1630
|
}
|
|
1631
1631
|
}
|
|
1632
1632
|
}) : [];
|
|
@@ -1634,8 +1634,8 @@ class Ct {
|
|
|
1634
1634
|
_dumpMap(t) {
|
|
1635
1635
|
const e = [...t];
|
|
1636
1636
|
for (let s = 0; s < e.length; s += 1) {
|
|
1637
|
-
const
|
|
1638
|
-
e[s] =
|
|
1637
|
+
const i = this._dumpArr(e[s]);
|
|
1638
|
+
e[s] = i;
|
|
1639
1639
|
}
|
|
1640
1640
|
return this._dumpArr(e);
|
|
1641
1641
|
}
|
|
@@ -1643,14 +1643,14 @@ class Ct {
|
|
|
1643
1643
|
* Map中的元素支持dump、load对象和基础元素类型
|
|
1644
1644
|
*/
|
|
1645
1645
|
_loadMap(t, e) {
|
|
1646
|
-
e.size ||
|
|
1646
|
+
e.size || c.assert(!1, "DB数据需要提供初始值", "wg", "2026-03-29");
|
|
1647
1647
|
const s = /* @__PURE__ */ new Map();
|
|
1648
|
-
for (const [
|
|
1649
|
-
const o = e.get(
|
|
1648
|
+
for (const [i, r] of t) {
|
|
1649
|
+
const o = e.get(i);
|
|
1650
1650
|
if (this._isDumpLoad(o)) {
|
|
1651
1651
|
const a = new o.constructor();
|
|
1652
|
-
a.load(
|
|
1653
|
-
} else this._isBasicType(o) ? s.set(
|
|
1652
|
+
a.load(r), s.set(i, a);
|
|
1653
|
+
} else this._isBasicType(o) ? s.set(i, r) : c.assert(!1, "不支持的类型", "wg", "2026-03-29");
|
|
1654
1654
|
}
|
|
1655
1655
|
return s;
|
|
1656
1656
|
}
|
|
@@ -1663,11 +1663,11 @@ class Ct {
|
|
|
1663
1663
|
*/
|
|
1664
1664
|
_loadSet(t, e) {
|
|
1665
1665
|
const s = /* @__PURE__ */ new Set();
|
|
1666
|
-
for (const
|
|
1666
|
+
for (const i of t)
|
|
1667
1667
|
if (this._isDumpLoad(e)) {
|
|
1668
|
-
const
|
|
1669
|
-
o.load(
|
|
1670
|
-
} else this._isBasicType(e) ? s.add(
|
|
1668
|
+
const r = e.constructor, o = new r();
|
|
1669
|
+
o.load(i), s.add(o);
|
|
1670
|
+
} else this._isBasicType(e) ? s.add(i) : c.assert(!1, "不支持的数据类型", "wg", "2026-03-29");
|
|
1671
1671
|
return s;
|
|
1672
1672
|
}
|
|
1673
1673
|
_dumpAProperty(t) {
|
|
@@ -1675,7 +1675,7 @@ class Ct {
|
|
|
1675
1675
|
return t;
|
|
1676
1676
|
if (this._isDumpLoad(t))
|
|
1677
1677
|
return t.dump();
|
|
1678
|
-
(t instanceof Array || t instanceof Map || t instanceof Set) &&
|
|
1678
|
+
(t instanceof Array || t instanceof Map || t instanceof Set) && c.assert(!1, "不支持的数据类型", "wg", "2026-03-27");
|
|
1679
1679
|
}
|
|
1680
1680
|
_isDumpLoad(t) {
|
|
1681
1681
|
return !!t && t.dump instanceof Function && t.load instanceof Function;
|
|
@@ -1685,9 +1685,9 @@ class Ct {
|
|
|
1685
1685
|
return e === "string" || e === "number" || e === "boolean";
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
|
-
class
|
|
1688
|
+
class Ct extends xt {
|
|
1689
1689
|
constructor() {
|
|
1690
|
-
super(), this.id = m.INVALID, this.name = "", this.visible = !0, this.C_GRep = g.empty,
|
|
1690
|
+
super(), this.id = m.INVALID, this.name = "", this.visible = !0, this.C_GRep = g.empty, c.assert(E.canCreate, "创建Element必须通过Document.create方法", "wg", "2025-11-18");
|
|
1691
1691
|
}
|
|
1692
1692
|
getDoc() {
|
|
1693
1693
|
return this._doc;
|
|
@@ -1726,7 +1726,7 @@ class xt extends Ct {
|
|
|
1726
1726
|
return new g();
|
|
1727
1727
|
const e = t.clone();
|
|
1728
1728
|
return e.traverse((s) => {
|
|
1729
|
-
s.setStyle(
|
|
1729
|
+
s.setStyle(l.mergeStateStyle(s.getStyle(), l.defaultSelectionStyle));
|
|
1730
1730
|
}), e;
|
|
1731
1731
|
}
|
|
1732
1732
|
getGRepWhenActive() {
|
|
@@ -1735,7 +1735,7 @@ class xt extends Ct {
|
|
|
1735
1735
|
return new g();
|
|
1736
1736
|
const e = t.clone();
|
|
1737
1737
|
return e.traverse((s) => {
|
|
1738
|
-
s.setStyle(
|
|
1738
|
+
s.setStyle(l.mergeStateStyle(s.getStyle(), l.defaultActiveStyle));
|
|
1739
1739
|
}), e;
|
|
1740
1740
|
}
|
|
1741
1741
|
/**
|
|
@@ -1764,7 +1764,7 @@ class xt extends Ct {
|
|
|
1764
1764
|
* 属性变化是否应该缓存到视图
|
|
1765
1765
|
*/
|
|
1766
1766
|
propShouldCacheToView(t) {
|
|
1767
|
-
return (t ===
|
|
1767
|
+
return (t === j.C_GREP || t === j.VISIBLE) && !this.dontShowView();
|
|
1768
1768
|
}
|
|
1769
1769
|
clone() {
|
|
1770
1770
|
const t = this._doc.create(this.constructor), e = this.dump();
|
|
@@ -1774,29 +1774,29 @@ class xt extends Ct {
|
|
|
1774
1774
|
this.markGRepDirty();
|
|
1775
1775
|
}
|
|
1776
1776
|
}
|
|
1777
|
-
const
|
|
1777
|
+
const bt = (n) => function(t) {
|
|
1778
1778
|
t.serializedId = {
|
|
1779
1779
|
ctor: n
|
|
1780
1780
|
}, Z.registerElement(n, t), E.canCreate = !0;
|
|
1781
1781
|
const e = new t();
|
|
1782
|
-
E.canCreate = !1, Object.keys(e).filter((
|
|
1783
|
-
Object.defineProperty(t.prototype,
|
|
1784
|
-
set(
|
|
1782
|
+
E.canCreate = !1, Object.keys(e).filter((i) => !i.startsWith("_")).forEach((i) => {
|
|
1783
|
+
Object.defineProperty(t.prototype, i, {
|
|
1784
|
+
set(r) {
|
|
1785
1785
|
const o = this.getDoc(), a = o?.getElementById(this.id);
|
|
1786
|
-
a ? (a.isTemporary() ? this.db[
|
|
1786
|
+
a ? (a.isTemporary() ? this.db[i] = r : (o.checkIfCanModifyDoc(), o.transactionMgr.getCurrentUndoRedoEntity().onElementsUpdated([a]), this.cache[i] = r), a.propShouldCacheToView(i) && o.cacheForViewElementChanged(h.ELEMENT_UPDATE, [a])) : this.db[i] = r;
|
|
1787
1787
|
},
|
|
1788
1788
|
get() {
|
|
1789
|
-
return this.cache[
|
|
1789
|
+
return this.cache[i] !== void 0 ? this.cache[i] : this.db[i];
|
|
1790
1790
|
}
|
|
1791
1791
|
});
|
|
1792
1792
|
});
|
|
1793
1793
|
};
|
|
1794
|
-
var
|
|
1795
|
-
for (var
|
|
1796
|
-
(o = n[
|
|
1797
|
-
return
|
|
1794
|
+
var Nt = Object.getOwnPropertyDescriptor, Dt = (n, t, e, s) => {
|
|
1795
|
+
for (var i = s > 1 ? void 0 : s ? Nt(t, e) : t, r = n.length - 1, o; r >= 0; r--)
|
|
1796
|
+
(o = n[r]) && (i = o(i) || i);
|
|
1797
|
+
return i;
|
|
1798
1798
|
};
|
|
1799
|
-
let
|
|
1799
|
+
let U = class extends Ct {
|
|
1800
1800
|
init() {
|
|
1801
1801
|
return this;
|
|
1802
1802
|
}
|
|
@@ -1807,16 +1807,16 @@ let F = class extends xt {
|
|
|
1807
1807
|
return !0;
|
|
1808
1808
|
}
|
|
1809
1809
|
};
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
],
|
|
1810
|
+
U = Dt([
|
|
1811
|
+
bt("7ac53d95-03ae-484d-9bfd-39755e145a8c")
|
|
1812
|
+
], U);
|
|
1813
1813
|
class Bt {
|
|
1814
1814
|
constructor(t) {
|
|
1815
|
-
this._tmpGRepRemoved = !1, this._doc = t, this._tmpElementId = this._doc.create(
|
|
1815
|
+
this._tmpGRepRemoved = !1, this._doc = t, this._tmpElementId = this._doc.create(U).init().id;
|
|
1816
1816
|
}
|
|
1817
1817
|
get tmpElement() {
|
|
1818
1818
|
const t = this._doc.getElementById(this._tmpElementId);
|
|
1819
|
-
return
|
|
1819
|
+
return c.assert(t, "ele为空", "wg", "2026-03-15"), t;
|
|
1820
1820
|
}
|
|
1821
1821
|
/**
|
|
1822
1822
|
* 绘制临时元素
|
|
@@ -1837,7 +1837,7 @@ class Bt {
|
|
|
1837
1837
|
this.clearTmp(), this._doc.deleteElementsById(this._tmpElementId);
|
|
1838
1838
|
}
|
|
1839
1839
|
}
|
|
1840
|
-
class
|
|
1840
|
+
class C extends N {
|
|
1841
1841
|
constructor(t, e) {
|
|
1842
1842
|
super(), this.plane = t.clone(), this.geo = e;
|
|
1843
1843
|
}
|
|
@@ -1845,12 +1845,12 @@ class x extends D {
|
|
|
1845
1845
|
return super._copyFrom(t), this;
|
|
1846
1846
|
}
|
|
1847
1847
|
}
|
|
1848
|
-
class nt extends
|
|
1848
|
+
class nt extends C {
|
|
1849
1849
|
constructor(t, e) {
|
|
1850
1850
|
super(t, e);
|
|
1851
1851
|
}
|
|
1852
1852
|
setStyle(t) {
|
|
1853
|
-
return super.setStyle(t), this._renderNode && (this._renderNode.style =
|
|
1853
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = l.getLineStyle(this.getStyle())), this;
|
|
1854
1854
|
}
|
|
1855
1855
|
getType() {
|
|
1856
1856
|
return w.GCurve2d;
|
|
@@ -1861,7 +1861,7 @@ class nt extends x {
|
|
|
1861
1861
|
// 当前最小化版本未保留 style 体系,因此这里只保留离散后的点数据。
|
|
1862
1862
|
_toRenderNodeWithoutMatrix(t) {
|
|
1863
1863
|
const e = new tt();
|
|
1864
|
-
return e.points = this.geo.discrete(t).map((s) => this.plane.getPtAt(s)), e.style =
|
|
1864
|
+
return e.points = this.geo.discrete(t).map((s) => this.plane.getPtAt(s)), e.style = l.getLineStyle(this.getStyle()), e;
|
|
1865
1865
|
}
|
|
1866
1866
|
// 将二维曲线离散并映射为三维顺序点列。
|
|
1867
1867
|
discrete(t) {
|
|
@@ -1871,37 +1871,37 @@ class nt extends x {
|
|
|
1871
1871
|
return new nt(this.plane, t ? this.geo.clone() : this.geo)._copyFrom(this);
|
|
1872
1872
|
}
|
|
1873
1873
|
}
|
|
1874
|
-
class ot extends
|
|
1874
|
+
class ot extends C {
|
|
1875
1875
|
constructor(t, e) {
|
|
1876
1876
|
super(t, e);
|
|
1877
1877
|
}
|
|
1878
1878
|
setStyle(t) {
|
|
1879
|
-
return super.setStyle(t), this._renderNode && (this._renderNode.style =
|
|
1879
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = l.getLineStyle(this.getStyle())), this;
|
|
1880
1880
|
}
|
|
1881
1881
|
getType() {
|
|
1882
1882
|
return w.GPolycurve;
|
|
1883
1883
|
}
|
|
1884
1884
|
_toRenderNodeWithoutMatrix(t) {
|
|
1885
1885
|
const e = new tt(), s = J.DiscreteTopology.discretePolyline(this.geo, t);
|
|
1886
|
-
return this.geo.getType() === pt.LOOP && s.length > 0 && s.push(s[0].clone()), e.points = s.map((
|
|
1886
|
+
return this.geo.getType() === pt.LOOP && s.length > 0 && s.push(s[0].clone()), e.points = s.map((i) => this.plane.getPtAt(i)), e.style = l.getLineStyle(this.getStyle()), e;
|
|
1887
1887
|
}
|
|
1888
1888
|
clone(t) {
|
|
1889
1889
|
return new ot(this.plane, t ? this.geo.clone() : this.geo)._copyFrom(this);
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
|
-
class at extends
|
|
1892
|
+
class at extends C {
|
|
1893
1893
|
constructor(t, e) {
|
|
1894
1894
|
super(t, e);
|
|
1895
1895
|
}
|
|
1896
1896
|
setStyle(t) {
|
|
1897
|
-
return super.setStyle(t), this._renderNode && (this._renderNode.style =
|
|
1897
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = l.getPointStyle(this.getStyle())), this;
|
|
1898
1898
|
}
|
|
1899
1899
|
getType() {
|
|
1900
1900
|
return w.GPoint2d;
|
|
1901
1901
|
}
|
|
1902
1902
|
_toRenderNodeWithoutMatrix() {
|
|
1903
1903
|
const t = new gt();
|
|
1904
|
-
return t.point = this.plane.getPtAt(this.geo), t.style =
|
|
1904
|
+
return t.point = this.plane.getPtAt(this.geo), t.style = l.getPointStyle(this.getStyle()), t;
|
|
1905
1905
|
}
|
|
1906
1906
|
// 返回当前二维点映射到平面后的三维坐标。
|
|
1907
1907
|
getPoint() {
|
|
@@ -1911,12 +1911,12 @@ class at extends x {
|
|
|
1911
1911
|
return new at(this.plane, t ? this.geo.clone() : this.geo)._copyFrom(this);
|
|
1912
1912
|
}
|
|
1913
1913
|
}
|
|
1914
|
-
class
|
|
1914
|
+
class ct extends C {
|
|
1915
1915
|
constructor(t, e) {
|
|
1916
1916
|
super(t, e);
|
|
1917
1917
|
}
|
|
1918
1918
|
setStyle(t) {
|
|
1919
|
-
return super.setStyle(t), this._renderNode && (this._renderNode.style =
|
|
1919
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = l.getFaceStyle(this.getStyle())), this;
|
|
1920
1920
|
}
|
|
1921
1921
|
getType() {
|
|
1922
1922
|
return w.GPolygon;
|
|
@@ -1927,39 +1927,39 @@ class dt extends x {
|
|
|
1927
1927
|
toRenderNodeForActive(t) {
|
|
1928
1928
|
const e = new yt();
|
|
1929
1929
|
try {
|
|
1930
|
-
const s = J.DiscreteTopology.tessPolygon(this.geo, t), { vertices:
|
|
1930
|
+
const s = J.DiscreteTopology.tessPolygon(this.geo, t), { vertices: i, faces: r } = s;
|
|
1931
1931
|
e.setVerts(
|
|
1932
|
-
|
|
1933
|
-
),
|
|
1932
|
+
i.map((a) => this.plane.getPtAt(a))
|
|
1933
|
+
), r && e.setIndices(new Uint32Array(r));
|
|
1934
1934
|
const o = [];
|
|
1935
|
-
for (let a = 0; a <
|
|
1935
|
+
for (let a = 0; a < i.length; a++)
|
|
1936
1936
|
o.push(this.plane.getNorm());
|
|
1937
1937
|
e.setNormals(o);
|
|
1938
1938
|
} catch (s) {
|
|
1939
|
-
console.error(s),
|
|
1939
|
+
console.error(s), c.warn(!1, "invalid gface", "wg", "2026-03-13");
|
|
1940
1940
|
}
|
|
1941
|
-
return e.style =
|
|
1941
|
+
return e.style = l.getFaceStyle(this.getStyle()), e;
|
|
1942
1942
|
}
|
|
1943
1943
|
clone(t) {
|
|
1944
|
-
return new
|
|
1944
|
+
return new ct(this.plane.clone(), t ? this.geo.clone() : this.geo)._copyFrom(this);
|
|
1945
1945
|
}
|
|
1946
1946
|
}
|
|
1947
|
-
class
|
|
1947
|
+
class dt extends C {
|
|
1948
1948
|
constructor(t, e, s) {
|
|
1949
1949
|
super(e, $.rO()), this.text = t, this.position = $.O(), s && (this.position = s);
|
|
1950
1950
|
}
|
|
1951
1951
|
setStyle(t) {
|
|
1952
|
-
return super.setStyle(t), this._renderNode && (this._renderNode.style =
|
|
1952
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = l.getTextStyle(this.getStyle())), this;
|
|
1953
1953
|
}
|
|
1954
1954
|
getType() {
|
|
1955
1955
|
return w.GText2d;
|
|
1956
1956
|
}
|
|
1957
1957
|
_toRenderNodeWithoutMatrix() {
|
|
1958
1958
|
const t = new mt();
|
|
1959
|
-
return t.text = this.text, t.position = this.position.toXYZ(), t.style =
|
|
1959
|
+
return t.text = this.text, t.position = this.position.toXYZ(), t.style = l.getTextStyle(this.getStyle()), t;
|
|
1960
1960
|
}
|
|
1961
1961
|
clone() {
|
|
1962
|
-
const t = new
|
|
1962
|
+
const t = new dt(this.text, this.plane.clone(), this.position);
|
|
1963
1963
|
return t._copyFrom(this), t;
|
|
1964
1964
|
}
|
|
1965
1965
|
}
|
|
@@ -1983,7 +1983,7 @@ class zt {
|
|
|
1983
1983
|
}), e) : (e.push(t), e);
|
|
1984
1984
|
}
|
|
1985
1985
|
}
|
|
1986
|
-
class
|
|
1986
|
+
class lt {
|
|
1987
1987
|
setDoc(t) {
|
|
1988
1988
|
this._doc = t;
|
|
1989
1989
|
}
|
|
@@ -1994,17 +1994,17 @@ class ht {
|
|
|
1994
1994
|
return !0;
|
|
1995
1995
|
}
|
|
1996
1996
|
}
|
|
1997
|
-
function
|
|
1997
|
+
function ht(n) {
|
|
1998
1998
|
return (t) => {
|
|
1999
1999
|
Y.registerRequest(n, t);
|
|
2000
2000
|
};
|
|
2001
2001
|
}
|
|
2002
|
-
var
|
|
2003
|
-
for (var
|
|
2004
|
-
(o = n[
|
|
2005
|
-
return
|
|
2002
|
+
var Vt = Object.getOwnPropertyDescriptor, Pt = (n, t, e, s) => {
|
|
2003
|
+
for (var i = s > 1 ? void 0 : s ? Vt(t, e) : t, r = n.length - 1, o; r >= 0; r--)
|
|
2004
|
+
(o = n[r]) && (i = o(i) || i);
|
|
2005
|
+
return i;
|
|
2006
2006
|
};
|
|
2007
|
-
let
|
|
2007
|
+
let X = class extends lt {
|
|
2008
2008
|
execute() {
|
|
2009
2009
|
this._doc.transactionMgr.undo(), this._doc.updateView();
|
|
2010
2010
|
}
|
|
@@ -2012,15 +2012,15 @@ let j = class extends ht {
|
|
|
2012
2012
|
return !1;
|
|
2013
2013
|
}
|
|
2014
2014
|
};
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
],
|
|
2018
|
-
var
|
|
2019
|
-
for (var
|
|
2020
|
-
(o = n[
|
|
2021
|
-
return
|
|
2015
|
+
X = Pt([
|
|
2016
|
+
ht(B.UNDO)
|
|
2017
|
+
], X);
|
|
2018
|
+
var kt = Object.getOwnPropertyDescriptor, Gt = (n, t, e, s) => {
|
|
2019
|
+
for (var i = s > 1 ? void 0 : s ? kt(t, e) : t, r = n.length - 1, o; r >= 0; r--)
|
|
2020
|
+
(o = n[r]) && (i = o(i) || i);
|
|
2021
|
+
return i;
|
|
2022
2022
|
};
|
|
2023
|
-
let K = class extends
|
|
2023
|
+
let K = class extends lt {
|
|
2024
2024
|
execute() {
|
|
2025
2025
|
this._doc.transactionMgr.redo(), this._doc.updateView();
|
|
2026
2026
|
}
|
|
@@ -2028,53 +2028,125 @@ let K = class extends ht {
|
|
|
2028
2028
|
return !1;
|
|
2029
2029
|
}
|
|
2030
2030
|
};
|
|
2031
|
-
K =
|
|
2032
|
-
|
|
2031
|
+
K = Gt([
|
|
2032
|
+
ht(B.REDO)
|
|
2033
2033
|
], K);
|
|
2034
|
+
class Wt {
|
|
2035
|
+
constructor(t) {
|
|
2036
|
+
this.subject = t, this._callbacks = [];
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* 事件触发
|
|
2040
|
+
* @param 事件参数
|
|
2041
|
+
*/
|
|
2042
|
+
dispatch(t) {
|
|
2043
|
+
const e = {
|
|
2044
|
+
data: t,
|
|
2045
|
+
subject: this.subject
|
|
2046
|
+
};
|
|
2047
|
+
for (const s of this._callbacks)
|
|
2048
|
+
try {
|
|
2049
|
+
s.listener ? s.fn.call(s.listener, e) : s.fn(e);
|
|
2050
|
+
} catch (i) {
|
|
2051
|
+
console.error(i, "signal error");
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
listen(t, e) {
|
|
2055
|
+
this.getCallbackIndex(t, e) < 0 && this._callbacks.push({ fn: t, listener: e });
|
|
2056
|
+
}
|
|
2057
|
+
unlisten(t, e) {
|
|
2058
|
+
const s = this.getCallbackIndex(t, e);
|
|
2059
|
+
s >= 0 && this._callbacks.splice(s, 1);
|
|
2060
|
+
}
|
|
2061
|
+
unlistenAll() {
|
|
2062
|
+
this._callbacks.length = 0;
|
|
2063
|
+
}
|
|
2064
|
+
dispose() {
|
|
2065
|
+
this.unlistenAll(), this.subject = void 0;
|
|
2066
|
+
}
|
|
2067
|
+
getCallbackIndex(t, e) {
|
|
2068
|
+
return this._callbacks.findIndex((s) => s.fn === t && s.listener === e);
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
class $t {
|
|
2072
|
+
constructor(t) {
|
|
2073
|
+
this._callbacksMap = /* @__PURE__ */ new Map(), this._listener = t;
|
|
2074
|
+
}
|
|
2075
|
+
get listener() {
|
|
2076
|
+
return this._listener;
|
|
2077
|
+
}
|
|
2078
|
+
listen(t, e) {
|
|
2079
|
+
t.listen(e, this._listener);
|
|
2080
|
+
let s = this._callbacksMap.get(t);
|
|
2081
|
+
return s || (s = [], this._callbacksMap.set(t, s)), s.push(e), this;
|
|
2082
|
+
}
|
|
2083
|
+
unlisten(t, e) {
|
|
2084
|
+
const s = this._callbacksMap.get(t) || [], i = e ? [e] : s.slice();
|
|
2085
|
+
for (const r of i) {
|
|
2086
|
+
t.unlisten(r, this._listener);
|
|
2087
|
+
const o = s.indexOf(r);
|
|
2088
|
+
o >= 0 && s.splice(o, 1);
|
|
2089
|
+
}
|
|
2090
|
+
return s.length === 0 && this._callbacksMap.delete(t), this;
|
|
2091
|
+
}
|
|
2092
|
+
unlistenAll() {
|
|
2093
|
+
for (const t of this._callbacksMap.keys()) {
|
|
2094
|
+
const e = this._callbacksMap.get(t) || [];
|
|
2095
|
+
for (const s of e)
|
|
2096
|
+
t.unlisten(s, this._listener);
|
|
2097
|
+
}
|
|
2098
|
+
return this._callbacksMap.clear(), this;
|
|
2099
|
+
}
|
|
2100
|
+
dispose() {
|
|
2101
|
+
this.unlistenAll(), this._listener = void 0;
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2034
2104
|
export {
|
|
2035
|
-
|
|
2105
|
+
Ct as CElement,
|
|
2036
2106
|
H as ClassManager,
|
|
2037
|
-
|
|
2038
|
-
|
|
2107
|
+
Ft as DBGenerator,
|
|
2108
|
+
c as DebugUtil,
|
|
2039
2109
|
Tt as DisplayObject,
|
|
2040
2110
|
L as DisplayObjectMgr,
|
|
2041
2111
|
E as Document,
|
|
2042
|
-
|
|
2043
|
-
|
|
2112
|
+
it as EN_AnchorX,
|
|
2113
|
+
rt as EN_AnchorY,
|
|
2044
2114
|
B as EN_CoreRequestIds,
|
|
2045
|
-
|
|
2115
|
+
h as EN_ModelViewChanged,
|
|
2046
2116
|
I as EN_RNODE_TYPE,
|
|
2047
|
-
|
|
2117
|
+
Ct as Element,
|
|
2048
2118
|
m as ElementId,
|
|
2049
|
-
|
|
2119
|
+
F as ElementMgr,
|
|
2050
2120
|
nt as GCurve2d,
|
|
2051
|
-
|
|
2121
|
+
D as GGroup,
|
|
2052
2122
|
w as GNODE_TYPE,
|
|
2053
|
-
|
|
2054
|
-
|
|
2123
|
+
N as GNode,
|
|
2124
|
+
C as GNode2d,
|
|
2055
2125
|
at as GPoint2d,
|
|
2056
2126
|
ot as GPolycurve,
|
|
2057
|
-
|
|
2127
|
+
ct as GPolygon,
|
|
2058
2128
|
g as GRep,
|
|
2059
|
-
|
|
2060
|
-
|
|
2129
|
+
dt as GText2d,
|
|
2130
|
+
G as GrepDisplay,
|
|
2061
2131
|
Ot as IRender,
|
|
2062
|
-
|
|
2132
|
+
b as MathSymbol,
|
|
2063
2133
|
It as ModelView,
|
|
2064
2134
|
K as RedoRequest,
|
|
2065
|
-
|
|
2135
|
+
bt as RegisterElement,
|
|
2066
2136
|
tt as RenderEdge,
|
|
2067
2137
|
z as RenderGroup,
|
|
2068
2138
|
yt as RenderMesh,
|
|
2069
|
-
|
|
2139
|
+
x as RenderNode,
|
|
2070
2140
|
zt as RenderNodeUtil,
|
|
2071
2141
|
gt as RenderPoint,
|
|
2072
2142
|
mt as RenderText,
|
|
2073
|
-
|
|
2143
|
+
lt as Request,
|
|
2074
2144
|
O as RequestMgr,
|
|
2075
|
-
|
|
2145
|
+
Wt as Signal,
|
|
2146
|
+
$t as SignalHook,
|
|
2147
|
+
U as TmpElement,
|
|
2076
2148
|
Bt as TmpElementPainter,
|
|
2077
|
-
|
|
2078
|
-
|
|
2149
|
+
X as UndoRequest,
|
|
2150
|
+
ht as registerRequest,
|
|
2079
2151
|
Y as requestMgr
|
|
2080
2152
|
};
|