@realsee/dnalogel 3.44.5 → 3.46.0

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.
Files changed (162) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/Sculpt/Meshes/Area.d.ts +1 -1
  3. package/dist/Sculpt/Meshes/Box.d.ts +1 -1
  4. package/dist/Sculpt/Meshes/Circle.d.ts +1 -1
  5. package/dist/Sculpt/Meshes/CircleWithEdge.d.ts +1 -1
  6. package/dist/Sculpt/Meshes/Line.d.ts +8 -2
  7. package/dist/Sculpt/Meshes/LineWithDots.d.ts +1 -1
  8. package/dist/Sculpt/Meshes/Point.d.ts +1 -1
  9. package/dist/Sculpt/Meshes/PolygonWithEdge.d.ts +1 -1
  10. package/dist/Sculpt/Meshes/Prism.d.ts +1 -1
  11. package/dist/Sculpt/Meshes/RectangleWithEdge.d.ts +3 -4
  12. package/dist/Sculpt/Objects/Line/Editor.d.ts +22 -0
  13. package/dist/Sculpt/Objects/Line/index.d.ts +33 -0
  14. package/dist/Sculpt/Objects/Point/index.d.ts +1 -1
  15. package/dist/Sculpt/Objects/Polygon/Editor.d.ts +2 -2
  16. package/dist/Sculpt/Objects/Polygon/index.d.ts +3 -2
  17. package/dist/Sculpt/Objects/Polyline/Editor.d.ts +3 -17
  18. package/dist/Sculpt/Objects/Polyline/index.d.ts +7 -6
  19. package/dist/Sculpt/index.d.ts +5 -0
  20. package/dist/Sculpt/typings/index.d.ts +11 -6
  21. package/dist/Sculpt/{utils/color.d.ts → typings/style.d.ts} +7 -0
  22. package/dist/Sculpt/typings/utils.type.d.ts +2 -0
  23. package/dist/Sculpt/utils/three/ColoredMesh.d.ts +1 -1
  24. package/dist/Sculpt/utils/three/rayOnLine.d.ts +3 -5
  25. package/dist/index.cjs.js +56 -56
  26. package/dist/index.js +29820 -29686
  27. package/dist/index.umd.js +49 -49
  28. package/dist/shared-utils/Utils/WorkUtil.d.ts +6 -6
  29. package/dist/shared-utils/tag.d.ts +6 -3
  30. package/libs/AreaMakerPlugin/Controller.js +150 -78
  31. package/libs/AreaMakerPlugin/index.js +76 -4
  32. package/libs/AreaMakerPlugin/utils/Item.js +190 -111
  33. package/libs/CSS3DRenderPlugin/Controller.js +89 -29
  34. package/libs/CSS3DRenderPlugin/index.js +75 -15
  35. package/libs/CSS3DRenderPlugin/utils/three/CSS3DObject.js +132 -58
  36. package/libs/CSS3DRenderPlugin/utils/three/CSS3DRender.js +181 -116
  37. package/libs/CruisePlugin/BaseController.js +121 -49
  38. package/libs/CruisePlugin/Move.js +73 -21
  39. package/libs/CruisePlugin/Work.js +98 -46
  40. package/libs/CruisePlugin/index.js +79 -27
  41. package/libs/CurrentPanoImagePlugin/Controller.js +176 -104
  42. package/libs/CurrentPanoImagePlugin/index.js +76 -4
  43. package/libs/GuideLinePlugin/Controller.js +82 -30
  44. package/libs/GuideLinePlugin/GuideLineItem.js +82 -30
  45. package/libs/GuideLinePlugin/GuideLineModeItem/index.js +3 -2
  46. package/libs/GuideLinePlugin/GuideLineModeItem.js +81 -29
  47. package/libs/GuideLinePlugin/index.js +79 -27
  48. package/libs/ModelMakerPlugin/Controller.js +140 -83
  49. package/libs/ModelMakerPlugin/index.js +75 -18
  50. package/libs/ModelTVVideoPlugin/Plugin.js +117 -57
  51. package/libs/ModelTVVideoPlugin/index.js +68 -8
  52. package/libs/Object3DHelperPlugin/Controller.js +54 -31
  53. package/libs/Object3DHelperPlugin/index.js +35 -13
  54. package/libs/PanoCompassPlugin/Controller.js +97 -42
  55. package/libs/PanoCompassPlugin/index.js +71 -16
  56. package/libs/PanoDoorLabelPlugin/BaseController.js +98 -26
  57. package/libs/PanoDoorLabelPlugin/Controller.js +187 -115
  58. package/libs/PanoDoorLabelPlugin/index.js +76 -4
  59. package/libs/PanoMeasurePlugin/Components/Controller0.js +141 -89
  60. package/libs/PanoMeasurePlugin/Components/Controller1.js +179 -127
  61. package/libs/PanoMeasurePlugin/Controller/EditController.js +125 -73
  62. package/libs/PanoMeasurePlugin/Controller/WatchController.js +167 -92
  63. package/libs/PanoMeasurePlugin/Controller/index.js +110 -65
  64. package/libs/PanoMeasurePlugin/Model/area.js +114 -38
  65. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +78 -0
  66. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +98 -46
  67. package/libs/PanoMeasurePlugin/index.js +77 -32
  68. package/libs/PanoMeasurePlugin/utils/dom/areaDom.js +98 -20
  69. package/libs/PanoSpatialTagPlugin/Plugin.js +210 -150
  70. package/libs/PanoSpatialTagPlugin/index.js +66 -6
  71. package/libs/PanoTagPlugin/Components/Common/TagPoint.js +133 -53
  72. package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +295 -216
  73. package/libs/PanoTagPlugin/Components/Tag/index.js +257 -187
  74. package/libs/PanoTagPlugin/Components/TagContainer.js +157 -87
  75. package/libs/PanoTagPlugin/Components/TagItem.js +144 -74
  76. package/libs/PanoTagPlugin/controller/Tag/BaseTag.js +73 -3
  77. package/libs/PanoTagPlugin/controller/Tag/ModelTag.js +109 -39
  78. package/libs/PanoTagPlugin/controller/Tag/PlaneTag.js +105 -35
  79. package/libs/PanoTagPlugin/controller/Tag/PointTag.js +113 -43
  80. package/libs/PanoTagPlugin/controller/TagRender.js +132 -80
  81. package/libs/PanoTagPlugin/controller/TagUtil.js +136 -84
  82. package/libs/PanoTagPlugin/controller/index.js +113 -61
  83. package/libs/PanoTagPlugin/index.js +89 -37
  84. package/libs/PanoTagPlugin/utils/tag/calculateTagConfig.js +121 -41
  85. package/libs/PanoVideoPlugin/Controller.js +137 -65
  86. package/libs/PanoVideoPlugin/VideoMeshController.js +149 -69
  87. package/libs/PanoVideoPlugin/index.js +82 -10
  88. package/libs/PipelinePlugin/Controller.js +199 -128
  89. package/libs/PipelinePlugin/index.js +76 -5
  90. package/libs/PipelinePlugin/utils/Objects/FlowPipe.js +102 -22
  91. package/libs/PipelinePlugin/utils/Objects/HighlightPipe.js +95 -15
  92. package/libs/PipelinePlugin/utils/Objects/Pipe.js +136 -56
  93. package/libs/Sculpt/Meshes/Area.d.ts +1 -1
  94. package/libs/Sculpt/Meshes/Box.d.ts +1 -1
  95. package/libs/Sculpt/Meshes/Box.js +16 -15
  96. package/libs/Sculpt/Meshes/Circle.d.ts +1 -1
  97. package/libs/Sculpt/Meshes/Circle.js +1 -1
  98. package/libs/Sculpt/Meshes/CircleWithEdge.d.ts +1 -1
  99. package/libs/Sculpt/Meshes/Cylinder.js +8 -7
  100. package/libs/Sculpt/Meshes/Line.d.ts +8 -2
  101. package/libs/Sculpt/Meshes/Line.js +93 -65
  102. package/libs/Sculpt/Meshes/LineWithDots.d.ts +1 -1
  103. package/libs/Sculpt/Meshes/LineWithDots.js +26 -26
  104. package/libs/Sculpt/Meshes/Point.d.ts +1 -1
  105. package/libs/Sculpt/Meshes/Point.js +7 -6
  106. package/libs/Sculpt/Meshes/Polygon.js +1 -1
  107. package/libs/Sculpt/Meshes/PolygonWithEdge.d.ts +1 -1
  108. package/libs/Sculpt/Meshes/Polyline.js +5 -4
  109. package/libs/Sculpt/Meshes/Prism.d.ts +1 -1
  110. package/libs/Sculpt/Meshes/Rectangle.js +3 -2
  111. package/libs/Sculpt/Meshes/RectangleWithEdge.d.ts +3 -4
  112. package/libs/Sculpt/Objects/Box/index.js +41 -43
  113. package/libs/Sculpt/Objects/Cylinder/index.js +35 -37
  114. package/libs/Sculpt/Objects/Line/Editor.d.ts +22 -0
  115. package/libs/Sculpt/Objects/Line/Editor.js +62 -0
  116. package/libs/Sculpt/Objects/Line/index.d.ts +33 -0
  117. package/libs/Sculpt/Objects/Line/index.js +107 -0
  118. package/libs/Sculpt/Objects/Point/index.d.ts +1 -1
  119. package/libs/Sculpt/Objects/Polygon/Editor.d.ts +2 -2
  120. package/libs/Sculpt/Objects/Polygon/Editor.js +5 -5
  121. package/libs/Sculpt/Objects/Polygon/index.d.ts +3 -2
  122. package/libs/Sculpt/Objects/Polygon/index.js +80 -80
  123. package/libs/Sculpt/Objects/Polyline/Editor.d.ts +3 -17
  124. package/libs/Sculpt/Objects/Polyline/Editor.js +10 -48
  125. package/libs/Sculpt/Objects/Polyline/index.d.ts +7 -6
  126. package/libs/Sculpt/Objects/Polyline/index.js +63 -58
  127. package/libs/Sculpt/Objects/Prism/index.js +56 -58
  128. package/libs/Sculpt/index.d.ts +5 -0
  129. package/libs/Sculpt/index.js +58 -48
  130. package/libs/Sculpt/typings/index.d.ts +11 -6
  131. package/libs/Sculpt/{utils/color.d.ts → typings/style.d.ts} +7 -0
  132. package/libs/Sculpt/typings/utils.type.d.ts +2 -0
  133. package/libs/Sculpt/utils/three/ColoredMesh.d.ts +1 -1
  134. package/libs/Sculpt/utils/three/ColoredMesh.js +15 -14
  135. package/libs/Sculpt/utils/three/rayOnLine.d.ts +3 -5
  136. package/libs/Sculpt/utils/three/rayOnLine.js +15 -14
  137. package/libs/base/BasePlugin.js +14 -13
  138. package/libs/floorplan/MapviewFloorplanPlugin/Controller.js +131 -61
  139. package/libs/floorplan/MapviewFloorplanPlugin/index.js +75 -6
  140. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +129 -59
  141. package/libs/floorplan/ModelFloorplanPlugin/index.js +75 -5
  142. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +158 -86
  143. package/libs/floorplan/PanoFloorplanRadarPlugin/index.js +76 -4
  144. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +151 -81
  145. package/libs/floorplan/TopviewFloorplanPlugin/index.js +75 -5
  146. package/libs/floorplan/index.js +1 -0
  147. package/libs/index.js +194 -192
  148. package/libs/shared-utils/Object3DHelper/Controller/MoveController.js +1 -1
  149. package/libs/shared-utils/Object3DHelper/Controller/ScaleController.js +23 -23
  150. package/libs/shared-utils/Utils/WorkUtil.d.ts +6 -6
  151. package/libs/shared-utils/Utils/WorkUtil.js +8 -7
  152. package/libs/shared-utils/five/index.js +3 -2
  153. package/libs/shared-utils/five/lookObject.js +3 -2
  154. package/libs/shared-utils/logger.js +1 -1
  155. package/libs/shared-utils/tag.d.ts +6 -3
  156. package/libs/shared-utils/tag.js +38 -24
  157. package/libs/shared-utils/three/PointSelector/utils/PointSelectorHelper.js +15 -15
  158. package/libs/shared-utils/three/index.js +1 -0
  159. package/package.json +1 -1
  160. package/dist/Sculpt/typings/SimplifyDeep.d.ts +0 -3
  161. package/libs/Sculpt/typings/SimplifyDeep.d.ts +0 -3
  162. /package/libs/Sculpt/{utils/color.js → typings/style.js} +0 -0
@@ -2,7 +2,7 @@ var L = Object.defineProperty, j = Object.defineProperties;
2
2
  var T = Object.getOwnPropertyDescriptors;
3
3
  var g = Object.getOwnPropertySymbols;
4
4
  var A = Object.prototype.hasOwnProperty, U = Object.prototype.propertyIsEnumerable;
5
- var p = (n, t, e) => t in n ? L(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, h = (n, t) => {
5
+ var p = (n, t, e) => t in n ? L(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, d = (n, t) => {
6
6
  for (var e in t || (t = {}))
7
7
  A.call(t, e) && p(n, e, t[e]);
8
8
  if (g)
@@ -11,42 +11,41 @@ var p = (n, t, e) => t in n ? L(n, t, { enumerable: !0, configurable: !0, writab
11
11
  return n;
12
12
  }, M = (n, t) => j(n, T(t));
13
13
  var y = (n, t, e) => (p(n, typeof t != "symbol" ? t + "" : t, e), e);
14
- var f = (n, t, e) => new Promise((r, s) => {
14
+ var b = (n, t, e) => new Promise((r, s) => {
15
15
  var c = (o) => {
16
16
  try {
17
17
  i(e.next(o));
18
18
  } catch (a) {
19
19
  s(a);
20
20
  }
21
- }, m = (o) => {
21
+ }, h = (o) => {
22
22
  try {
23
23
  i(e.throw(o));
24
24
  } catch (a) {
25
25
  s(a);
26
26
  }
27
- }, i = (o) => o.done ? r(o.value) : Promise.resolve(o.value).then(c, m);
27
+ }, i = (o) => o.done ? r(o.value) : Promise.resolve(o.value).then(c, h);
28
28
  i((e = e.apply(n, t)).next());
29
29
  });
30
- import { Sculpt as W } from "../../index.js";
31
- import { CylinderMesh as v } from "../../Meshes/Cylinder.js";
32
- import { LineMesh as z } from "../../Meshes/Line.js";
33
- import { rayOnLine as B } from "../../utils/three/rayOnLine.js";
34
- import { BaseObject as D } from "../Base/index.js";
35
- import { createCircle as F } from "../Circle/index.js";
36
- import * as b from "three";
37
- import { CylinderEditor as N } from "./Editor.js";
38
- import { vector3ToArray as O } from "../../../shared-utils/three/vector3ToArray.js";
39
- class Z extends D {
30
+ import { CylinderMesh as O } from "../../Meshes/Cylinder.js";
31
+ import { LineMesh as W } from "../../Meshes/Line.js";
32
+ import { rayOnLine as z } from "../../utils/three/rayOnLine.js";
33
+ import { BaseObject as B } from "../Base/index.js";
34
+ import { createCircle as D } from "../Circle/index.js";
35
+ import * as f from "three";
36
+ import { CylinderEditor as F } from "./Editor.js";
37
+ import { vector3ToArray as v } from "../../../shared-utils/three/vector3ToArray.js";
38
+ class X extends B {
40
39
  constructor(e, r) {
41
40
  super(e, r);
42
41
  y(this, "type", "Cylinder");
43
42
  y(this, "cylinderMesh");
44
- this.editor = new N(this), e && (this.cylinderMesh = new v(h(h({}, e.style), e)), this.add(this.cylinderMesh));
43
+ this.editor = new F(this), e && (this.cylinderMesh = new O(d(d({}, e.style), e)), this.add(this.cylinderMesh));
45
44
  }
46
45
  get data() {
47
- return M(h({}, this.baseData), {
48
- bottomCenter: O(this.applyObjectMatrixWorld(this.cylinderMesh.bottomCenter)),
49
- topCenter: O(this.applyObjectMatrixWorld(this.cylinderMesh.topCenter)),
46
+ return M(d({}, this.baseData), {
47
+ bottomCenter: v(this.applyObjectMatrixWorld(this.cylinderMesh.bottomCenter)),
48
+ topCenter: v(this.applyObjectMatrixWorld(this.cylinderMesh.topCenter)),
50
49
  radius: this.cylinderMesh.radius,
51
50
  style: {
52
51
  color: this.cylinderMesh.color.getHex()
@@ -62,39 +61,38 @@ class Z extends D {
62
61
  (e = this.cylinderMesh) == null || e.unhighlight();
63
62
  }
64
63
  create(e) {
65
- return f(this, null, function* () {
66
- this.cylinderMesh = new v(e), this.add(this.cylinderMesh), yield R(this.cylinderMesh, this.pointSelector), this.editor.enable();
64
+ return b(this, null, function* () {
65
+ this.cylinderMesh = new O(e), this.add(this.cylinderMesh), yield N(this.cylinderMesh, this.pointSelector), this.editor.enable();
67
66
  });
68
67
  }
69
68
  }
70
- function R(n, t) {
71
- return f(this, null, function* () {
69
+ function N(n, t) {
70
+ return b(this, null, function* () {
72
71
  const e = n.parent;
73
- yield F(n.bottomCircle, t);
74
- const r = new z();
72
+ yield D(n.bottomCircle, t);
73
+ const r = new W();
75
74
  r.name = "LineHelper", e.add(r);
76
- const s = t.position.point, c = n.normal.clone().normalize(), m = s.clone().add(c.clone().multiplyScalar(10)), i = s.clone().sub(c.clone().multiplyScalar(10));
77
- return r.setPoints([m, i]), t.enable(), new Promise((o, a) => {
75
+ const s = t.position.point, c = n.normal.clone().normalize(), h = s.clone().add(c.clone().multiplyScalar(10)), i = s.clone().sub(c.clone().multiplyScalar(10));
76
+ return r.setPoints([h, i]), t.enable(), new Promise((o, a) => {
78
77
  const C = (l) => {
79
- P(), o();
78
+ w(), o();
80
79
  }, u = (l) => {
81
80
  if (!(l != null && l.raycaster))
82
81
  return;
83
- const d = B({
84
- cameraPosition: W.modules.five.camera.position,
82
+ const m = z({
85
83
  raycaster: l.raycaster,
86
- line: new b.Line3(m, i)
87
- }), x = new b.Plane().setFromNormalAndCoplanarPoint(n.normal, n.bottomCenter).projectPoint(d, new b.Vector3()), E = d.clone().sub(x), H = n.bottomCenter.clone().add(E);
88
- d && n.setTopCenter(H);
89
- }, P = () => {
90
- t.off("select", C), t.off("intersectionUpdate", u), t.off("disable", w), e.remove(r), t.disable();
84
+ line: new f.Line3(h, i)
85
+ }), x = new f.Plane().setFromNormalAndCoplanarPoint(n.normal, n.bottomCenter).projectPoint(m, new f.Vector3()), E = m.clone().sub(x), H = n.bottomCenter.clone().add(E);
86
+ m && n.setTopCenter(H);
91
87
  }, w = () => {
92
- P(), e.remove(n), a(new Error("Cancelled"));
88
+ t.off("select", C), t.off("intersectionUpdate", u), t.off("disable", P), e.remove(r), t.disable();
89
+ }, P = () => {
90
+ w(), e.remove(n), a(new Error("Cancelled"));
93
91
  };
94
- t.on("select", C), t.on("intersectionUpdate", u), t.on("disable", w);
92
+ t.on("select", C), t.on("intersectionUpdate", u), t.on("disable", P);
95
93
  });
96
94
  });
97
95
  }
98
96
  export {
99
- Z as Cylinder
97
+ X as Cylinder
100
98
  };
@@ -0,0 +1,22 @@
1
+ import { BaseEditor } from '../Base/Editor';
2
+ import type { FiveDomEvent } from '../../../shared-utils/five/FiveDomEvents';
3
+ import type { Line } from '.';
4
+ import type * as THREE from 'three';
5
+ import { PointMesh } from '../../Meshes/Point';
6
+ export declare abstract class LineEditorAbstract<OriginObject extends THREE.Object3D = THREE.Object3D> extends BaseEditor<OriginObject> {
7
+ protected draggingPoints: PointMesh[];
8
+ protected get pointMeshes(): PointMesh[];
9
+ abstract get points(): THREE.Vector3[];
10
+ get pointHandles(): PointMesh[];
11
+ constructor(originObject: OriginObject);
12
+ enable(): void;
13
+ disable(): void;
14
+ protected onDragstart: (event: FiveDomEvent) => void;
15
+ protected onDragend: (event: FiveDomEvent) => void;
16
+ protected abstract onDrag(event: FiveDomEvent): void;
17
+ }
18
+ export declare class LineEditor extends LineEditorAbstract<Line> {
19
+ get points(): THREE.Vector3[];
20
+ constructor(originObject: Line);
21
+ protected onDrag: (event: FiveDomEvent) => void;
22
+ }
@@ -0,0 +1,62 @@
1
+ var g = Object.defineProperty;
2
+ var d = (s, e, t) => e in s ? g(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var o = (s, e, t) => (d(s, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { BaseEditor as p } from "../Base/Editor.js";
5
+ import { Sculpt as n } from "../../index.js";
6
+ import { PointMesh as a } from "../../Meshes/Point.js";
7
+ import { getIntersectByRaycaster as h } from "../../../shared-utils/five/getPosition.js";
8
+ import "three";
9
+ import "hammerjs";
10
+ import "three/examples/jsm/renderers/CSS3DRenderer";
11
+ import "@realsee/five/line";
12
+ import "../../utils/Modules/Global.js";
13
+ import "../../../shared-utils/three/THREESphere.js";
14
+ import "animejs";
15
+ import { notNil as l } from "../../../shared-utils/isNil.js";
16
+ import "../../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
17
+ class m extends p {
18
+ constructor(t) {
19
+ super(t);
20
+ o(this, "draggingPoints", []);
21
+ o(this, "onDragstart", (t) => {
22
+ const i = t.target;
23
+ this.draggingPoints = this.pointMeshes.filter((r) => r.position.equals(i.position));
24
+ });
25
+ o(this, "onDragend", (t) => {
26
+ this.draggingPoints = [];
27
+ });
28
+ }
29
+ get pointMeshes() {
30
+ return this.children.filter((t) => t instanceof a);
31
+ }
32
+ get pointHandles() {
33
+ return this.children;
34
+ }
35
+ enable() {
36
+ super.enable(), this.points.filter(l).forEach((t) => {
37
+ const i = new a();
38
+ i.visible = !1, i.position.copy(t), i.draggable = !0, n.modules.fiveDomEvents.addEventListener(i, "drag", this.onDrag), n.modules.fiveDomEvents.addEventListener(i, "dragstart", this.onDragstart), n.modules.fiveDomEvents.addEventListener(i, "dragend", this.onDragend), this.add(i);
39
+ });
40
+ }
41
+ disable() {
42
+ super.disable(), this.removeChildren();
43
+ }
44
+ }
45
+ class O extends m {
46
+ constructor(t) {
47
+ super(t);
48
+ o(this, "onDrag", (t) => {
49
+ if (!this.draggingPoints || this.draggingPoints.length === 0)
50
+ return;
51
+ const i = h(n.modules.five, t.raycaster, { virtualPoint: !0 });
52
+ this.draggingPoints.forEach((r) => r.position.copy(i.point)), this.originObject.lineMesh.setPoints(this.pointMeshes.map((r) => r.position));
53
+ });
54
+ }
55
+ get points() {
56
+ return this.originObject.lineMesh.points;
57
+ }
58
+ }
59
+ export {
60
+ O as LineEditor,
61
+ m as LineEditorAbstract
62
+ };
@@ -0,0 +1,33 @@
1
+ import { LineMesh, type LineData, type LineMeshStyle } from '../../Meshes/Line';
2
+ import { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base';
3
+ import type { PointSelector } from '../../../shared-utils/three/PointSelector';
4
+ import type { LiteralString } from '../../../typings/utils.type';
5
+ import type { LimitPlaneConfig } from '../../typings/style';
6
+ import { LineWithDotsMesh } from '../../Meshes/LineWithDots';
7
+ export interface LineImportData extends BaseImportData, LineData {
8
+ type: LiteralString<'Line'>;
9
+ style?: Partial<LineMeshStyle>;
10
+ }
11
+ export declare class Line extends BaseObject<LineImportData> {
12
+ readonly type = "Line";
13
+ lineMesh: LineWithDotsMesh;
14
+ get data(): {
15
+ points: [number, number, number][];
16
+ style: {
17
+ lineColor: number;
18
+ lineWidth: number;
19
+ dashed: boolean;
20
+ };
21
+ id: string;
22
+ type: string;
23
+ };
24
+ constructor(data?: LineImportData, config?: Partial<BaseObjectConfig>);
25
+ highlight(): void;
26
+ unhighlight(): void;
27
+ create(params?: Partial<LineMeshStyle & LimitPlaneConfig>): Promise<void>;
28
+ }
29
+ /**
30
+ * @description 绘制线段
31
+ * @param config.limit 限制折线绘制的平面; `xoz` 限制在水平面; `y` 限制垂直面; `none` 不限制;默认 `none`
32
+ */
33
+ export declare function createLine(lineMesh: LineMesh, pointSelector: PointSelector, config?: Partial<LimitPlaneConfig>): Promise<void>;
@@ -0,0 +1,107 @@
1
+ var j = Object.defineProperty, O = Object.defineProperties;
2
+ var T = Object.getOwnPropertyDescriptors;
3
+ var b = Object.getOwnPropertySymbols;
4
+ var V = Object.prototype.hasOwnProperty, A = Object.prototype.propertyIsEnumerable;
5
+ var y = (i, t, e) => t in i ? j(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, u = (i, t) => {
6
+ for (var e in t || (t = {}))
7
+ V.call(t, e) && y(i, e, t[e]);
8
+ if (b)
9
+ for (var e of b(t))
10
+ A.call(t, e) && y(i, e, t[e]);
11
+ return i;
12
+ }, C = (i, t) => O(i, T(t));
13
+ var P = (i, t, e) => (y(i, typeof t != "symbol" ? t + "" : t, e), e);
14
+ var W = (i, t, e) => new Promise((n, a) => {
15
+ var h = (o) => {
16
+ try {
17
+ d(e.next(o));
18
+ } catch (f) {
19
+ a(f);
20
+ }
21
+ }, m = (o) => {
22
+ try {
23
+ d(e.throw(o));
24
+ } catch (f) {
25
+ a(f);
26
+ }
27
+ }, d = (o) => o.done ? n(o.value) : Promise.resolve(o.value).then(h, m);
28
+ d((e = e.apply(i, t)).next());
29
+ });
30
+ import { hotkeys as D } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
31
+ import { LineMesh as x } from "../../Meshes/Line.js";
32
+ import { BaseObject as U } from "../Base/index.js";
33
+ import * as c from "three";
34
+ import { LineEditor as k } from "./Editor.js";
35
+ import { vector3ToArray as z } from "../../../shared-utils/three/vector3ToArray.js";
36
+ import { LineWithDotsMesh as E } from "../../Meshes/LineWithDots.js";
37
+ import { rayOnLine as B } from "../../utils/three/rayOnLine.js";
38
+ const F = new c.Vector3();
39
+ class Q extends U {
40
+ constructor(e, n) {
41
+ super(e, n);
42
+ P(this, "type", "Line");
43
+ P(this, "lineMesh");
44
+ e && (this.lineMesh = new E(u(u({}, e.style), e)), this.add(this.lineMesh)), this.editor = new k(this), D("esc", () => {
45
+ this.stopCreating();
46
+ });
47
+ }
48
+ get data() {
49
+ return C(u({}, this.baseData), {
50
+ points: z(this.applyObjectMatrixWorld(this.lineMesh.points)),
51
+ style: {
52
+ lineColor: new c.Color(this.lineMesh.color).getHex(),
53
+ lineWidth: this.lineMesh.lineWidth,
54
+ dashed: this.lineMesh.dashed
55
+ }
56
+ });
57
+ }
58
+ highlight() {
59
+ var e;
60
+ (e = this.lineMesh) == null || e.highlight();
61
+ }
62
+ unhighlight() {
63
+ var e;
64
+ (e = this.lineMesh) == null || e.unhighlight();
65
+ }
66
+ create(e) {
67
+ return W(this, null, function* () {
68
+ this.removeChildren();
69
+ const n = new E(e);
70
+ this.lineMesh = n, this.add(this.lineMesh), yield H(n, this.pointSelector, e), this.editor.enable();
71
+ });
72
+ }
73
+ }
74
+ function H(i, t, e) {
75
+ var d;
76
+ const n = i.parent;
77
+ if (!n)
78
+ return;
79
+ const a = (d = e == null ? void 0 : e.limit) != null ? d : "none", h = new x(i.style);
80
+ n.add(h);
81
+ const m = new x({ dashed: !0, lineColor: i.color, lineWidth: i.lineWidth });
82
+ return n.add(m), t.enable(), new Promise((o, f) => {
83
+ const s = [];
84
+ let r, p;
85
+ const g = (l) => {
86
+ const w = s.length === 0 ? l.point : r.clone();
87
+ s.push(w), i.setPoints(s), s.length === 2 && (M(), o());
88
+ }, L = (l) => {
89
+ if (!(s != null && s.length) || !l)
90
+ return;
91
+ const w = s.at(-1).clone();
92
+ a === "none" ? (r = l.point, h.setPoints([w, r])) : a === "xoz" ? (p = p != null ? p : new c.Plane().setFromNormalAndCoplanarPoint(new c.Vector3(0, 1, 0), s[0]), r = p.projectPoint(l.point, F), h.setPoints([w, r]), m.setPoints([r, l.point])) : a === "y" && (r = B({
93
+ raycaster: l.raycaster,
94
+ line: new c.Line3(s[0].clone(), new c.Vector3(0, 1, 0).add(s[0])),
95
+ clampToLine: !1
96
+ }), h.setPoints([w, r]));
97
+ }, M = () => {
98
+ t.off("select", g), t.off("intersectionUpdate", L), t.off("disable", v), t.disable(), n == null || n.remove(h, m);
99
+ }, v = () => {
100
+ M(), s.length !== 2 && (n == null || n.remove(i)), f(new Error("Cancelled"));
101
+ };
102
+ t.on("select", g), t.on("intersectionUpdate", L), t.on("disable", v);
103
+ });
104
+ }
105
+ export {
106
+ Q as Line
107
+ };
@@ -30,6 +30,6 @@ export declare class Point extends BaseObject<PointImportData> {
30
30
  /**
31
31
  * @description: 创建点
32
32
  */
33
- create(params?: PointStyle): Promise<void>;
33
+ create(params?: Partial<PointStyle>): Promise<void>;
34
34
  }
35
35
  export declare function createPoint(pointMesh: PointMesh, pointSelector: PointSelector): Promise<void>;
@@ -1,8 +1,8 @@
1
1
  import type { Polygon } from '.';
2
2
  import type { FiveDomEvent } from '../../../shared-utils/five/FiveDomEvents';
3
- import { LineEditor } from '../Polyline/Editor';
4
3
  import * as THREE from 'three';
5
- export declare class PolygonEditor extends LineEditor<Polygon> {
4
+ import { LineEditorAbstract } from '../Line/Editor';
5
+ export declare class PolygonEditor extends LineEditorAbstract<Polygon> {
6
6
  get points(): THREE.Vector3[];
7
7
  constructor(originObject: Polygon);
8
8
  protected onDrag: (event: FiveDomEvent) => void;
@@ -1,16 +1,16 @@
1
1
  var a = Object.defineProperty;
2
- var g = (o, i, t) => i in o ? a(o, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[i] = t;
3
- var s = (o, i, t) => (g(o, typeof i != "symbol" ? i + "" : i, t), t);
4
- import { Sculpt as c } from "../../index.js";
2
+ var c = (o, i, t) => i in o ? a(o, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[i] = t;
3
+ var s = (o, i, t) => (c(o, typeof i != "symbol" ? i + "" : i, t), t);
4
+ import { Sculpt as g } from "../../index.js";
5
5
  import { getIntersectByRaycaster as p } from "../../../shared-utils/five/getPosition.js";
6
- import { LineEditor as h } from "../Polyline/Editor.js";
6
+ import { LineEditorAbstract as h } from "../Line/Editor.js";
7
7
  class f extends h {
8
8
  constructor(t) {
9
9
  super(t);
10
10
  s(this, "onDrag", (t) => {
11
11
  if (!this.draggingPoints || this.draggingPoints.length === 0)
12
12
  return;
13
- const e = p(c.modules.five, t.raycaster, { virtualPoint: !0 }), n = this.originObject.areaMesh.projectPoint(e.point);
13
+ const e = p(g.modules.five, t.raycaster, { virtualPoint: !0 }), n = this.originObject.areaMesh.projectPoint(e.point);
14
14
  this.draggingPoints.forEach((r) => r.position.copy(n)), this.originObject.areaMesh.setPoints(this.pointMeshes.map((r) => r.position));
15
15
  });
16
16
  }
@@ -3,6 +3,7 @@ import { AreaMesh, type AreaStyle } from '../../Meshes/Area';
3
3
  import type { PointSelector } from '../../../shared-utils/three/PointSelector';
4
4
  import type { LiteralString } from '../../../typings/utils.type';
5
5
  import type { PolygonData, PolygonStyle } from '../../Meshes/Polygon';
6
+ import type { LimitPlaneConfig } from '../../typings/style';
6
7
  export interface PolygonImportData extends BaseImportData, PolygonData {
7
8
  type: LiteralString<'Polygon'>;
8
9
  style?: Partial<AreaStyle>;
@@ -23,6 +24,6 @@ export declare class Polygon extends BaseObject<PolygonImportData> {
23
24
  constructor(data?: PolygonImportData, config?: Partial<BaseObjectConfig>);
24
25
  highlight(): void;
25
26
  unhighlight(): void;
26
- create(params?: Partial<PolygonStyle>): Promise<void>;
27
+ create(params?: Partial<PolygonStyle & LimitPlaneConfig>): Promise<void>;
27
28
  }
28
- export declare function createPolygon(areaMesh: AreaMesh, pointSelector: PointSelector): Promise<void>;
29
+ export declare function createPolygon(areaMesh: AreaMesh, pointSelector: PointSelector, config?: Partial<LimitPlaneConfig>): Promise<void>;
@@ -1,50 +1,52 @@
1
- var H = Object.defineProperty, T = Object.defineProperties;
2
- var j = Object.getOwnPropertyDescriptors;
3
- var b = Object.getOwnPropertySymbols;
4
- var A = Object.prototype.hasOwnProperty, D = Object.prototype.propertyIsEnumerable;
5
- var g = (i, t, e) => t in i ? H(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, c = (i, t) => {
6
- for (var e in t || (t = {}))
7
- A.call(t, e) && g(i, e, t[e]);
8
- if (b)
9
- for (var e of b(t))
10
- D.call(t, e) && g(i, e, t[e]);
11
- return i;
12
- }, W = (i, t) => T(i, j(t));
13
- var m = (i, t, e) => (g(i, typeof t != "symbol" ? t + "" : t, e), e);
14
- var E = (i, t, e) => new Promise((r, s) => {
15
- var d = (o) => {
1
+ var F = Object.defineProperty, L = Object.defineProperties;
2
+ var N = Object.getOwnPropertyDescriptors;
3
+ var x = Object.getOwnPropertySymbols;
4
+ var O = Object.prototype.hasOwnProperty, U = Object.prototype.propertyIsEnumerable;
5
+ var u = (o, e, t) => e in o ? F(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, g = (o, e) => {
6
+ for (var t in e || (e = {}))
7
+ O.call(e, t) && u(o, t, e[t]);
8
+ if (x)
9
+ for (var t of x(e))
10
+ U.call(e, t) && u(o, t, e[t]);
11
+ return o;
12
+ }, j = (o, e) => L(o, N(e));
13
+ var y = (o, e, t) => (u(o, typeof e != "symbol" ? e + "" : e, t), t);
14
+ var T = (o, e, t) => new Promise((f, d) => {
15
+ var n = (l) => {
16
16
  try {
17
- n(e.next(o));
18
- } catch (a) {
19
- s(a);
17
+ h(t.next(l));
18
+ } catch (s) {
19
+ d(s);
20
20
  }
21
- }, l = (o) => {
21
+ }, p = (l) => {
22
22
  try {
23
- n(e.throw(o));
24
- } catch (a) {
25
- s(a);
23
+ h(t.throw(l));
24
+ } catch (s) {
25
+ d(s);
26
26
  }
27
- }, n = (o) => o.done ? r(o.value) : Promise.resolve(o.value).then(d, l);
28
- n((e = e.apply(i, t)).next());
27
+ }, h = (l) => l.done ? f(l.value) : Promise.resolve(l.value).then(n, p);
28
+ h((t = t.apply(o, e)).next());
29
29
  });
30
- import { hotkeys as L } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
31
- import { BaseObject as O } from "../Base/index.js";
32
- import { PolylineMesh as x } from "../../Meshes/Polyline.js";
33
- import { AreaMesh as M } from "../../Meshes/Area.js";
34
- import { PolygonEditor as U } from "./Editor.js";
35
- import { vector3ToArray as k } from "../../../shared-utils/three/vector3ToArray.js";
36
- class K extends O {
37
- constructor(e, r) {
38
- super(e, r);
39
- m(this, "type", "Polygon");
40
- m(this, "areaMesh");
41
- this.editor = new U(this), e && (this.areaMesh = new M(c(c({}, e.style), e)), this.add(this.areaMesh)), L("esc", () => {
30
+ import { hotkeys as k } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
31
+ import { BaseObject as z } from "../Base/index.js";
32
+ import * as P from "three";
33
+ import { PolylineMesh as A } from "../../Meshes/Polyline.js";
34
+ import { AreaMesh as V } from "../../Meshes/Area.js";
35
+ import { PolygonEditor as B } from "./Editor.js";
36
+ import { vector3ToArray as H } from "../../../shared-utils/three/vector3ToArray.js";
37
+ const D = new P.Vector3();
38
+ class X extends z {
39
+ constructor(t, f) {
40
+ super(t, f);
41
+ y(this, "type", "Polygon");
42
+ y(this, "areaMesh");
43
+ this.editor = new B(this), t && (this.areaMesh = new V(g(g({}, t.style), t)), this.add(this.areaMesh)), k("esc", () => {
42
44
  this.stopCreating();
43
45
  });
44
46
  }
45
47
  get data() {
46
- return W(c({}, this.baseData), {
47
- points: k(this.applyObjectMatrixWorld(this.areaMesh.points)),
48
+ return j(g({}, this.baseData), {
49
+ points: H(this.applyObjectMatrixWorld(this.areaMesh.points)),
48
50
  style: {
49
51
  color: this.areaMesh.color.getHex(),
50
52
  lineColor: this.areaMesh.lineColor.getHex(),
@@ -53,61 +55,59 @@ class K extends O {
53
55
  });
54
56
  }
55
57
  highlight() {
56
- var e;
57
- (e = this.areaMesh) == null || e.highlight();
58
+ var t;
59
+ (t = this.areaMesh) == null || t.highlight();
58
60
  }
59
61
  unhighlight() {
60
- var e;
61
- (e = this.areaMesh) == null || e.unhighlight();
62
+ var t;
63
+ (t = this.areaMesh) == null || t.unhighlight();
62
64
  }
63
- create(e) {
64
- return E(this, null, function* () {
65
- this.children.forEach((s) => {
66
- s.parent === this && this.remove(s);
65
+ create(t) {
66
+ return T(this, null, function* () {
67
+ this.children.forEach((d) => {
68
+ d.parent === this && this.remove(d);
67
69
  }), this.children.length = 0;
68
- const r = new M(e);
69
- this.areaMesh = r, this.add(this.areaMesh), yield B(this.areaMesh, this.pointSelector), this.editor.enable();
70
+ const f = new V(t);
71
+ this.areaMesh = f, this.add(this.areaMesh), yield I(this.areaMesh, this.pointSelector, t), this.editor.enable();
70
72
  });
71
73
  }
72
74
  }
73
- function B(i, t) {
74
- return new Promise((e, r) => {
75
- const s = i.parent;
76
- if (!s) {
77
- r(new Error("No container"));
75
+ function I(o, e, t) {
76
+ return new Promise((f, d) => {
77
+ var M;
78
+ const n = o.parent;
79
+ if (!n) {
80
+ d(new Error("No container"));
78
81
  return;
79
82
  }
80
- const d = new x({ dashed: !0, lineColor: i.lineColor, lineWidth: i.lineWidth });
81
- s == null || s.add(d);
82
- const l = new x({ dashed: !0, lineColor: i.lineColor, lineWidth: i.lineWidth });
83
- s == null || s.add(l), t.enable();
84
- const n = [];
85
- let o, a = !1;
86
- const u = (h) => {
87
- const f = n.length === 0 ? h.point : o.clone();
88
- n.push(f.clone()), i.setPoints(n, { closed: !1 }), a && (y(), e());
89
- }, P = (h) => {
90
- var v;
91
- if (!((v = i.points) != null && v.length) || !h)
83
+ const p = (M = t == null ? void 0 : t.limit) != null ? M : "none", h = new A({ dashed: !0, lineColor: o.lineColor, lineWidth: o.lineWidth });
84
+ n == null || n.add(h);
85
+ const l = new A({ dashed: !0, lineColor: o.lineColor, lineWidth: o.lineWidth });
86
+ n == null || n.add(l), e.enable();
87
+ const s = [];
88
+ let i, a, w = !1;
89
+ const C = (r) => {
90
+ const c = s.length === 0 ? r.point : i.clone();
91
+ s.push(c), o.setPoints(s, { closed: !1 }), w && (b(), f());
92
+ }, v = (r) => {
93
+ if (!(s != null && s.length) || !r)
92
94
  return;
93
- const f = n.at(-1).clone();
94
- if (i.points.length <= 2)
95
- o = h.point, d.setPoints([f, o]), s != null && s.children.includes(l) && s.remove(l);
96
- else {
97
- o = i.projectPoint(h.point);
98
- const p = i.points[0], C = 0.2;
99
- p.distanceTo(o) < C || p.distanceTo(h.point) < C ? (o = p, h.point.copy(p), t.pointSelectorHelper.updateWithIntersect(h, { emitEvent: !1 }), a = !0) : a = !1, l.setPoints([o, h.point]), s != null && s.children.includes(l) || s == null || s.add(l);
95
+ const c = s.at(-1).clone();
96
+ if (s.length < 3 && (p === "none" ? (i = r.point, h.setPoints([c, i])) : p === "xoz" ? (a = a != null ? a : new P.Plane().setFromNormalAndCoplanarPoint(new P.Vector3(0, 1, 0), s[0]), i = a.projectPoint(r.point, D), h.setPoints([c, i]), l.setPoints([i, r.point])) : p === "y" && (s.length === 1 ? (i = r.point, h.setPoints([c, i])) : (a = a != null ? a : new P.Plane().setFromCoplanarPoints(s[0], s[1], new P.Vector3(0, 1, 0).add(s[0])), i = a.projectPoint(r.point, D), h.setPoints([c, i]), l.setPoints([i, r.point])))), s.length >= 3) {
97
+ i = o.projectPoint(r.point);
98
+ const m = s[0], W = 0.2;
99
+ m.distanceTo(i) < W || m.distanceTo(r.point) < W ? (i = m, r.point.copy(m), e.pointSelectorHelper.updateWithIntersect(r, { emitEvent: !1 }), w = !0) : w = !1, h.setPoints([c, i]), l.setPoints([i, r.point]);
100
100
  }
101
- d.setPoints([f, o]), n.length >= 2 && i.setPoints([...n, o], { closed: !1 });
102
- }, y = () => {
103
- t.off("select", u), t.off("intersectionUpdate", P), t.off("disable", w), t.disable(), s == null || s.remove(d, l);
104
- }, w = () => {
105
- y(), s == null || s.remove(i, l, d), r(new Error("Cancelled"));
101
+ s.length >= 2 && o.setPoints([...s, i], { closed: !1 });
102
+ }, b = () => {
103
+ e.off("select", C), e.off("intersectionUpdate", v), e.off("disable", E), e.disable(), n == null || n.remove(h, l);
104
+ }, E = () => {
105
+ b(), n == null || n.remove(o, l, h), d(new Error("Cancelled"));
106
106
  };
107
- t.on("select", u), t.on("intersectionUpdate", P), t.on("disable", w);
107
+ e.on("select", C), e.on("intersectionUpdate", v), e.on("disable", E);
108
108
  });
109
109
  }
110
110
  export {
111
- K as Polygon,
112
- B as createPolygon
111
+ X as Polygon,
112
+ I as createPolygon
113
113
  };
@@ -1,22 +1,8 @@
1
- import { BaseEditor } from '../Base/Editor';
2
1
  import type { FiveDomEvent } from '../../../shared-utils/five/FiveDomEvents';
3
2
  import type { Polyline } from '.';
4
- import type * as THREE from 'three';
5
- import { PointMesh } from '../../Meshes/Point';
6
- export declare abstract class LineEditor<OriginObject extends THREE.Object3D = THREE.Object3D> extends BaseEditor<OriginObject> {
7
- protected draggingPoints: PointMesh[];
8
- protected get pointMeshes(): PointMesh[];
9
- abstract get points(): THREE.Vector3[];
10
- get pointHandles(): PointMesh[];
11
- constructor(originObject: OriginObject);
12
- enable(): void;
13
- disable(): void;
14
- protected onDragstart: (event: FiveDomEvent) => void;
15
- protected onDragend: (event: FiveDomEvent) => void;
16
- protected abstract onDrag(event: FiveDomEvent): void;
17
- }
18
- export declare class PolylineEditor extends LineEditor<Polyline> {
19
- get points(): THREE.Vector3[];
3
+ import { LineEditorAbstract } from '../Line/Editor';
4
+ export declare class PolylineEditor extends LineEditorAbstract<Polyline> {
5
+ get points(): import("three").Vector3[];
20
6
  constructor(originObject: Polyline);
21
7
  protected onDrag: (event: FiveDomEvent) => void;
22
8
  }