@ccpc/platform 0.1.9 → 0.1.11

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
@@ -1,6 +1,6 @@
1
1
  import { DefaultController as V, CCanvas as b } from "@ccpc/canvas";
2
2
  import { ClassManager as O, DebugUtil as E, TmpElementPainter as M, GPoint2d as R, GCurve2d as S, GPolycurve as B, GPolygon as F, GText2d as K, ElementId as X, GNODE_TYPE as D, GRep as U } from "@ccpc/core";
3
- import { Ln2 as P, Vec2 as m, CONST as w, alg as j, Arc2 as z, Plane as W, Vec3 as q } from "@ccpc/math";
3
+ import { Ln2 as m, Vec2 as P, CONST as w, alg as j, Arc2 as z, Plane as W, Vec3 as q } from "@ccpc/math";
4
4
  import { SnapSetting as y, EN_SNAP_TYPE as a, EN_SNAP_HELP_OBJ as v, SnapEngine as Y, SnapCandidates as J, PtSnap as x, SnapContext as $ } from "@ccpc/snap";
5
5
  class k {
6
6
  constructor() {
@@ -379,6 +379,9 @@ class G {
379
379
  constructor() {
380
380
  this._cmdMgr = Q, this.selection = f.instance(), this.highLight = u.instance();
381
381
  }
382
+ get cmdMgr() {
383
+ return this._cmdMgr;
384
+ }
382
385
  static instance() {
383
386
  return this._instance || (this._instance = new G()), this._instance;
384
387
  }
@@ -518,9 +521,9 @@ function se(n, e) {
518
521
  return;
519
522
  const t = (/* @__PURE__ */ new Date()).getTime();
520
523
  if (n && (n.snapType === a.MiddlePoint || n.snapType === a.EndPoint) && t - e > H && n.pickedPlane) {
521
- const s = n.pickedPlane.getUVAt(n.point), i = new P(s, m.X(), [-w.MODEL_MAX_LENGTH, w.MODEL_MAX_LENGTH]);
524
+ const s = n.pickedPlane.getUVAt(n.point), i = new m(s, P.X(), [-w.MODEL_MAX_LENGTH, w.MODEL_MAX_LENGTH]);
522
525
  i.userData = { snapType: a.ReferCurve, lastPickedPt: s.clone() };
523
- const r = new P(s, m.Y(), [-w.MODEL_MAX_LENGTH, w.MODEL_MAX_LENGTH]);
526
+ const r = new m(s, P.Y(), [-w.MODEL_MAX_LENGTH, w.MODEL_MAX_LENGTH]);
524
527
  r.userData = { snapType: a.ReferCurve, lastPickedPt: s.clone() }, h.instance().addSnapHelperCurves(_.BRIEF, [i, r]);
525
528
  }
526
529
  }
@@ -532,18 +535,18 @@ function ne(n, e, t) {
532
535
  return;
533
536
  const i = n.pickedGNodes[0];
534
537
  let r;
535
- if (i.getType() === D.GCurve2d && i.geo instanceof P)
538
+ if (i.getType() === D.GCurve2d && i.geo instanceof m)
536
539
  r = i.geo;
537
540
  else if (i.getType() === D.GPolycurve) {
538
541
  const g = i.geo.getAllCurves();
539
- g.length === 1 && g[0] instanceof P && (r = g[0]);
542
+ g.length === 1 && g[0] instanceof m && (r = g[0]);
540
543
  }
541
544
  if (!r)
542
545
  return;
543
546
  const c = r.getDirection().clone();
544
547
  if (c.userData = { refCurve: r }, h.instance().addSnapHelperDirs(_.BRIEF, c), !t)
545
548
  return;
546
- const l = new m();
549
+ const l = new P();
547
550
  if (j.D.ptToCurve2d(t, r, l), l.equals(t))
548
551
  return;
549
552
  const o = l.subtracted(t).normalize();
@@ -583,11 +586,11 @@ function I(n, e) {
583
586
  return;
584
587
  const t = W.XOY();
585
588
  for (const s of n.getSnappedObjects())
586
- if (s instanceof P && s.userData?.snapType === a.ReferCurve && s.userData?.lastPickedPt) {
587
- const i = s.userData.lastPickedPt, r = new P(i, n.snappedPt);
589
+ if (s instanceof m && s.userData?.snapType === a.ReferCurve && s.userData?.lastPickedPt) {
590
+ const i = s.userData.lastPickedPt, r = new m(i, n.snappedPt);
588
591
  let c = d.PARALLEL_TO_AXIS;
589
592
  const l = r.getDirection();
590
- l.isParallel(m.X()) ? c = 16711680 : l.isParallel(m.Y()) && (c = 65280);
593
+ l.isParallel(P.X()) ? c = 16711680 : l.isParallel(P.Y()) && (c = 65280);
591
594
  const o = new S(t, r);
592
595
  o.setStyle({
593
596
  line: {
@@ -688,7 +691,7 @@ class ce {
688
691
  }
689
692
  class ue extends te {
690
693
  constructor(e = new ae()) {
691
- super(), this._currentMousePos = m.O(), this._hoverSnappedPtTime = Date.now(), this._hoverPickedGNodeTime = Date.now(), this._context = e, e.snapContext && e.snapContext.addSnapHelpers(
694
+ super(), this._currentMousePos = P.O(), this._hoverSnappedPtTime = Date.now(), this._hoverPickedGNodeTime = Date.now(), this._context = e, e.snapContext && e.snapContext.addSnapHelpers(
692
695
  v.POINT,
693
696
  h.instance().getAllSnapHelperPoints()
694
697
  );
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@ccpc/platform",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Platform command interaction layer for editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./index.js",
8
+ "types": "./types/index.d.ts",
8
9
  "peerDependencies": {
9
- "@ccpc/canvas": "^0.1.9",
10
- "@ccpc/core": "^0.1.12",
11
- "@ccpc/math": "^0.1.15",
12
- "@ccpc/snap": "^0.1.9"
10
+ "@ccpc/canvas": "^0.1.11",
11
+ "@ccpc/core": "^0.1.14",
12
+ "@ccpc/math": "^0.1.17",
13
+ "@ccpc/snap": "^0.1.11"
13
14
  }
14
15
  }
@@ -10,6 +10,7 @@ export declare class App {
10
10
  selection: Selection;
11
11
  highLight: HighLight;
12
12
  constructor();
13
+ get cmdMgr(): import("..").CmdMgr;
13
14
  static instance(): App;
14
15
  get doc(): IDocument;
15
16
  start(doc: IDocument): void;
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/app/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,cAAc,CAAC;AACtD,OAAO,EAAa,SAAS,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,qBAAa,GAAG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