@ccpc/platform 0.1.11 → 0.1.12

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 CHANGED
@@ -78,13 +78,13 @@ class N extends V {
78
78
  * 获取画布
79
79
  */
80
80
  getCanvas() {
81
- return p.getCanvas();
81
+ return d.getCanvas();
82
82
  }
83
83
  /**
84
84
  * 获取文档
85
85
  */
86
86
  getDoc() {
87
- return p.doc;
87
+ return d.doc;
88
88
  }
89
89
  /**
90
90
  * 执行动作
@@ -161,6 +161,7 @@ class N extends V {
161
161
  * 清除所有绘制的临时元素
162
162
  */
163
163
  clearTmp() {
164
+ d.highLight.clear();
164
165
  for (const e of this._tmpElementPainters)
165
166
  e && e.clearTmp();
166
167
  }
@@ -174,7 +175,7 @@ class N extends V {
174
175
  * 结束cmd
175
176
  */
176
177
  _resolve(e) {
177
- this._status.finish || (this._status.finish = !0, this._status.resolve(e), this.onDestroy());
178
+ this.clearTmp(), !this._status.finish && (this._status.finish = !0, this._status.resolve(e), this.onDestroy());
178
179
  }
179
180
  onKeyDown(e) {
180
181
  return e.domEvent.key === "Escape" ? (this.cancel(), !0) : !1;
@@ -209,17 +210,17 @@ class T {
209
210
  class Z extends N {
210
211
  onMouseMove(e) {
211
212
  const t = T.pickGNode(this.getCanvas(), e.pos);
212
- return t ? (p.highLight.reset([t]), this._updateView(), !1) : (p.highLight.clear(), this._updateView(), !1);
213
+ return t ? (d.highLight.reset([t]), this._updateView(), !1) : (d.highLight.clear(), this._updateView(), !1);
213
214
  }
214
215
  onClick(e) {
215
216
  const t = T.pickGNode(this.getCanvas(), e.pos);
216
- return p.highLight.clear(), !t && !e.fnKey.ctrlKey ? (p.selection.clear(), this._updateView(), !1) : (t && (e.fnKey.ctrlKey ? p.selection.add([t]) : p.selection.reset([t]), this._updateView()), !1);
217
+ return d.highLight.clear(), !t && !e.fnKey.ctrlKey ? (d.selection.clear(), this._updateView(), !1) : (t && (e.fnKey.ctrlKey ? d.selection.add([t]) : d.selection.reset([t]), this._updateView()), !1);
217
218
  }
218
219
  onRButtonDown(e) {
219
- return p.highLight.clear(), p.selection.clear(), this._updateView(), !1;
220
+ return d.highLight.clear(), d.selection.clear(), this._updateView(), !1;
220
221
  }
221
222
  onKeyDown(e) {
222
- return e.domEvent.key !== "Escape" ? !1 : (p.highLight.clear(), p.selection.clear(), this._updateView(), !0);
223
+ return e.domEvent.key !== "Escape" ? !1 : (d.highLight.clear(), d.selection.clear(), this._updateView(), !0);
223
224
  }
224
225
  }
225
226
  class A {
@@ -408,7 +409,7 @@ class G {
408
409
  return this._curCanvas = s, this._curDoc && this._curCanvas.resetModelView(this._curDoc.modelView), this._curCanvas.startListening(), s;
409
410
  }
410
411
  }
411
- const p = G.instance();
412
+ const d = G.instance();
412
413
  var C = /* @__PURE__ */ ((n) => (n[n.OK = 0] = "OK", n[n.CANCEL = 1] = "CANCEL", n))(C || {});
413
414
  class L {
414
415
  constructor(e, t) {
@@ -514,7 +515,7 @@ class h {
514
515
  return t;
515
516
  }
516
517
  }
517
- var d = /* @__PURE__ */ ((n) => (n[n.POINT_ON_FACE = 1842204] = "POINT_ON_FACE", n[n.END_POINT = 4063173] = "END_POINT", n[n.POINT_ON_CURVE = 1842204] = "POINT_ON_CURVE", n[n.MIDDLE_POINT = 4063173] = "MIDDLE_POINT", n[n.PARALLEL_TO_AXIS = 4063173] = "PARALLEL_TO_AXIS", n[n.INTERSECT_POINT = 4063173] = "INTERSECT_POINT", n[n.VERTICAL_PARALLEL = 4063173] = "VERTICAL_PARALLEL", n))(d || {});
518
+ var p = /* @__PURE__ */ ((n) => (n[n.POINT_ON_FACE = 1842204] = "POINT_ON_FACE", n[n.END_POINT = 4063173] = "END_POINT", n[n.POINT_ON_CURVE = 1842204] = "POINT_ON_CURVE", n[n.MIDDLE_POINT = 4063173] = "MIDDLE_POINT", n[n.PARALLEL_TO_AXIS = 4063173] = "PARALLEL_TO_AXIS", n[n.INTERSECT_POINT = 4063173] = "INTERSECT_POINT", n[n.VERTICAL_PARALLEL = 4063173] = "VERTICAL_PARALLEL", n))(p || {});
518
519
  const H = 200;
519
520
  function se(n, e) {
520
521
  if (!y.instance().canSnapHelperObject || !n?.pickedGNodes?.length)
@@ -588,7 +589,7 @@ function I(n, e) {
588
589
  for (const s of n.getSnappedObjects())
589
590
  if (s instanceof m && s.userData?.snapType === a.ReferCurve && s.userData?.lastPickedPt) {
590
591
  const i = s.userData.lastPickedPt, r = new m(i, n.snappedPt);
591
- let c = d.PARALLEL_TO_AXIS;
592
+ let c = p.PARALLEL_TO_AXIS;
592
593
  const l = r.getDirection();
593
594
  l.isParallel(P.X()) ? c = 16711680 : l.isParallel(P.Y()) && (c = 65280);
594
595
  const o = new S(t, r);
@@ -601,7 +602,7 @@ function I(n, e) {
601
602
  const g = new R(t, i.clone());
602
603
  g.setStyle({
603
604
  point: {
604
- color: d.PARALLEL_TO_AXIS,
605
+ color: p.PARALLEL_TO_AXIS,
605
606
  size: 6
606
607
  }
607
608
  }), e.addNode(g);
@@ -609,7 +610,7 @@ function I(n, e) {
609
610
  const i = s.userData.refCurve, r = new S(t, i);
610
611
  r.setStyle({
611
612
  line: {
612
- color: d.VERTICAL_PARALLEL
613
+ color: p.VERTICAL_PARALLEL
613
614
  }
614
615
  }), e.addNode(r);
615
616
  }
@@ -642,38 +643,38 @@ class ce {
642
643
  if (!(t instanceof x))
643
644
  return;
644
645
  const s = new U();
645
- let i = d.POINT_ON_FACE;
646
+ let i = p.POINT_ON_FACE;
646
647
  switch (t.getSnapType()) {
647
648
  case a.Pole:
648
649
  case a.EndPoint:
649
- i = d.END_POINT;
650
+ i = p.END_POINT;
650
651
  break;
651
652
  case a.MiddlePoint:
652
653
  case a.Center:
653
- i = d.MIDDLE_POINT;
654
+ i = p.MIDDLE_POINT;
654
655
  break;
655
656
  case a.ExtensionPoint:
656
657
  case a.ParallelToX:
657
658
  case a.ParallelToY:
658
- i = d.PARALLEL_TO_AXIS;
659
+ i = p.PARALLEL_TO_AXIS;
659
660
  break;
660
661
  case a.PointOnCurve:
661
- i = d.POINT_ON_CURVE;
662
+ i = p.POINT_ON_CURVE;
662
663
  break;
663
664
  case a.ClosedLineParallelToX:
664
665
  case a.ClosedLineParallelToY:
665
- i = d.PARALLEL_TO_AXIS;
666
+ i = p.PARALLEL_TO_AXIS;
666
667
  break;
667
668
  case a.XPt:
668
- i = d.INTERSECT_POINT;
669
+ i = p.INTERSECT_POINT;
669
670
  break;
670
671
  case a.ReferCurve:
671
- I(t, s), i = d.POINT_ON_CURVE;
672
+ I(t, s), i = p.POINT_ON_CURVE;
672
673
  break;
673
674
  case a.PerpendicularPoint:
674
675
  case a.ParallelToCurve:
675
676
  case a.VerticalToCurve:
676
- I(t, s), i = d.VERTICAL_PARALLEL;
677
+ I(t, s), i = p.VERTICAL_PARALLEL;
677
678
  break;
678
679
  }
679
680
  if (t.anotherSnapType)
@@ -787,7 +788,7 @@ export {
787
788
  ce as RunSnapUtil,
788
789
  f as Selection,
789
790
  h as SnapHelpMgr,
790
- p as app,
791
+ d as app,
791
792
  Q as cmdMgr,
792
793
  se as createReferenceCurves,
793
794
  ne as createReferenceDirs,
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@ccpc/platform",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Platform command interaction layer for editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./index.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "peerDependencies": {
10
- "@ccpc/canvas": "^0.1.11",
11
- "@ccpc/core": "^0.1.14",
12
- "@ccpc/math": "^0.1.17",
13
- "@ccpc/snap": "^0.1.11"
10
+ "@ccpc/canvas": "^0.1.12",
11
+ "@ccpc/core": "^0.1.15",
12
+ "@ccpc/math": "^0.1.18",
13
+ "@ccpc/snap": "^0.1.12"
14
14
  }
15
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cmd_action_controller.d.ts","sourceRoot":"","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