@realsee/dnalogel 3.48.1 → 3.48.3

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.
@@ -1,50 +1,52 @@
1
- var j = Object.defineProperty, W = Object.defineProperties;
2
- var V = Object.getOwnPropertyDescriptors;
3
- var L = Object.getOwnPropertySymbols;
4
- var A = Object.prototype.hasOwnProperty, D = Object.prototype.propertyIsEnumerable;
5
- var f = (n, t, e) => t in n ? j(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, w = (n, t) => {
1
+ var F = Object.defineProperty, T = Object.defineProperties;
2
+ var k = Object.getOwnPropertyDescriptors;
3
+ var E = Object.getOwnPropertySymbols;
4
+ var z = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
5
+ var v = (n, t, e) => t in n ? F(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, p = (n, t) => {
6
6
  for (var e in t || (t = {}))
7
- A.call(t, e) && f(n, e, t[e]);
8
- if (L)
9
- for (var e of L(t))
10
- D.call(t, e) && f(n, e, t[e]);
7
+ z.call(t, e) && v(n, e, t[e]);
8
+ if (E)
9
+ for (var e of E(t))
10
+ B.call(t, e) && v(n, e, t[e]);
11
11
  return n;
12
- }, u = (n, t) => W(n, V(t));
13
- var g = (n, t, e) => (f(n, typeof t != "symbol" ? t + "" : t, e), e);
14
- var b = (n, t, e) => new Promise((i, d) => {
15
- var a = (h) => {
12
+ }, M = (n, t) => T(n, k(t));
13
+ var y = (n, t, e) => (v(n, typeof t != "symbol" ? t + "" : t, e), e);
14
+ var R = (n, t, e) => new Promise((s, P) => {
15
+ var w = (o) => {
16
16
  try {
17
- y(e.next(h));
18
- } catch (m) {
19
- d(m);
17
+ c(e.next(o));
18
+ } catch (a) {
19
+ P(a);
20
20
  }
21
- }, p = (h) => {
21
+ }, b = (o) => {
22
22
  try {
23
- y(e.throw(h));
24
- } catch (m) {
25
- d(m);
23
+ c(e.throw(o));
24
+ } catch (a) {
25
+ P(a);
26
26
  }
27
- }, y = (h) => h.done ? i(h.value) : Promise.resolve(h.value).then(a, p);
28
- y((e = e.apply(n, t)).next());
27
+ }, c = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(w, b);
28
+ c((e = e.apply(n, t)).next());
29
29
  });
30
- import { PolylineWithDotsMesh as C, PolylineMesh as x } from "../../Meshes/Polyline.js";
31
- import { BaseObject as F } from "../Base/index.js";
32
- import * as c from "three";
33
- import { PolylineEditor as O } from "./Editor.js";
34
- import { vector3ToArray as T } from "../../../shared-utils/three/vector3ToArray.js";
35
- const E = new c.Vector3();
36
- class k extends F {
37
- constructor(e, i) {
38
- super(e, i);
39
- g(this, "type", "Polyline");
40
- g(this, "polyLineMesh");
41
- e && (this.polyLineMesh = new C(w(w({}, e.style), e)), this.add(this.polyLineMesh)), this.editor = new O(this);
30
+ import { PolylineWithDotsMesh as U, PolylineMesh as W } from "../../Meshes/Polyline.js";
31
+ import { BaseObject as H } from "../Base/index.js";
32
+ import * as d from "three";
33
+ import { PolylineEditor as I } from "./Editor.js";
34
+ import { vector3ToArray as N } from "../../../shared-utils/three/vector3ToArray.js";
35
+ import { withResolvers as _ } from "../../../shared-utils/promise/withResolvers.js";
36
+ const V = new d.Vector3();
37
+ class Z extends H {
38
+ constructor(e, s) {
39
+ super(e, s);
40
+ y(this, "type", "Polyline");
41
+ y(this, "polyLineMesh");
42
+ y(this, "creatingObject");
43
+ e && (this.polyLineMesh = new U(p(p({}, e.style), e)), this.add(this.polyLineMesh)), this.editor = new I(this);
42
44
  }
43
45
  get data() {
44
- return u(w({}, this.baseData), {
45
- points: T(this.applyObjectMatrixWorld(this.polyLineMesh.points)),
46
+ return M(p({}, this.baseData), {
47
+ points: N(this.applyObjectMatrixWorld(this.polyLineMesh.points)),
46
48
  style: {
47
- lineColor: new c.Color(this.polyLineMesh.lineColor).getHex(),
49
+ lineColor: new d.Color(this.polyLineMesh.lineColor).getHex(),
48
50
  lineWidth: this.polyLineMesh.lineWidth,
49
51
  dashed: this.polyLineMesh.dashed
50
52
  }
@@ -58,41 +60,71 @@ class k extends F {
58
60
  var e;
59
61
  (e = this.polyLineMesh) == null || e.unhighlight();
60
62
  }
63
+ canUndo() {
64
+ var e;
65
+ (e = this.creatingObject) == null || e.canUndo();
66
+ }
67
+ canRedo() {
68
+ var e;
69
+ (e = this.creatingObject) == null || e.canRedo();
70
+ }
71
+ undo() {
72
+ var e;
73
+ (e = this.creatingObject) == null || e.undo();
74
+ }
75
+ redo() {
76
+ var e;
77
+ (e = this.creatingObject) == null || e.redo();
78
+ }
61
79
  create(e) {
62
- return b(this, null, function* () {
80
+ return R(this, null, function* () {
63
81
  this.removeChildren();
64
- const i = new C(e);
65
- this.polyLineMesh = i, this.add(this.polyLineMesh), yield U(i, this.pointSelector, e), this.editor.enable();
82
+ const s = new U(e);
83
+ this.polyLineMesh = s, this.add(this.polyLineMesh), this.creatingObject = q(s, this.pointSelector, e), yield this.creatingObject.finished, this.editor.enable();
66
84
  });
67
85
  }
68
86
  }
69
- function U(n, t, e) {
70
- var y;
71
- const i = n.parent;
72
- if (!i)
87
+ function q(n, t, e) {
88
+ var x;
89
+ const s = n.parent;
90
+ if (!s)
73
91
  return;
74
- const d = (y = e == null ? void 0 : e.limit) != null ? y : "none", a = new x(n.style);
75
- i.add(a);
76
- const p = new x(u(w({}, n.style), { dashed: !0, lengthEnable: !1 }));
77
- return i.add(p), t.enable(), new Promise((h, m) => {
78
- const o = [];
79
- let l, s;
80
- const M = (r) => {
81
- const P = o.length === 0 ? r.point : l.clone();
82
- o.push(P), n.setPoints(o);
83
- }, v = (r) => {
84
- if (!(o != null && o.length) || !r)
85
- return;
86
- const P = o.at(-1).clone();
87
- d === "none" ? (l = r.point, a.setPoints([P, l])) : d === "xoz" ? (s = s != null ? s : new c.Plane().setFromNormalAndCoplanarPoint(new c.Vector3(0, 1, 0), o[0]), t.plane = s, l = s.projectPoint(r.point, E), a.setPoints([P, l]), p.setPoints([l, r.point])) : d === "y" && (o.length === 1 ? (l = r.point, a.setPoints([P, l])) : (s = s != null ? s : new c.Plane().setFromCoplanarPoints(o[0], o[1], new c.Vector3(0, 1, 0).add(o[0])), t.plane = s, l = s.projectPoint(r.point, E), a.setPoints([P, l]), p.setPoints([l, r.point])));
92
+ const { promise: P, resolve: w, reject: b } = _(), c = (x = e == null ? void 0 : e.limit) != null ? x : "none", o = new W(n.style);
93
+ s.add(o);
94
+ const a = new W(M(p({}, n.style), { dashed: !0, lengthEnable: !1 }));
95
+ s.add(a), t.enable();
96
+ const i = [];
97
+ let r, l, j;
98
+ const f = [], O = () => i.length > 0, L = () => f.length > 0, A = () => {
99
+ O() && (f.push(i.pop()), n.setPoints(i), g(j), t.pointSelectorHelper.magnifier.render());
100
+ }, D = () => {
101
+ L() && (i.push(f.pop()), n.setPoints(i), g(j), t.pointSelectorHelper.magnifier.render());
102
+ }, C = (h) => {
103
+ f.length = 0;
104
+ const m = i.length === 0 ? h.point : r.clone();
105
+ i.push(m), n.setPoints(i);
106
+ }, g = (h) => {
107
+ const m = () => {
108
+ o.setPoints([]), a.setPoints([]), r = null;
88
109
  };
89
- t.on("select", M), t.on("intersectionUpdate", v), t.on("disable", () => {
90
- if (t.off("select", M), t.off("intersectionUpdate", v), t.plane = null, i.remove(a), i.remove(p), o.length < 2)
91
- return i.remove(n), m(new Error("Cancelled"));
92
- h();
93
- });
94
- });
110
+ if (!(i != null && i.length) || !h)
111
+ return m();
112
+ j = h;
113
+ const u = i.at(-1).clone();
114
+ c === "none" ? (r = h.point, o.setPoints([u, r])) : c === "xoz" ? (l = l != null ? l : new d.Plane().setFromNormalAndCoplanarPoint(new d.Vector3(0, 1, 0), i[0]), t.plane = l, r = l.projectPoint(h.point, V), o.setPoints([u, r]), a.setPoints([r, h.point])) : c === "y" && (i.length === 1 ? (r = h.point, o.setPoints([u, r])) : (l = l != null ? l : new d.Plane().setFromCoplanarPoints(i[0], i[1], new d.Vector3(0, 1, 0).add(i[0])), t.plane = l, r = l.projectPoint(h.point, V), o.setPoints([u, r]), a.setPoints([r, h.point])));
115
+ };
116
+ return t.on("select", C), t.on("intersectionUpdate", g), t.on("disable", () => {
117
+ if (t.off("select", C), t.off("intersectionUpdate", g), t.plane = null, s.remove(o), s.remove(a), i.length < 2)
118
+ return s.remove(n), b(new Error("Cancelled"));
119
+ w();
120
+ }), {
121
+ finished: P,
122
+ canUndo: O,
123
+ canRedo: L,
124
+ undo: A,
125
+ redo: D
126
+ };
95
127
  }
96
128
  export {
97
- k as Polyline
129
+ Z as Polyline
98
130
  };
@@ -11,7 +11,7 @@ var p = (i, e, t) => e in i ? E(i, e, { enumerable: !0, configurable: !0, writab
11
11
  return i;
12
12
  }, w = (i, e) => L(i, O(e));
13
13
  var d = (i, e, t) => (p(i, typeof e != "symbol" ? e + "" : e, t), t);
14
- var g = (i, e, t) => new Promise((o, n) => {
14
+ var f = (i, e, t) => new Promise((o, n) => {
15
15
  var l = (s) => {
16
16
  try {
17
17
  r(t.next(s));
@@ -63,22 +63,22 @@ class Q extends j {
63
63
  (t = this.prismMesh) == null || t.unhighlight();
64
64
  }
65
65
  create(t) {
66
- return g(this, null, function* () {
66
+ return f(this, null, function* () {
67
67
  this.prismMesh = new x(t), this.add(this.prismMesh), yield D(this.prismMesh, this.pointSelector), this.editor.enable();
68
68
  });
69
69
  }
70
70
  }
71
71
  function D(i, e) {
72
- return g(this, null, function* () {
72
+ return f(this, null, function* () {
73
73
  const t = i.parent;
74
- yield T(i.bottomPolygon, e);
74
+ yield T(i.bottomPolygon, e).finished;
75
75
  const o = new U();
76
76
  o.name = "LineHelper", t.add(o);
77
77
  const n = i.bottomPolygon.points.at(-1), l = B(i.bottomPolygon.points).normalize(), m = n.clone().add(l.clone().multiplyScalar(10)), r = n.clone().sub(l.clone().multiplyScalar(10));
78
78
  return o.setPoints([m, r]), e.enable(), new Promise((s, h) => {
79
- const P = (a) => {
79
+ const g = (a) => {
80
80
  y(), s();
81
- }, f = (a) => {
81
+ }, P = (a) => {
82
82
  if (!(a != null && a.raycaster))
83
83
  return;
84
84
  const M = A({
@@ -87,11 +87,11 @@ function D(i, e) {
87
87
  });
88
88
  M && i.setPoints({ heightPoint: M });
89
89
  }, y = () => {
90
- e.off("select", P), e.off("intersectionUpdate", f), e.off("disable", b), t.remove(o), e.disable();
90
+ e.off("select", g), e.off("intersectionUpdate", P), e.off("disable", b), t.remove(o), e.disable();
91
91
  }, b = () => {
92
92
  y(), t.remove(i), h(new Error("Cancelled"));
93
93
  };
94
- e.on("select", P), e.on("intersectionUpdate", f), e.on("disable", b);
94
+ e.on("select", g), e.on("intersectionUpdate", P), e.on("disable", b);
95
95
  });
96
96
  });
97
97
  }
@@ -67,7 +67,11 @@ export declare class Sculpt extends Subscribe<Event> {
67
67
  id: string;
68
68
  type: string;
69
69
  } | {
70
- readonly points: [number, number, number][];
70
+ readonly points: [number, number, number][]; /**
71
+ * @description: 点击事件
72
+ * @param {BuiltInItem} item 点击的物体
73
+ * 返回 false 来禁用 Five 默认行为
74
+ */
71
75
  readonly heightPoint: [number, number, number];
72
76
  readonly style: {
73
77
  readonly color: number;
@@ -63,14 +63,14 @@ const a = class extends S {
63
63
  */
64
64
  h(this, "undo", () => {
65
65
  var e;
66
- (e = this.creatingItem) == null || e.undo(), this.five.needsRender = !0;
66
+ console.log("undo"), (e = this.creatingItem) == null || e.undo(), this.five.needsRender = !0;
67
67
  });
68
68
  /**
69
69
  * @description: 重做
70
70
  */
71
71
  h(this, "redo", () => {
72
72
  var e;
73
- (e = this.creatingItem) == null || e.redo(), this.five.needsRender = !0;
73
+ console.log("redo"), (e = this.creatingItem) == null || e.redo(), this.five.needsRender = !0;
74
74
  });
75
75
  this.five = e, this.theme = t, this.group = new z(), this.group.name = "Sculpt", e.scene.add(this.group), a.modules.init(e), p.unbind("ctrl+z", this.undo), p.unbind("ctrl+shift+z", this.redo), p("ctrl+z", this.undo), p("ctrl+shift+z", this.redo), a.modules.fiveDomEvents.addEventListener(this.group, "click", ({ intersects: n }) => {
76
76
  var s;
@@ -17,7 +17,7 @@ let x = class {
17
17
  /**
18
18
  * @realsee/dnalogel 版本号
19
19
  */
20
- i(this, "VERSION", "3.48.1");
20
+ i(this, "VERSION", "3.48.3");
21
21
  i(this, "NAME");
22
22
  i(this, "five");
23
23
  i(this, "workUtil");
package/libs/index.js CHANGED
@@ -458,6 +458,7 @@ import "./Sculpt/Objects/Polyline/Editor.js";
458
458
  import "./Sculpt/Objects/Line/Editor.js";
459
459
  import "./Sculpt/Objects/Base/Editor.js";
460
460
  import "./shared-utils/three/vector3ToArray.js";
461
+ import "./shared-utils/promise/withResolvers.js";
461
462
  import "./Sculpt/Objects/Point/index.js";
462
463
  import "./Sculpt/Objects/Point/Editor.js";
463
464
  import "./Sculpt/Objects/Polygon/index.js";
@@ -488,7 +489,6 @@ import "./Sculpt/Objects/Box/Editor.js";
488
489
  import "./Sculpt/Meshes/Box.js";
489
490
  import "./shared-utils/forReverseEach.js";
490
491
  import "./Sculpt/Objects/Line/index.js";
491
- import "./shared-utils/promise/withResolvers.js";
492
492
  import "./ModelMakerPlugin/Controller.js";
493
493
  import "./ModelMakerPlugin/item/boxItem.js";
494
494
  import "./ModelMakerPlugin/item/polygonItem.js";
@@ -1,6 +1,6 @@
1
1
  function A() {
2
2
  console.debug(
3
- "%c %c@realsee/dnalogel %cv3.48.1",
3
+ "%c %c@realsee/dnalogel %cv3.48.3",
4
4
  [
5
5
  "background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')",
6
6
  "background-repeat: no-repeat",
@@ -1,5 +1,5 @@
1
1
  import { cubicOut as h, cubicInOut as k } from "../easing/index.js";
2
- import { split_css_unit as y, identity as _ } from "../internal/index.js";
2
+ import { identity as _, split_css_unit as y } from "../internal/index.js";
3
3
  function C(s, { delay: o = 0, duration: n = 400, easing: t = _ } = {}) {
4
4
  const c = +getComputedStyle(s).opacity;
5
5
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realsee/dnalogel",
3
- "version": "3.48.1",
3
+ "version": "3.48.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./libs/index.js",
6
6
  "types": "./libs/index.d.ts",