@realsee/dnalogel 3.78.0-alpha.3 → 3.78.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 (148) hide show
  1. package/CHANGELOG.md +40 -10
  2. package/dist/DigitalPerformancePlugin/controller/index.d.ts +224 -0
  3. package/dist/DigitalPerformancePlugin/core/DigitalHuman.d.ts +55 -0
  4. package/dist/DigitalPerformancePlugin/core/DigitalPlayground.d.ts +40 -0
  5. package/dist/DigitalPerformancePlugin/core/DigitalStateMachine.d.ts +150 -0
  6. package/dist/DigitalPerformancePlugin/core/Trace.d.ts +9 -0
  7. package/dist/DigitalPerformancePlugin/index.d.ts +11 -0
  8. package/dist/DigitalPerformancePlugin/mock.d.ts +76 -0
  9. package/dist/DigitalPerformancePlugin/typings/index.d.ts +79 -0
  10. package/dist/PanoTagPlugin/controller/Tag/MaskTag.shaders.d.ts +0 -6
  11. package/dist/PanoTagPlugin/typings/tag/TagConfig.d.ts +20 -2
  12. package/dist/PanoTagPlugin/utils/tagPosition.d.ts +2 -1
  13. package/dist/Sculpt/Meshes/Line.d.ts +4 -0
  14. package/dist/Sculpt/Objects/Base/Editor.d.ts +9 -2
  15. package/dist/index.cjs.js +101 -88
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +14196 -12441
  18. package/dist/index.umd.js +83 -70
  19. package/dist/shared-utils/five/getFiveFromParentChain.d.ts +8 -0
  20. package/libs/AreaMakerPlugin/Controller.js +3 -2
  21. package/libs/AreaMakerPlugin/index.js +3 -2
  22. package/libs/AreaMakerPlugin/utils/Item.js +3 -2
  23. package/libs/CSS3DRenderPlugin/Controller.js +3 -2
  24. package/libs/CSS3DRenderPlugin/index.js +6 -5
  25. package/libs/CSS3DRenderPlugin/utils/three/CSS3DObject.js +39 -38
  26. package/libs/CSS3DRenderPlugin/utils/three/CSS3DRender.js +10 -9
  27. package/libs/CruisePlugin/BaseController.js +5 -4
  28. package/libs/CruisePlugin/Move.js +3 -2
  29. package/libs/CruisePlugin/Work.js +3 -2
  30. package/libs/CruisePlugin/index.js +7 -6
  31. package/libs/CurrentPanoImagePlugin/Controller.js +15 -14
  32. package/libs/CurrentPanoImagePlugin/index.js +4 -3
  33. package/libs/DigitalPerformancePlugin/controller/index.d.ts +2 -2
  34. package/libs/DigitalPerformancePlugin/controller/index.js +164 -173
  35. package/libs/DigitalPerformancePlugin/core/DigitalHuman.d.ts +16 -6
  36. package/libs/DigitalPerformancePlugin/core/DigitalHuman.js +128 -102
  37. package/libs/DigitalPerformancePlugin/core/DigitalPlayground.d.ts +11 -5
  38. package/libs/DigitalPerformancePlugin/core/DigitalPlayground.js +84 -74
  39. package/libs/DigitalPerformancePlugin/core/DigitalStateMachine.d.ts +7 -0
  40. package/libs/DigitalPerformancePlugin/mock.d.ts +6 -0
  41. package/libs/DigitalPerformancePlugin/mock.js +272 -274
  42. package/libs/GuideLinePlugin/Controller.js +7 -6
  43. package/libs/GuideLinePlugin/GuideLineItem.js +5 -4
  44. package/libs/GuideLinePlugin/GuideLineModeItem/index.js +51 -48
  45. package/libs/GuideLinePlugin/GuideLineModeItem.js +5 -2
  46. package/libs/GuideLinePlugin/index.js +7 -6
  47. package/libs/MeasurePlugin/Controller.js +11 -10
  48. package/libs/MeasurePlugin/index.js +5 -4
  49. package/libs/MeasurePlugin/utils/MeasureMesh.js +3 -2
  50. package/libs/ModelChassisCompassPlugin/Plugin.js +4 -3
  51. package/libs/ModelChassisCompassPlugin/index.js +1 -0
  52. package/libs/ModelEntryDoorGuidePlugin/Plugin.js +6 -5
  53. package/libs/ModelEntryDoorGuidePlugin/index.js +1 -0
  54. package/libs/ModelMakerPlugin/Controller.js +3 -2
  55. package/libs/ModelMakerPlugin/index.js +3 -2
  56. package/libs/ModelMakerPlugin/item/baseItem.js +3 -2
  57. package/libs/ModelMakerPlugin/item/boxItem.js +3 -2
  58. package/libs/ModelMakerPlugin/item/polygonItem.js +3 -2
  59. package/libs/ModelMakerPlugin/item/prismItem.js +3 -2
  60. package/libs/ModelTVVideoPlugin/Plugin.js +4 -3
  61. package/libs/ModelTVVideoPlugin/index.js +3 -2
  62. package/libs/ModelViewPlugin/Plugin.js +20 -19
  63. package/libs/ModelViewPlugin/index.js +1 -0
  64. package/libs/Object3DHelperPlugin/Controller.js +3 -2
  65. package/libs/Object3DHelperPlugin/index.js +6 -5
  66. package/libs/PanoCompassPlugin/Controller.js +3 -2
  67. package/libs/PanoCompassPlugin/index.js +4 -3
  68. package/libs/PanoDoorLabelPlugin/Controller.js +24 -23
  69. package/libs/PanoDoorLabelPlugin/index.js +4 -3
  70. package/libs/PanoMeasurePlugin/Components/Controller0.js +3 -2
  71. package/libs/PanoMeasurePlugin/Components/Controller1.js +3 -2
  72. package/libs/PanoMeasurePlugin/Controller/EditController.js +3 -2
  73. package/libs/PanoMeasurePlugin/Controller/WatchController.js +3 -2
  74. package/libs/PanoMeasurePlugin/Controller/index.js +3 -2
  75. package/libs/PanoMeasurePlugin/Model/area.js +3 -2
  76. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +1 -0
  77. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +16 -15
  78. package/libs/PanoMeasurePlugin/index.js +14 -13
  79. package/libs/PanoMeasurePlugin/utils/dom/areaDom.js +3 -2
  80. package/libs/PanoRulerProPlugin/Controller.js +3 -2
  81. package/libs/PanoRulerProPlugin/RulerItems.js +42 -41
  82. package/libs/PanoRulerProPlugin/index.js +4 -3
  83. package/libs/PanoSpatialTagPlugin/Plugin.js +34 -33
  84. package/libs/PanoSpatialTagPlugin/index.js +1 -0
  85. package/libs/PanoTagPlugin/Components/Common/TagPoint.js +141 -138
  86. package/libs/PanoTagPlugin/Components/Common/TagPopover/PopoverContent.js +3 -2
  87. package/libs/PanoTagPlugin/Components/Common/TagPopover/TagPopoverToolBar.js +3 -2
  88. package/libs/PanoTagPlugin/Components/Common/TagPopover/index.js +3 -2
  89. package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +3 -2
  90. package/libs/PanoTagPlugin/Components/Tag/index.js +3 -2
  91. package/libs/PanoTagPlugin/Components/TagContainer.js +3 -2
  92. package/libs/PanoTagPlugin/Components/TagItem.js +131 -122
  93. package/libs/PanoTagPlugin/controller/Tag/BaseTag.js +50 -49
  94. package/libs/PanoTagPlugin/controller/Tag/BoxTag.js +69 -65
  95. package/libs/PanoTagPlugin/controller/Tag/MaskTag.js +1 -0
  96. package/libs/PanoTagPlugin/controller/Tag/MaskTag.shaders.d.ts +0 -6
  97. package/libs/PanoTagPlugin/controller/Tag/MaskTag.shaders.js +2 -90
  98. package/libs/PanoTagPlugin/controller/Tag/ModelTag.js +3 -2
  99. package/libs/PanoTagPlugin/controller/Tag/PlaneTag.js +3 -2
  100. package/libs/PanoTagPlugin/controller/Tag/PointTag.js +3 -2
  101. package/libs/PanoTagPlugin/controller/Tag/PolygonTag.js +31 -29
  102. package/libs/PanoTagPlugin/controller/TagRender.js +3 -2
  103. package/libs/PanoTagPlugin/controller/TagUtil.js +3 -2
  104. package/libs/PanoTagPlugin/controller/index.js +30 -29
  105. package/libs/PanoTagPlugin/index.js +12 -11
  106. package/libs/PanoTagPlugin/typings/tag/TagConfig.d.ts +20 -2
  107. package/libs/PanoTagPlugin/utils/index.js +31 -30
  108. package/libs/PanoTagPlugin/utils/tag/calculateTagConfig.js +3 -2
  109. package/libs/PanoTagPlugin/utils/tag/format.js +3 -2
  110. package/libs/PanoTagPlugin/utils/tagPosition.d.ts +2 -1
  111. package/libs/PanoTagPlugin/utils/tagPosition.js +34 -32
  112. package/libs/PanoVideoPlugin/Controller.js +9 -8
  113. package/libs/PanoVideoPlugin/VideoMeshController.js +3 -2
  114. package/libs/PanoVideoPlugin/index.js +6 -5
  115. package/libs/PipelinePlugin/Controller.js +3 -2
  116. package/libs/PipelinePlugin/index.js +4 -3
  117. package/libs/PipelinePlugin/utils/Objects/FlowPipe.js +3 -2
  118. package/libs/PipelinePlugin/utils/Objects/HighlightPipe.js +3 -2
  119. package/libs/PipelinePlugin/utils/Objects/Pipe.js +1 -0
  120. package/libs/Sculpt/Meshes/Line.d.ts +4 -0
  121. package/libs/Sculpt/Meshes/Line.js +85 -76
  122. package/libs/Sculpt/Meshes/Point.js +28 -28
  123. package/libs/Sculpt/Meshes/Polygon.js +43 -43
  124. package/libs/Sculpt/Objects/Base/Editor.d.ts +9 -2
  125. package/libs/Sculpt/Objects/Base/Editor.js +72 -63
  126. package/libs/Sculpt/index.js +1 -1
  127. package/libs/Sculpt/utils/Modules/Cursor.js +7 -7
  128. package/libs/base/BasePlugin.js +5 -5
  129. package/libs/floorplan/FloorplanGuidePlugin/Controller.js +3 -2
  130. package/libs/floorplan/FloorplanGuidePlugin/index.js +4 -3
  131. package/libs/floorplan/MapviewFloorplanPlugin/Controller.js +3 -2
  132. package/libs/floorplan/MapviewFloorplanPlugin/index.js +4 -3
  133. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +3 -2
  134. package/libs/floorplan/ModelFloorplanPlugin/index.js +4 -3
  135. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +3 -2
  136. package/libs/floorplan/PanoFloorplanRadarPlugin/index.js +4 -3
  137. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +3 -2
  138. package/libs/floorplan/TopviewFloorplanPlugin/index.js +4 -3
  139. package/libs/index.d.ts +1 -0
  140. package/libs/index.js +162 -150
  141. package/libs/shared-utils/five/getFiveFromParentChain.d.ts +8 -0
  142. package/libs/shared-utils/five/getFiveFromParentChain.js +20 -0
  143. package/libs/shared-utils/logger.js +1 -1
  144. package/libs/shared-utils/three/PointSelector/utils/PointHelper2.js +1 -0
  145. package/libs/shared-utils/url/replace-static-prefix.js +12 -7
  146. package/package.json +3 -3
  147. package/libs/PanoTagPlugin/controller/Tag/MaskTag1.d.ts +0 -202
  148. package/libs/PanoTagPlugin/controller/Tag/MaskTag1.js +0 -617
@@ -1,10 +1,10 @@
1
1
  var Q = Object.defineProperty, Y = Object.defineProperties;
2
2
  var ee = Object.getOwnPropertyDescriptors;
3
3
  var V = Object.getOwnPropertySymbols;
4
- var N = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
5
- var k = Math.pow, D = (g, t, e) => t in g ? Q(g, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[t] = e, y = (g, t) => {
4
+ var $ = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
5
+ var P = Math.pow, D = (g, t, e) => t in g ? Q(g, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[t] = e, y = (g, t) => {
6
6
  for (var e in t || (t = {}))
7
- N.call(t, e) && D(g, e, t[e]);
7
+ $.call(t, e) && D(g, e, t[e]);
8
8
  if (V)
9
9
  for (var e of V(t))
10
10
  z.call(t, e) && D(g, e, t[e]);
@@ -13,7 +13,7 @@ var k = Math.pow, D = (g, t, e) => t in g ? Q(g, t, { enumerable: !0, configurab
13
13
  var W = (g, t) => {
14
14
  var e = {};
15
15
  for (var i in g)
16
- N.call(g, i) && t.indexOf(i) < 0 && (e[i] = g[i]);
16
+ $.call(g, i) && t.indexOf(i) < 0 && (e[i] = g[i]);
17
17
  if (g != null && V)
18
18
  for (var i of V(g))
19
19
  t.indexOf(i) < 0 && z.call(g, i) && (e[i] = g[i]);
@@ -41,13 +41,13 @@ import { calculateTagConfig as R } from "../../utils/tag/calculateTagConfig.js";
41
41
  import { getTagStickType as ie } from "../../utils/tag/format.js";
42
42
  import "../../../shared-utils/tag.js";
43
43
  import { isPanoramaLike as E, isModelLike as B } from "../../../shared-utils/five/mode.js";
44
- import * as C from "three";
44
+ import * as k from "three";
45
45
  import "../../../vendor/hammerjs/hammer.js";
46
46
  import "../../../shared-utils/three/PointSelector/index.js";
47
47
  import { centerPoint as ne } from "../../../shared-utils/three/centerPoint.js";
48
48
  import "../../../shared-utils/three/CSS3DRenderer/index.js";
49
49
  import "../../../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
50
- import { anyPositionToVector3 as M } from "../../../shared-utils/positionToVector3.js";
50
+ import { anyPositionToVector3 as w } from "../../../shared-utils/positionToVector3.js";
51
51
  import { toArray as se } from "../../../shared-utils/util.js";
52
52
  import "@realsee/five/line";
53
53
  import { isNil as J, notNil as H } from "../../../shared-utils/isNil.js";
@@ -58,19 +58,19 @@ import "../../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
58
58
  import "../../../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
59
59
  import "../../../vendor/earcut/src/earcut.js";
60
60
  import { vectorToCoordinates as le } from "../../../shared-utils/vectorToCoordinate.js";
61
- import { transformPosition as T } from "../../../shared-utils/five/transformPosition.js";
61
+ import { transformPosition as O } from "../../../shared-utils/five/transformPosition.js";
62
62
  import { lookPoint as ae } from "../../../shared-utils/five/lookPoint.js";
63
63
  import { uuid as fe } from "../../../shared-utils/uuid.js";
64
64
  import "../../../shared-utils/five/FivePuppet.js";
65
- import { objectAssignDeepExports as w } from "../../../vendor/object-assign-deep/objectAssignDeep.js";
65
+ import { objectAssignDeepExports as T } from "../../../vendor/object-assign-deep/objectAssignDeep.js";
66
66
  import { getTagPosition as q, getTagCenterPosition as X } from "../../utils/tagPosition.js";
67
67
  import { checkRange as S } from "../../utils/checkRange.js";
68
- import { isMediaPlaneTag as Z, isMediaModelTag as O } from "../../utils/tag/tagCheck.js";
68
+ import { isMediaPlaneTag as Z, isMediaModelTag as _ } from "../../utils/tag/tagCheck.js";
69
69
  import { getUrlExt as G } from "../../../shared-utils/url/getUrl.js";
70
70
  import { getFloorIndex as de } from "../../../shared-utils/five/getFloorIndex.js";
71
71
  import { safeObj as K } from "../../../shared-utils/safeObj.js";
72
72
  import { Cache as ce } from "../../utils/Cache.js";
73
- import { _raycaster as _ } from "../../../shared-utils/three/temp.js";
73
+ import { _raycaster as N } from "../../../shared-utils/three/temp.js";
74
74
  import { withResolvers as ue } from "../../../shared-utils/promise/withResolvers.js";
75
75
  import "../../../shared-utils/typescript/entries.js";
76
76
  import "../../utils/tag/adaptConfig.js";
@@ -105,6 +105,7 @@ import "../../../Sculpt/typings/style.js";
105
105
  import "../../../shared-utils/three/IObject3D.js";
106
106
  import "../../../Sculpt/utils/Meshes/getLengthHTML.js";
107
107
  import "../../../shared-utils/three/applyObjectMatrixWorld.js";
108
+ import "../../../shared-utils/five/getFiveFromParentChain.js";
108
109
  import "../../../shared-utils/three/core/LineGeometry.js";
109
110
  import "../../../shared-utils/three/core/LineMaterial.js";
110
111
  import "../../../shared-utils/three/core/Line2.js";
@@ -122,7 +123,7 @@ import "../../../CSS3DRenderPlugin/utils/three/CSS3DScene.js";
122
123
  import "../../../CSS3DRenderPlugin/utils/getAllCSS3DObject.js";
123
124
  import "../../../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
124
125
  import "../../../shared-utils/formatRad.js";
125
- class Jt {
126
+ class Ht {
126
127
  constructor(t, e) {
127
128
  a(this, "plugin");
128
129
  a(this, "id");
@@ -189,14 +190,14 @@ class Jt {
189
190
  const s = JSON.parse(JSON.stringify(e.data)), o = (f = e.initialConfig) != null ? f : e.config ? JSON.parse(JSON.stringify(e.config)) : {};
190
191
  e.initialConfig = o;
191
192
  const l = R(e, t.config), r = this.getConfig(e);
192
- e.config = r, this.id = (m = e.id) != null ? m : fe(), this.enabled = (p = e.enabled) != null ? p : !0, this.contentType = e.contentType, this.hoverEnabled = (c = (d = r.popoverConfig) == null ? void 0 : d.enabled) != null ? c : !0, this.data = (u = r.initialData) != null && u.important ? w(e.data, s, r.initialData) : w(e.data, r.initialData, s);
193
+ e.config = r, this.id = (m = e.id) != null ? m : fe(), this.enabled = (p = e.enabled) != null ? p : !0, this.contentType = e.contentType, this.hoverEnabled = (c = (d = r.popoverConfig) == null ? void 0 : d.enabled) != null ? c : !0, this.data = (u = r.initialData) != null && u.important ? T(e.data, s, r.initialData) : T(e.data, r.initialData, s);
193
194
  let n;
194
195
  typeof r.unfoldedConfig == "object" ? r.unfoldedConfig.keep === "unfolded" ? n = !0 : r.unfoldedConfig.keep === "folded" ? n = !1 : n = !this.can("fold") : n = !this.can("fold"), this.state = y({
195
196
  visible: void 0,
196
197
  unfolded: n
197
198
  }, r.initialState), this.isPopoverConfigEnabled() && (this.state.unfolded = !1), this.normalLineLength = (b = (v = e.style) == null ? void 0 : v.point) == null ? void 0 : b.normalLen, this.originPosition = e.position, e.originPosition = this.originPosition, this.position = (() => {
198
199
  var U;
199
- const h = e.originPosition, P = t.workUtil.transform;
200
+ const h = e.originPosition, x = t.workUtil.transform;
200
201
  if (e.stickType === "3DBox") {
201
202
  if (!h)
202
203
  return {
@@ -204,25 +205,25 @@ class Jt {
204
205
  end: [0, 0, 0],
205
206
  rotation: [0, 0, 0]
206
207
  };
207
- const { start: x, end: A, rotation: F } = h;
208
+ const { start: C, end: A, rotation: F } = h;
208
209
  return {
209
- start: T(M(x), P).toArray(),
210
- end: T(M(A), P).toArray(),
211
- rotation: M(F).toArray()
210
+ start: w(C.map((I) => Number(I))).toArray(),
211
+ end: w(A.map((I) => Number(I))).toArray(),
212
+ rotation: w(F.map((I) => Number(I))).toArray()
212
213
  };
213
214
  }
214
215
  if (e.stickType === "Polygon")
215
- return h ? h.map(M).map((x) => T(x, P).toArray()) : [];
216
+ return h ? h.map(w).map((C) => O(C, x).toArray()) : [];
216
217
  if (!h)
217
218
  return;
218
- let I = h;
219
- if (Array.isArray(h) && h.length === 4 ? I = h.map(M).map((x) => T(x, P).toArray()) : I = T(M(h), P).toArray(), (e.stickType === "2DPoint" || e.stickType === "3DPoint") && ((U = r == null ? void 0 : r.tagNormalLineConfig) != null && U.enabled) && e.normal && this.normalLineLength) {
220
- const x = new C.Vector3().fromArray(e.normal);
221
- I = new C.Vector3().fromArray(I).clone().add(x.clone().setLength(this.normalLineLength)).toArray();
219
+ let M = h;
220
+ if (Array.isArray(h) && h.length === 4 ? M = h.map(w).map((C) => O(C, x).toArray()) : M = O(w(h), x).toArray(), (e.stickType === "2DPoint" || e.stickType === "3DPoint") && ((U = r == null ? void 0 : r.tagNormalLineConfig) != null && U.enabled) && e.normal && this.normalLineLength) {
221
+ const C = new k.Vector3().fromArray(e.normal);
222
+ M = new k.Vector3().fromArray(M).clone().add(C.clone().setLength(this.normalLineLength)).toArray();
222
223
  }
223
- return I;
224
+ return M;
224
225
  })(), this.matrix = e.matrix ? (() => {
225
- const h = new C.Matrix4().fromArray(e.matrix);
226
+ const h = new k.Matrix4().fromArray(e.matrix);
226
227
  return h.premultiply(t.workUtil.transform), h.elements;
227
228
  })() : e.matrix, this.initialConfig = o, this.computedConfig = l, this.stickType = i, this.config = e.config, this.fiveState = e.fiveState, this.normal = e.normal, this.cache = new ce(), this.hooks = new te(), Object.keys(e).forEach((h) => {
228
229
  this[h] === void 0 && e[h] !== void 0 && (this[h] = e[h]);
@@ -325,8 +326,8 @@ class Jt {
325
326
  c.push(this.dom), c.push((b = (v = this.tag3DContentSvelte) == null ? void 0 : v.css3DInstance) == null ? void 0 : b.container), c.push((h = this.model) == null ? void 0 : h.object), c.push(this.mediaPlane), c.push(this.boxShape), c.push(this.polygonShape);
326
327
  const u = this.getAdditionalBlinkTargets();
327
328
  if (u) {
328
- const P = Array.isArray(u) ? u : [u];
329
- c.push(...P);
329
+ const x = Array.isArray(u) ? u : [u];
330
+ c.push(...x);
330
331
  }
331
332
  return c.filter(Boolean);
332
333
  })();
@@ -398,7 +399,7 @@ class Jt {
398
399
  * @param deepMerge 是否深度合并 data,默认为 true
399
400
  */
400
401
  setData(t, e = !0) {
401
- e ? this.data = w(this.data, t) : this.data = y(y({}, this.data), t), this.hooks.emit("dataChanged", this.data);
402
+ e ? this.data = T(this.data, t) : this.data = y(y({}, this.data), t), this.hooks.emit("dataChanged", this.data);
402
403
  }
403
404
  /**
404
405
  * @description 修改标签位置
@@ -411,7 +412,7 @@ class Jt {
411
412
  * @param deepMerge 是否深度合并 data,默认为 true
412
413
  */
413
414
  set(t, e = !0) {
414
- this.plugin.tagsLengthWillUpdate = !0, e ? w(this, t) : Object.assign(this, t), this.cache.clear();
415
+ this.plugin.tagsLengthWillUpdate = !0, e ? T(this, t) : Object.assign(this, t), this.cache.clear();
415
416
  }
416
417
  updateConfig() {
417
418
  var i;
@@ -420,7 +421,7 @@ class Jt {
420
421
  const e = this.getConfig();
421
422
  if (this.config = e, this.config.initialData) {
422
423
  const s = JSON.parse(JSON.stringify(this.data));
423
- this.data = (i = e.initialData) != null && i.important ? w(this.data, s, e.initialData) : w(this.data, e.initialData, s);
424
+ this.data = (i = e.initialData) != null && i.important ? T(this.data, s, e.initialData) : T(this.data, e.initialData, s);
424
425
  }
425
426
  this.cache.clear();
426
427
  }
@@ -450,17 +451,17 @@ class Jt {
450
451
  if (!i || !i.start)
451
452
  return 1 / 0;
452
453
  const s = i.start;
453
- return k(s[0] - t.x, 2) + k(s[1] - t.y, 2) + k(s[2] - t.z, 2);
454
+ return P(s[0] - t.x, 2) + P(s[1] - t.y, 2) + P(s[2] - t.z, 2);
454
455
  }
455
456
  if (this.stickType === "Polygon") {
456
457
  const i = this.position;
457
458
  if (!i || i.length === 0)
458
459
  return 1 / 0;
459
460
  const s = i[0];
460
- return k(s[0] - t.x, 2) + k(s[1] - t.y, 2) + k(s[2] - t.z, 2);
461
+ return P(s[0] - t.x, 2) + P(s[1] - t.y, 2) + P(s[2] - t.z, 2);
461
462
  }
462
463
  let e;
463
- return this.position || console.log(this, "no position"), Array.isArray(this.position[0]) ? e = this.position[0] : e = this.position, k(e[0] - t.x, 2) + k(e[1] - t.y, 2) + k(e[2] - t.z, 2);
464
+ return this.position || console.log(this, "no position"), Array.isArray(this.position[0]) ? e = this.position[0] : e = this.position, P(e[0] - t.x, 2) + P(e[1] - t.y, 2) + P(e[2] - t.z, 2);
464
465
  }
465
466
  getVisible(t) {
466
467
  if (!this.enabled || !this.plugin.state.enabled || !this.fiveUtil.model)
@@ -519,7 +520,7 @@ class Jt {
519
520
  if (i[0].type === "Image")
520
521
  return G(i[0].url) === "gif" ? "Dom" : "Mesh";
521
522
  }
522
- } else if (O(this))
523
+ } else if (_(this))
523
524
  return i.length === 1 && i[0].type === "Image" ? G(i[0].url) === "gif" ? "Dom" : "Mesh" : "BehindDom";
524
525
  }
525
526
  })();
@@ -647,21 +648,21 @@ class Jt {
647
648
  );
648
649
  let l = 0, r = 0;
649
650
  for (const d of o) {
650
- const c = new C.Vector3().subVectors(d, s).normalize();
651
+ const c = new k.Vector3().subVectors(d, s).normalize();
651
652
  let u;
652
- _.set(s, c);
653
- const [v] = this.fiveUtil.model.intersectRaycaster(_);
653
+ N.set(s, c);
654
+ const [v] = this.fiveUtil.model.intersectRaycaster(N);
654
655
  u = v == null ? void 0 : v.distance;
655
656
  const b = (() => {
656
- if (!O(this))
657
+ if (!_(this))
657
658
  return;
658
- const x = this.plugin.tags.filter(O).map((F) => {
659
- var $;
660
- return ($ = F.model) == null ? void 0 : $.object;
661
- }).filter(H), [A] = _.intersectObjects(x, !0);
659
+ const C = this.plugin.tags.filter(_).map((F) => {
660
+ var I;
661
+ return (I = F.model) == null ? void 0 : I.object;
662
+ }).filter(H), [A] = N.intersectObjects(C, !0);
662
663
  return A;
663
- })(), h = s.distanceTo(d), P = (f = e.distanceAccuracy) != null ? f : 0.01;
664
- u = Math.min(u != null ? u : 1 / 0, (m = b == null ? void 0 : b.distance) != null ? m : 1 / 0), u + P >= h ? l++ : r++;
664
+ })(), h = s.distanceTo(d), x = (f = e.distanceAccuracy) != null ? f : 0.01;
665
+ u = Math.min(u != null ? u : 1 / 0, (m = b == null ? void 0 : b.distance) != null ? m : 1 / 0), u + x >= h ? l++ : r++;
665
666
  const U = (p = e.needPassed) != null ? p : 1;
666
667
  if (l >= U)
667
668
  return { value: !0 };
@@ -747,16 +748,16 @@ class Jt {
747
748
  if (t.autoUnfold.strategy === "FoldWhenMove")
748
749
  return !1;
749
750
  if (t.autoUnfold.strategy === "ScreenCenter") {
750
- const s = this.plugin.filterPointTag, o = new C.Matrix4();
751
+ const s = this.plugin.filterPointTag, o = new k.Matrix4();
751
752
  o.multiplyMatrices(this.five.camera.projectionMatrix, this.five.camera.matrixWorldInverse);
752
- const l = new C.Frustum();
753
+ const l = new k.Frustum();
753
754
  l.setFromProjectionMatrix(o);
754
- const r = this.five.camera.getWorldDirection(new C.Vector3()), f = s.filter((p) => {
755
+ const r = this.five.camera.getWorldDirection(new k.Vector3()), f = s.filter((p) => {
755
756
  var v, b;
756
757
  if (!p.currentVisible)
757
758
  return !1;
758
759
  const d = p.getConfig().unfoldedConfig;
759
- if (p.manuallyOperated || typeof d != "object" || (d == null ? void 0 : d.autoUnfold) === !1 || ((v = d == null ? void 0 : d.autoUnfold) == null ? void 0 : v.strategy) !== "ScreenCenter" || d.keep || ((b = d.autoUnfold) == null ? void 0 : b.enable) === !1 || !l.containsPoint(new C.Vector3().fromArray(p.position)))
760
+ if (p.manuallyOperated || typeof d != "object" || (d == null ? void 0 : d.autoUnfold) === !1 || ((v = d == null ? void 0 : d.autoUnfold) == null ? void 0 : v.strategy) !== "ScreenCenter" || d.keep || ((b = d.autoUnfold) == null ? void 0 : b.enable) === !1 || !l.containsPoint(new k.Vector3().fromArray(p.position)))
760
761
  return !1;
761
762
  const u = d.autoUnfold.distance;
762
763
  if (u) {
@@ -766,7 +767,7 @@ class Jt {
766
767
  }
767
768
  return !0;
768
769
  }).sort((p, d) => {
769
- const c = new C.Vector3().fromArray(p.position), u = new C.Vector3().fromArray(d.position);
770
+ const c = new k.Vector3().fromArray(p.position), u = new k.Vector3().fromArray(d.position);
770
771
  return r.angleTo(c.sub(this.five.camera.position)) - r.angleTo(u.sub(this.five.camera.position));
771
772
  }).findIndex((p) => p.id === this.id);
772
773
  if (f === -1 || f <= ((i = t.autoUnfold.maxNumber) != null ? i : 1) - 1 === !1)
@@ -838,5 +839,5 @@ class Jt {
838
839
  }
839
840
  }
840
841
  export {
841
- Jt as BaseTag
842
+ Ht as BaseTag
842
843
  };
@@ -1,35 +1,35 @@
1
- var w = Object.defineProperty;
2
- var S = Object.getOwnPropertySymbols;
3
- var V = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable;
4
- var f = (a, s, t) => s in a ? w(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t, x = (a, s) => {
5
- for (var t in s || (s = {}))
6
- V.call(s, t) && f(a, t, s[t]);
7
- if (S)
8
- for (var t of S(s))
9
- k.call(s, t) && f(a, t, s[t]);
1
+ var P = Object.defineProperty;
2
+ var b = Object.getOwnPropertySymbols;
3
+ var E = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
4
+ var S = (a, n, t) => n in a ? P(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t, y = (a, n) => {
5
+ for (var t in n || (n = {}))
6
+ E.call(n, t) && S(a, t, n[t]);
7
+ if (b)
8
+ for (var t of b(n))
9
+ B.call(n, t) && S(a, t, n[t]);
10
10
  return a;
11
11
  };
12
- var d = (a, s, t) => (f(a, typeof s != "symbol" ? s + "" : s, t), t);
13
- var b = (a, s, t) => new Promise((i, o) => {
14
- var e = (n) => {
12
+ var f = (a, n, t) => (S(a, typeof n != "symbol" ? n + "" : n, t), t);
13
+ var g = (a, n, t) => new Promise((i, o) => {
14
+ var e = (p) => {
15
15
  try {
16
- m(t.next(n));
17
- } catch (c) {
18
- o(c);
16
+ l(t.next(p));
17
+ } catch (h) {
18
+ o(h);
19
19
  }
20
- }, p = (n) => {
20
+ }, s = (p) => {
21
21
  try {
22
- m(t.throw(n));
23
- } catch (c) {
24
- o(c);
22
+ l(t.throw(p));
23
+ } catch (h) {
24
+ o(h);
25
25
  }
26
- }, m = (n) => n.done ? i(n.value) : Promise.resolve(n.value).then(e, p);
27
- m((t = t.apply(a, s)).next());
26
+ }, l = (p) => p.done ? i(p.value) : Promise.resolve(p.value).then(e, s);
27
+ l((t = t.apply(a, n)).next());
28
28
  });
29
- import { BaseTag as C } from "./BaseTag.js";
29
+ import { BaseTag as z } from "./BaseTag.js";
30
30
  import * as r from "three";
31
- import { Sculpt as P } from "../../../Sculpt/index.js";
32
- import { Box as E } from "../../../Sculpt/Objects/Box/index.js";
31
+ import { Sculpt as T } from "../../../Sculpt/index.js";
32
+ import { Box as D } from "../../../Sculpt/Objects/Box/index.js";
33
33
  import "../../../shared-utils/tag.js";
34
34
  import "../../../vendor/hammerjs/hammer.js";
35
35
  import "../../../shared-utils/three/PointSelector/index.js";
@@ -43,10 +43,11 @@ import "../../../shared-utils/three/blink.js";
43
43
  import "../../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
44
44
  import "../../../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
45
45
  import "../../../vendor/earcut/src/earcut.js";
46
- import { uuid as B } from "../../../shared-utils/uuid.js";
46
+ import { transformPosition as x } from "../../../shared-utils/five/transformPosition.js";
47
+ import { uuid as M } from "../../../shared-utils/uuid.js";
47
48
  import "../../../shared-utils/five/FivePuppet.js";
48
- import { getBoxCorners as z, applyMatrixToPoints as T } from "../../utils/tagPosition.js";
49
- import { sculptDataToBoxPosition as D } from "../../utils/sculptDataToBoxPosition.js";
49
+ import { getBoxCorners as A, applyMatrixToPoints as F } from "../../utils/tagPosition.js";
50
+ import { sculptDataToBoxPosition as U } from "../../utils/sculptDataToBoxPosition.js";
50
51
  import "../../../shared-utils/Subscribe.js";
51
52
  import "../../utils/tag/calculateTagConfig.js";
52
53
  import "../../../vendor/object-assign-deep/objectAssignDeep.js";
@@ -62,7 +63,6 @@ import "../../../shared-utils/util.js";
62
63
  import "../../../shared-utils/isNil.js";
63
64
  import "../../../shared-utils/vectorToCoordinate.js";
64
65
  import "../../../shared-utils/formatRad.js";
65
- import "../../../shared-utils/five/transformPosition.js";
66
66
  import "../../../shared-utils/five/lookPoint.js";
67
67
  import "../../../shared-utils/Utils/FiveUtil.js";
68
68
  import "../../../shared-utils/Utils/BaseUtil.js";
@@ -100,6 +100,7 @@ import "../../../Sculpt/typings/style.js";
100
100
  import "../../../shared-utils/three/IObject3D.js";
101
101
  import "../../../Sculpt/utils/Meshes/getLengthHTML.js";
102
102
  import "../../../shared-utils/three/applyObjectMatrixWorld.js";
103
+ import "../../../shared-utils/five/getFiveFromParentChain.js";
103
104
  import "../../../shared-utils/three/core/LineGeometry.js";
104
105
  import "../../../shared-utils/three/core/LineMaterial.js";
105
106
  import "../../../shared-utils/three/core/Line2.js";
@@ -210,25 +211,25 @@ import "../../../shared-utils/forReverseEach.js";
210
211
  import "../../../Sculpt/Objects/Line/index.js";
211
212
  import "../../../Sculpt/Editors/BoxMeshEditor.js";
212
213
  import "../../../Sculpt/Meshes/Box.js";
213
- class ie extends C {
214
+ class ne extends z {
214
215
  constructor(t, i) {
215
216
  super(t, i);
216
- d(this, "tagStyle");
217
- d(this, "clickEventDispose");
218
- d(this, "domClickDispose");
219
- d(this, "screenPosition", null);
217
+ f(this, "tagStyle");
218
+ f(this, "clickEventDispose");
219
+ f(this, "domClickDispose");
220
+ f(this, "screenPosition", null);
220
221
  this.tagStyle = i.style, this.initializeSculptBox(), this.updateVisible();
221
222
  }
222
223
  /**
223
224
  * 获取 Box 样式配置(合并用户配置和默认值)
224
225
  */
225
226
  getBoxStyle() {
226
- var i, o, e, p;
227
+ var i, o, e, s;
227
228
  const t = ((i = this.tagStyle) == null ? void 0 : i.boxOrPolygon) || {};
228
229
  return {
229
230
  color: (o = t.color) != null ? o : 16777215,
230
231
  opacity: (e = t.opacity) != null ? e : 0.4,
231
- lineColor: (p = t.color) != null ? p : 16777215,
232
+ lineColor: (s = t.color) != null ? s : 16777215,
232
233
  lineWidth: 1
233
234
  };
234
235
  }
@@ -245,7 +246,7 @@ class ie extends C {
245
246
  * 更新标签数据
246
247
  */
247
248
  set(t, i = !0) {
248
- super.set(t, i), t.style && (this.tagStyle = x(x({}, this.tagStyle), t.style)), t.position && (this.boxShape ? this.updateSculptBox() : this.initializeSculptBox()), t.style && this.boxShape && this.updateBoxStyle();
249
+ super.set(t, i), t.style && (this.tagStyle = y(y({}, this.tagStyle), t.style)), t.position && (this.boxShape ? this.updateSculptBox() : this.initializeSculptBox()), t.style && this.boxShape && this.updateBoxStyle();
249
250
  }
250
251
  /**
251
252
  * 设置标签数据
@@ -257,21 +258,21 @@ class ie extends C {
257
258
  * 获取盒子的中心点
258
259
  */
259
260
  getCenter() {
260
- const t = this.originPosition;
261
+ const t = this.position;
261
262
  if (!(t != null && t.start) || !(t != null && t.end))
262
263
  return [0, 0, 0];
263
- const i = t.end.map((n) => Number(n)), o = t.start.map((n) => Number(n)), e = i[0] / 2 + o[0] / 2, p = i[1] / 2 + o[1] / 2, m = i[2] / 2 + o[2] / 2;
264
- return new r.Vector3(e, p, m).toArray();
264
+ const i = t.end.map((h) => Number(h)), o = t.start.map((h) => Number(h)), e = i[0] / 2 + o[0] / 2, s = i[1] / 2 + o[1] / 2, l = i[2] / 2 + o[2] / 2, p = new r.Vector3(e, s, l);
265
+ return x(p, this.workUtil.transform).toArray();
265
266
  }
266
267
  /**
267
268
  * 获取盒子的8个角点坐标
268
269
  */
269
270
  getCorners() {
270
271
  if (this.boxShape) {
271
- const t = this.boxShape.data, i = t.points.map((p) => u(p)), o = new r.Vector3().subVectors(
272
+ const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = new r.Vector3().subVectors(
272
273
  u(t.heightPoint),
273
274
  i[0]
274
- ), e = i.map((p) => p.clone().add(o));
275
+ ), e = i.map((s) => s.clone().add(o));
275
276
  return [...i, ...e];
276
277
  }
277
278
  return [];
@@ -295,13 +296,13 @@ class ie extends C {
295
296
  const t = this.position;
296
297
  if (!(t != null && t.start) || !(t != null && t.end) || !(t != null && t.rotation))
297
298
  return;
298
- const i = new P(this.five, void 0, {
299
+ const i = new T(this.five, void 0, {
299
300
  magnifier: null
300
301
  });
301
302
  i.clear(), i.group.removeFromParent();
302
- const o = this.boxPositionToSculptData(t), e = this.getBoxStyle(), p = new E(
303
+ const o = this.boxPositionToSculptData(t), e = this.getBoxStyle(), s = new D(
303
304
  {
304
- id: B(),
305
+ id: M(),
305
306
  type: "Box",
306
307
  points: o.bottomPoints,
307
308
  heightPoint: o.heightPoint,
@@ -313,9 +314,9 @@ class ie extends C {
313
314
  // occlusionMode: 'translucence' as any,
314
315
  }
315
316
  );
316
- p.visible = this.visible, this.plugin.imagePlaneGroup.add(p), this.boxShape = p, p.editor.hooks.on("objectUpdate", () => {
317
+ s.visible = this.visible, this.plugin.imagePlaneGroup.add(s), this.boxShape = s, s.editor.hooks.on("objectUpdate", () => {
317
318
  this.syncBoxPositionFromSculpt();
318
- }), p.editor.disable(), this.setupClickEvents();
319
+ }), s.editor.disable(), this.setupClickEvents();
319
320
  }
320
321
  /**
321
322
  * 设置点击事件
@@ -366,7 +367,7 @@ class ie extends C {
366
367
  * 用于编辑已存在的 Box
367
368
  */
368
369
  editorEnable() {
369
- return b(this, null, function* () {
370
+ return g(this, null, function* () {
370
371
  if (!this.position) {
371
372
  console.warn("[BoxTag] Cannot enable editor without position. Call startDrawing() first.");
372
373
  return;
@@ -386,20 +387,23 @@ class ie extends C {
386
387
  syncBoxPositionFromSculpt() {
387
388
  if (!this.boxShape)
388
389
  return;
389
- const t = this.boxShape.data, i = t.points.map((p) => u(p)), o = u(t.heightPoint), e = D(i, o);
390
+ const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = u(t.heightPoint), e = U(i, o);
390
391
  this.position = e, this.hooks.emit("positionChanged", e);
391
392
  }
392
393
  /**
393
394
  * 将 BoxPosition 转换为 Sculpt 需要的数据格式
394
395
  */
395
396
  boxPositionToSculptData(t) {
396
- const i = u(t.start), o = u(t.end), e = new r.Euler().fromArray(t.rotation), p = new r.Vector3((i.x + o.x) / 2, (i.y + o.y) / 2, (i.z + o.z) / 2), m = new r.Vector3(Math.abs(o.x - i.x) / 2, Math.abs(o.y - i.y) / 2, Math.abs(o.z - i.z) / 2), n = new r.Matrix4().makeRotationFromEuler(e), c = [
397
+ const i = u(t.start), o = u(t.end), e = new r.Euler().fromArray(t.rotation), s = new r.Vector3((i.x + o.x) / 2, (i.y + o.y) / 2, (i.z + o.z) / 2), l = new r.Vector3(Math.abs(o.x - i.x) / 2, Math.abs(o.y - i.y) / 2, Math.abs(o.z - i.z) / 2), p = new r.Matrix4().makeRotationFromEuler(e), h = [
397
398
  new r.Vector3(-0.5, -0.5, -0.5),
398
399
  new r.Vector3(0.5, -0.5, -0.5),
399
400
  new r.Vector3(0.5, -0.5, 0.5),
400
401
  new r.Vector3(-0.5, -0.5, 0.5)
401
- ], l = new r.Vector3(-0.5, 0.5, -0.5), h = m.clone().multiplyScalar(2), y = c.map((v) => v.clone().multiply(h).applyMatrix4(n).add(p)), g = l.clone().multiply(h).applyMatrix4(n).add(p);
402
- return { bottomPoints: y, heightPoint: g };
402
+ ], d = new r.Vector3(-0.5, 0.5, -0.5), c = l.clone().multiplyScalar(2), m = this.workUtil.transform, v = h.map((V) => {
403
+ const C = V.clone().multiply(c).applyMatrix4(p).add(s);
404
+ return x(C, m);
405
+ }), w = d.clone().multiply(c).applyMatrix4(p).add(s), k = x(w, m);
406
+ return { bottomPoints: v, heightPoint: k };
403
407
  }
404
408
  /**
405
409
  * @description 点击事件处理
@@ -453,7 +457,7 @@ class ie extends C {
453
457
  this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
454
458
  return;
455
459
  }
456
- const o = new r.Vector3().fromArray(i.start), e = new r.Vector3().fromArray(i.end), p = new r.Euler().fromArray(i.rotation), m = [
460
+ const o = new r.Vector3().fromArray(i.start), e = new r.Vector3().fromArray(i.end), s = new r.Euler().fromArray(i.rotation), l = [
457
461
  new r.Vector3(o.x, o.y, o.z),
458
462
  new r.Vector3(e.x, o.y, o.z),
459
463
  new r.Vector3(o.x, e.y, o.z),
@@ -462,29 +466,29 @@ class ie extends C {
462
466
  new r.Vector3(e.x, o.y, e.z),
463
467
  new r.Vector3(o.x, e.y, e.z),
464
468
  new r.Vector3(e.x, e.y, e.z)
465
- ], n = new r.Vector3().addVectors(o, e).multiplyScalar(0.5);
466
- m.forEach((h) => {
467
- h.sub(n).applyEuler(p).add(n);
469
+ ], p = new r.Vector3().addVectors(o, e).multiplyScalar(0.5), h = this.workUtil.transform;
470
+ l.forEach((m) => {
471
+ m.sub(p).applyEuler(s).add(p), m.copy(x(m, h));
468
472
  });
469
- let c = m[0];
470
- m.forEach((h) => {
471
- h.x > c.x && (c = h);
473
+ let d = l[0];
474
+ l.forEach((m) => {
475
+ m.x > d.x && (d = m);
472
476
  });
473
- const l = c.clone().project(this.five.camera);
474
- if (l.x < -1 || l.x > 1 || l.y < -1 || l.y > 1 || l.z < 0 || l.z > 1)
477
+ const c = d.clone().project(this.five.camera);
478
+ if (c.x < -1 || c.x > 1 || c.y < -1 || c.y > 1 || c.z < 0 || c.z > 1)
475
479
  this.screenPosition = null;
476
480
  else if (this.five.renderer) {
477
- const h = this.five.renderer.getSize(new r.Vector2());
481
+ const m = this.five.renderer.getSize(new r.Vector2());
478
482
  this.screenPosition = {
479
- leftPx: (l.x + 1) / 2 * h.x,
480
- topPx: (-l.y + 1) / 2 * h.y,
483
+ leftPx: (c.x + 1) / 2 * m.x,
484
+ topPx: (-c.y + 1) / 2 * m.y,
481
485
  scale: 1
482
486
  };
483
487
  }
484
488
  this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
485
489
  }
486
490
  get centerPosition() {
487
- const t = z(this.position), i = T(t, this.matrix);
491
+ const t = A(this.position, this.workUtil.transform), i = F(t, this.matrix);
488
492
  let o = i[0];
489
493
  return i.forEach((e) => {
490
494
  e.x > o.x && (o = e);
@@ -508,5 +512,5 @@ class ie extends C {
508
512
  }
509
513
  }
510
514
  export {
511
- ie as BoxTag
515
+ ne as BoxTag
512
516
  };
@@ -85,6 +85,7 @@ import "../../../Sculpt/typings/style.js";
85
85
  import "../../../shared-utils/three/IObject3D.js";
86
86
  import "../../../Sculpt/utils/Meshes/getLengthHTML.js";
87
87
  import "../../../shared-utils/three/applyObjectMatrixWorld.js";
88
+ import "../../../shared-utils/five/getFiveFromParentChain.js";
88
89
  import "../../../shared-utils/three/core/LineGeometry.js";
89
90
  import "../../../shared-utils/three/core/LineMaterial.js";
90
91
  import "../../../shared-utils/three/core/Line2.js";
@@ -6,11 +6,5 @@
6
6
  * Vertex Shader
7
7
  */
8
8
  export declare const maskVertexShader = "\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
9
- /**
10
- * Fragment Shader
11
- * 实现颜色匹配和高亮渲染逻辑
12
- * 参考 MosaicPlugin 的边缘检测实现
13
- */
14
- export declare const maskFragmentShader = "\n#define RESOLUTION 2048.0\n\nvarying vec2 vUv;\nuniform sampler2D map;\nuniform vec4 color;\nuniform float tolerance;\nuniform vec3 highlightColor;\nuniform float opacity;\n\nfloat colorGap(vec3 color1, vec3 color2) {\n float gap = abs(color1.r - color2.r) + abs(color1.g - color2.g) + abs(color1.b - color2.b);\n return gap;\n}\n\n// \u5224\u65AD\u50CF\u7D20\u662F\u5426\u5339\u914D\u76EE\u6807\u989C\u8272\nbool isMatchingColor(vec3 pixelColor) {\n // \u6392\u9664\u9ED1\u8272\u50CF\u7D20\n if (pixelColor.r == 0.0 && pixelColor.g == 0.0 && pixelColor.b == 0.0) {\n return false;\n }\n return colorGap(pixelColor, color.rgb) < tolerance;\n}\n\n// \u8FB9\u7F18\u68C0\u6D4B\u51FD\u6570\uFF1A\u53C2\u8003 MosaicPlugin \u5B9E\u73B0\nfloat detectEdge(sampler2D map, vec2 uv) {\n vec4 centerColor = texture2D(map, uv);\n \n // \u5F53\u524D\u50CF\u7D20\u5FC5\u987B\u5339\u914D\u76EE\u6807\u989C\u8272\n if (!isMatchingColor(centerColor.rgb)) {\n return 0.0;\n }\n \n float step = 1.0 / RESOLUTION;\n \n // \u68C0\u67E54\u4E2A\u4E3B\u8981\u65B9\u5411\u7684\u90BB\u5C45\u50CF\u7D20\n vec4 upColor = texture2D(map, uv + vec2(0.0, -step));\n vec4 leftColor = texture2D(map, uv + vec2(-step, 0.0));\n vec4 rightColor = texture2D(map, uv + vec2(step, 0.0));\n vec4 downColor = texture2D(map, uv + vec2(0.0, step));\n \n // \u53EA\u6709\u5F53\u524D\u50CF\u7D20\u5339\u914D\u989C\u8272\uFF0C\u4E14\u81F3\u5C11\u6709\u4E00\u4E2A\u90BB\u5C45\u4E0D\u5339\u914D\u65F6\uFF0C\u624D\u662F\u8FB9\u7F18\n bool hasNonMatchingNeighbor = \n !isMatchingColor(upColor.rgb) || \n !isMatchingColor(leftColor.rgb) || \n !isMatchingColor(rightColor.rgb) || \n !isMatchingColor(downColor.rgb);\n \n return hasNonMatchingNeighbor ? 1.0 : 0.0;\n}\n\nvoid main() {\n vec4 image = texture2D(map, vUv);\n \n // \u6392\u9664\u9ED1\u8272\u50CF\u7D20\n if (image.r == 0.0 && image.g == 0.0 && image.b == 0.0) {\n discard;\n }\n \n // \u8BA1\u7B97\u5F53\u524D\u50CF\u7D20\u4E0E\u76EE\u6807\u989C\u8272\u7684\u5DEE\u5F02\n float gap = colorGap(image.rgb, color.rgb);\n \n // \u4F7F\u7528\u56FA\u5B9A\u5E73\u6ED1\u8303\u56F4\u5B9E\u73B0\u989C\u8272\u5339\u914D\u8FB9\u754C\n float smoothRange = 0.01;\n \n // \u5E73\u6ED1\u7684\u989C\u8272\u5339\u914D\u56E0\u5B50\uFF080-1\uFF09\n float matchFactor = 1.0 - smoothstep(tolerance - smoothRange, tolerance + smoothRange, gap);\n \n if (matchFactor > 0.0) {\n // \u4F7F\u7528\u65B0\u7684\u8FB9\u7F18\u68C0\u6D4B\u65B9\u6CD5\n float isEdge = detectEdge(map, vUv);\n \n // \u8FB9\u7F18\u4F7F\u7528\u5B8C\u5168\u4E0D\u900F\u660E\uFF0C\u5185\u90E8\u4F7F\u7528\u8BBE\u5B9A\u7684\u900F\u660E\u5EA6\n float alpha = mix(opacity, 1.0, isEdge);\n \n // \u5E94\u7528\u5339\u914D\u56E0\u5B50\u5B9E\u73B0\u8FB9\u754C\u5E73\u6ED1\uFF0C\u4F46\u4FDD\u7559\u6700\u5C0F 0.9 \u7684\u900F\u660E\u5EA6\n // \u8FD9\u6837\u5373\u4F7F\u5728\u8FB9\u754C\u5904\u4E5F\u4E0D\u4F1A\u5B8C\u5168\u900F\u660E\uFF0C\u540C\u65F6\u5B8C\u5168\u5339\u914D\u533A\u57DF\u4FDD\u6301\u8BBE\u5B9A\u7684\u900F\u660E\u5EA6\n alpha *= max(matchFactor, 0.9);\n \n gl_FragColor = vec4(highlightColor, alpha);\n } else {\n discard;\n }\n}\n";
15
9
  /** 多 style:mergedTexture 中每组 3 像素为 color(id)/tolerance+highlight/opacity,用 color 作 id 匹配 */
16
10
  export declare const maskFragmentShaderMulti = "\n#define RESOLUTION 2048.0\n#define MAX_GROUPS 64\n#define STRICT_MATCH 0.5/255.0\n\nvarying vec2 vUv;\nuniform sampler2D map;\nuniform sampler2D mergedTexture;\nuniform float groupCount;\nuniform float textureWidth;\nuniform float pixelsPerGroup;\n\nfloat colorGap(vec3 a, vec3 b) {\n return abs(a.r - b.r) + abs(a.g - b.g) + abs(a.b - b.b);\n}\n\nvec4 readStyleColor(float groupIndex) {\n float px = groupIndex * pixelsPerGroup;\n float texX = (px + 0.5) / textureWidth;\n return texture2D(mergedTexture, vec2(texX, 0.5));\n}\n\nvec4 readStyleToleranceHighlight(float groupIndex) {\n float px = groupIndex * pixelsPerGroup + 1.0;\n float texX = (px + 0.5) / textureWidth;\n return texture2D(mergedTexture, vec2(texX, 0.5));\n}\n\nfloat readStyleOpacity(float groupIndex) {\n float px = groupIndex * pixelsPerGroup + 2.0;\n float texX = (px + 0.5) / textureWidth;\n return texture2D(mergedTexture, vec2(texX, 0.5)).r;\n}\n\nfloat detectEdge(sampler2D map, vec2 uv, vec3 matchColor, float tolerance) {\n vec4 centerColor = texture2D(map, uv);\n if (colorGap(centerColor.rgb, matchColor) >= tolerance) return 0.0;\n float step = 1.0 / RESOLUTION;\n vec4 u = texture2D(map, uv + vec2(0.0, -step));\n vec4 l = texture2D(map, uv + vec2(-step, 0.0));\n vec4 r = texture2D(map, uv + vec2(step, 0.0));\n vec4 d = texture2D(map, uv + vec2(0.0, step));\n bool edge = colorGap(u.rgb, matchColor) >= tolerance || colorGap(l.rgb, matchColor) >= tolerance\n || colorGap(r.rgb, matchColor) >= tolerance || colorGap(d.rgb, matchColor) >= tolerance;\n return edge ? 1.0 : 0.0;\n}\n\nvoid main() {\n vec4 image = texture2D(map, vUv);\n if (image.r == 0.0 && image.g == 0.0 && image.b == 0.0) discard;\n\n // WebGL 1.0 \u8981\u6C42\u5FAA\u73AF\u7EC8\u6B62\u6761\u4EF6\u5FC5\u987B\u662F\u7F16\u8BD1\u65F6\u5E38\u91CF\uFF0C\u6240\u4EE5\u7528 MAX_GROUPS\uFF0C\u5FAA\u73AF\u5185\u68C0\u67E5 groupCount\n for (float i = 0.0; i < float(MAX_GROUPS); i += 1.0) {\n if (i < groupCount) {\n vec4 styleColor = readStyleColor(i);\n vec3 colorRgb = styleColor.rgb;\n float tol = readStyleToleranceHighlight(i).r * 3.0;\n vec3 highlight = readStyleToleranceHighlight(i).gba;\n float opacity = readStyleOpacity(i);\n \n if (opacity > 0.0) {\n float gap = colorGap(image.rgb, colorRgb);\n if (gap > STRICT_MATCH) continue;\n float smoothRange = 0.01;\n float matchFactor = 1.0 - smoothstep(tol - smoothRange, tol + smoothRange, gap);\n if (matchFactor > 0.0) {\n float isEdge = detectEdge(map, vUv, colorRgb, tol);\n float alpha = mix(opacity, 1.0, isEdge);\n alpha *= max(matchFactor, 0.9);\n gl_FragColor = vec4(highlight, alpha);\n return;\n }\n }\n }\n }\n discard;\n}\n";