@realsee/dnalogel 2.0.0-alpha.12 → 2.0.0-alpha.13

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 (101) hide show
  1. package/dist/CSS3DRenderPlugin/index.js +17 -14
  2. package/dist/CameraMovementPlugin/index.js +40 -15
  3. package/dist/ModelChassisCompassPlugin/index.js +32 -6
  4. package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
  5. package/dist/ModelItemLabelPlugin/index.js +18 -17
  6. package/dist/ModelRoomLabelPlugin/index.js +67 -26
  7. package/dist/PanoCompassPlugin/index.js +311 -164
  8. package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
  9. package/dist/PanoMeasurePlugin/index.js +1337 -583
  10. package/dist/PanoRulerPlugin/index.js +32 -5
  11. package/dist/PanoSpatialTagPlugin/index.js +64 -29
  12. package/dist/floorplan/ModelFloorplanPlugin/index.js +586 -362
  13. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
  14. package/dist/floorplan/TopviewFloorplanPlugin/index.js +311 -153
  15. package/dist/index.es.js +2663 -1341
  16. package/dist/index.js +2667 -1345
  17. package/dist/index.umd.js +2667 -1345
  18. package/docs/assets/main.js +1 -1
  19. package/docs/classes/ModelRoomLabelController.html +6 -6
  20. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  21. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  22. package/docs/interfaces/LineJson.html +1 -1
  23. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  24. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  25. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  26. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  27. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  28. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  29. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  30. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  31. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  32. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  33. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  34. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  35. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  36. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  37. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  38. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  39. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  40. package/docs/interfaces/PointJson.html +1 -1
  41. package/docs/interfaces/RoomLabel.html +7 -7
  42. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
  43. package/docs/modules.html +12 -12
  44. package/libs/CSS3DRenderPlugin/index.js +16 -13
  45. package/libs/CameraMovementPlugin/index.js +24 -15
  46. package/libs/ModelChassisCompassPlugin/index.js +14 -5
  47. package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
  48. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +12 -10
  49. package/libs/ModelItemLabelPlugin/index.js +5 -3
  50. package/libs/ModelItemLabelPlugin/utils/parseData.js +1 -4
  51. package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
  52. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +3 -3
  53. package/libs/PanoCompassPlugin/index.js +225 -128
  54. package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
  55. package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
  56. package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
  57. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
  58. package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
  59. package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
  60. package/libs/PanoMeasurePlugin/Model/index.js +30 -5
  61. package/libs/PanoMeasurePlugin/Model/line.js +60 -10
  62. package/libs/PanoMeasurePlugin/Model/point.js +24 -4
  63. package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
  64. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
  65. package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
  66. package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
  67. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
  68. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
  69. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
  70. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
  71. package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
  72. package/libs/PanoMeasurePlugin/utils/line.js +8 -7
  73. package/libs/PanoRulerPlugin/index.js +16 -5
  74. package/libs/PanoSpatialTagPlugin/index.js +11 -9
  75. package/libs/floorplan/Components/BaseImage.js +10 -5
  76. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
  77. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
  78. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +7 -2
  79. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
  80. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +456 -273
  81. package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
  82. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
  83. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
  84. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +231 -108
  85. package/libs/floorplan/utils/formatData.js +43 -28
  86. package/libs/floorplan/utils/formatPosition.js +1 -1
  87. package/libs/shared-utils/Subscribe.js +8 -1
  88. package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
  89. package/libs/shared-utils/createCanvasTextTexture.js +6 -5
  90. package/libs/shared-utils/five/changeMode.js +23 -12
  91. package/libs/shared-utils/getPxmm.js +1 -1
  92. package/libs/shared-utils/math/evenNumber.js +1 -1
  93. package/libs/shared-utils/three/loadFbxObj.js +20 -9
  94. package/libs/shared-utils/three/loadTexture.js +17 -6
  95. package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
  96. package/libs/shared-utils/tinyEJSrender.js +36 -6
  97. package/libs/shared-utils/to.js +21 -10
  98. package/libs/shared-utils/useDebounce.js +1 -1
  99. package/libs/shared-utils/useThrottle.js +2 -1
  100. package/package.json +1 -1
  101. package/CHANGELOG.md +0 -41
@@ -31,17 +31,67 @@ function exchange(array, index1, index2) {
31
31
  array[index2] = value;
32
32
  }
33
33
  class Magnifier {
34
- five;
35
- scale;
36
- width;
37
- height;
38
- pixelRatio;
39
- originWidth;
40
- originHeight;
41
- context;
42
- canvas = document.createElement('canvas');
43
- container;
44
34
  constructor(five, options) {
35
+ Object.defineProperty(this, "five", {
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true,
39
+ value: void 0
40
+ });
41
+ Object.defineProperty(this, "scale", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: void 0
46
+ });
47
+ Object.defineProperty(this, "width", {
48
+ enumerable: true,
49
+ configurable: true,
50
+ writable: true,
51
+ value: void 0
52
+ });
53
+ Object.defineProperty(this, "height", {
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true,
57
+ value: void 0
58
+ });
59
+ Object.defineProperty(this, "pixelRatio", {
60
+ enumerable: true,
61
+ configurable: true,
62
+ writable: true,
63
+ value: void 0
64
+ });
65
+ Object.defineProperty(this, "originWidth", {
66
+ enumerable: true,
67
+ configurable: true,
68
+ writable: true,
69
+ value: void 0
70
+ });
71
+ Object.defineProperty(this, "originHeight", {
72
+ enumerable: true,
73
+ configurable: true,
74
+ writable: true,
75
+ value: void 0
76
+ });
77
+ Object.defineProperty(this, "context", {
78
+ enumerable: true,
79
+ configurable: true,
80
+ writable: true,
81
+ value: void 0
82
+ });
83
+ Object.defineProperty(this, "canvas", {
84
+ enumerable: true,
85
+ configurable: true,
86
+ writable: true,
87
+ value: document.createElement('canvas')
88
+ });
89
+ Object.defineProperty(this, "container", {
90
+ enumerable: true,
91
+ configurable: true,
92
+ writable: true,
93
+ value: void 0
94
+ });
45
95
  if (!five.renderer)
46
96
  throw new Error('Five Render 未初始化');
47
97
  this.five = five;
@@ -128,9 +178,30 @@ class Magnifier {
128
178
  }
129
179
 
130
180
  class FiveHelper {
131
- edges = [];
132
- five;
133
181
  constructor(five) {
182
+ Object.defineProperty(this, "edges", {
183
+ enumerable: true,
184
+ configurable: true,
185
+ writable: true,
186
+ value: []
187
+ });
188
+ Object.defineProperty(this, "five", {
189
+ enumerable: true,
190
+ configurable: true,
191
+ writable: true,
192
+ value: void 0
193
+ });
194
+ /** 模型加载后获取折线 */
195
+ Object.defineProperty(this, "onModelLoaded", {
196
+ enumerable: true,
197
+ configurable: true,
198
+ writable: true,
199
+ value: () => {
200
+ if (!this.five.model)
201
+ return;
202
+ this.edges = this.five.model.getEdges();
203
+ }
204
+ });
134
205
  this.five = five;
135
206
  this.five.model.loaded ? this.onModelLoaded() : this.five.on('modelLoaded', this.onModelLoaded);
136
207
  }
@@ -152,12 +223,6 @@ class FiveHelper {
152
223
  return null;
153
224
  return closestPoint || null;
154
225
  }
155
- /** 模型加载后获取折线 */
156
- onModelLoaded = () => {
157
- if (!this.five.model)
158
- return;
159
- this.edges = this.five.model.getEdges();
160
- };
161
226
  }
162
227
 
163
228
  var hammer = {exports: {}};
@@ -2810,10 +2875,10 @@ if (typeof undefined$1 === 'function' && undefined$1.amd) {
2810
2875
 
2811
2876
  var Hammer = hammer.exports;
2812
2877
 
2813
- var Hammer$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({
2878
+ var Hammer$1 = /*#__PURE__*/_mergeNamespaces({
2814
2879
  __proto__: null,
2815
2880
  'default': Hammer
2816
- }, [hammer.exports]));
2881
+ }, [hammer.exports]);
2817
2882
 
2818
2883
  // uuid
2819
2884
  function S4() {
@@ -2828,9 +2893,26 @@ function uuid() {
2828
2893
  }
2829
2894
 
2830
2895
  class Polyline {
2831
- id = uuid();
2832
- points = [];
2833
- lines = [];
2896
+ constructor() {
2897
+ Object.defineProperty(this, "id", {
2898
+ enumerable: true,
2899
+ configurable: true,
2900
+ writable: true,
2901
+ value: uuid()
2902
+ });
2903
+ Object.defineProperty(this, "points", {
2904
+ enumerable: true,
2905
+ configurable: true,
2906
+ writable: true,
2907
+ value: []
2908
+ });
2909
+ Object.defineProperty(this, "lines", {
2910
+ enumerable: true,
2911
+ configurable: true,
2912
+ writable: true,
2913
+ value: []
2914
+ });
2915
+ }
2834
2916
  push(line) {
2835
2917
  const next = this.getNext(line);
2836
2918
  if (!next)
@@ -2907,11 +2989,12 @@ const lightLineOpts = {
2907
2989
  };
2908
2990
 
2909
2991
  function creatLine(start, end, opts) {
2910
- const lineWidth = opts?.lineWidth ?? 2;
2911
- const lineColor = opts?.lineColor ?? new three.Color(0xffffff);
2912
- const pointSize = opts?.pointSize ?? 5;
2913
- const lineRenderOrder = opts?.lineRenderOrder ?? 10;
2914
- const pointsRenderOrder = opts?.lineRenderOrder ?? 20;
2992
+ var _a, _b, _c, _d, _e;
2993
+ const lineWidth = (_a = opts === null || opts === void 0 ? void 0 : opts.lineWidth) !== null && _a !== void 0 ? _a : 2;
2994
+ const lineColor = (_b = opts === null || opts === void 0 ? void 0 : opts.lineColor) !== null && _b !== void 0 ? _b : new three.Color(0xffffff);
2995
+ const pointSize = (_c = opts === null || opts === void 0 ? void 0 : opts.pointSize) !== null && _c !== void 0 ? _c : 5;
2996
+ const lineRenderOrder = (_d = opts === null || opts === void 0 ? void 0 : opts.lineRenderOrder) !== null && _d !== void 0 ? _d : 10;
2997
+ const pointsRenderOrder = (_e = opts === null || opts === void 0 ? void 0 : opts.lineRenderOrder) !== null && _e !== void 0 ? _e : 20;
2915
2998
  const line$1 = new line.Line(start, end);
2916
2999
  // set line
2917
3000
  line$1.setMaterial({ linewidth: lineWidth, color: lineColor });
@@ -2923,8 +3006,8 @@ function creatLine(start, end, opts) {
2923
3006
  const pointMaterial = line$1.points.material;
2924
3007
  pointMaterial.depthTest = false;
2925
3008
  pointMaterial.size = pointSize;
2926
- opts?.pointColor && pointMaterial.color.set(opts.pointColor).convertSRGBToLinear();
2927
- if (opts?.pointTexture)
3009
+ (opts === null || opts === void 0 ? void 0 : opts.pointColor) && pointMaterial.color.set(opts.pointColor).convertSRGBToLinear();
3010
+ if (opts === null || opts === void 0 ? void 0 : opts.pointTexture)
2928
3011
  pointMaterial.map = opts.pointTexture;
2929
3012
  return line$1;
2930
3013
  }
@@ -2971,8 +3054,9 @@ function createContainerDom(line) {
2971
3054
  }
2972
3055
  function creatDistanceItem(props) {
2973
3056
  function handleClick() {
3057
+ var _a;
2974
3058
  highlight();
2975
- props.clickCallback?.(distanceItem);
3059
+ (_a = props.clickCallback) === null || _a === void 0 ? void 0 : _a.call(props, distanceItem);
2976
3060
  }
2977
3061
  function highlight() {
2978
3062
  if (userDistanceItem)
@@ -3052,22 +3136,72 @@ function creatDistanceItem(props) {
3052
3136
  highlight: highlight,
3053
3137
  unHighlight: unHighlight,
3054
3138
  };
3055
- userDistanceItem?.element ? containerDom.appendChild(userDistanceItem.element) : containerDom.appendChild(contentDom);
3139
+ (userDistanceItem === null || userDistanceItem === void 0 ? void 0 : userDistanceItem.element) ? containerDom.appendChild(userDistanceItem.element) : containerDom.appendChild(contentDom);
3056
3140
  return distanceItem;
3057
3141
  }
3058
3142
 
3059
3143
  class Line {
3060
- id;
3061
- selected = false;
3062
- type = 'line';
3063
- model;
3064
- mesh;
3065
- points;
3066
- lightMesh;
3067
- hook;
3068
- distanceItem;
3069
- polyline;
3070
3144
  constructor(point, anotherPoint, model) {
3145
+ Object.defineProperty(this, "id", {
3146
+ enumerable: true,
3147
+ configurable: true,
3148
+ writable: true,
3149
+ value: void 0
3150
+ });
3151
+ Object.defineProperty(this, "selected", {
3152
+ enumerable: true,
3153
+ configurable: true,
3154
+ writable: true,
3155
+ value: false
3156
+ });
3157
+ Object.defineProperty(this, "type", {
3158
+ enumerable: true,
3159
+ configurable: true,
3160
+ writable: true,
3161
+ value: 'line'
3162
+ });
3163
+ Object.defineProperty(this, "model", {
3164
+ enumerable: true,
3165
+ configurable: true,
3166
+ writable: true,
3167
+ value: void 0
3168
+ });
3169
+ Object.defineProperty(this, "mesh", {
3170
+ enumerable: true,
3171
+ configurable: true,
3172
+ writable: true,
3173
+ value: void 0
3174
+ });
3175
+ Object.defineProperty(this, "points", {
3176
+ enumerable: true,
3177
+ configurable: true,
3178
+ writable: true,
3179
+ value: void 0
3180
+ });
3181
+ Object.defineProperty(this, "lightMesh", {
3182
+ enumerable: true,
3183
+ configurable: true,
3184
+ writable: true,
3185
+ value: void 0
3186
+ });
3187
+ Object.defineProperty(this, "hook", {
3188
+ enumerable: true,
3189
+ configurable: true,
3190
+ writable: true,
3191
+ value: void 0
3192
+ });
3193
+ Object.defineProperty(this, "distanceItem", {
3194
+ enumerable: true,
3195
+ configurable: true,
3196
+ writable: true,
3197
+ value: void 0
3198
+ });
3199
+ Object.defineProperty(this, "polyline", {
3200
+ enumerable: true,
3201
+ configurable: true,
3202
+ writable: true,
3203
+ value: void 0
3204
+ });
3071
3205
  this.id = uuid();
3072
3206
  this.model = model;
3073
3207
  if (point.id === anotherPoint.id)
@@ -3130,11 +3264,31 @@ function removeArrayItem(item, array) {
3130
3264
  }
3131
3265
 
3132
3266
  class Point {
3133
- id;
3134
- lines;
3135
- position;
3136
- type = 'point';
3137
3267
  constructor(position) {
3268
+ Object.defineProperty(this, "id", {
3269
+ enumerable: true,
3270
+ configurable: true,
3271
+ writable: true,
3272
+ value: void 0
3273
+ });
3274
+ Object.defineProperty(this, "lines", {
3275
+ enumerable: true,
3276
+ configurable: true,
3277
+ writable: true,
3278
+ value: void 0
3279
+ });
3280
+ Object.defineProperty(this, "position", {
3281
+ enumerable: true,
3282
+ configurable: true,
3283
+ writable: true,
3284
+ value: void 0
3285
+ });
3286
+ Object.defineProperty(this, "type", {
3287
+ enumerable: true,
3288
+ configurable: true,
3289
+ writable: true,
3290
+ value: 'point'
3291
+ });
3138
3292
  this.id = uuid();
3139
3293
  this.lines = [];
3140
3294
  this.position = new three.Vector3();
@@ -3156,12 +3310,37 @@ class Point {
3156
3310
  }
3157
3311
 
3158
3312
  class Model {
3159
- lines = [];
3160
- points = [];
3161
- params;
3162
- polylines = [];
3163
- hook = new five.Subscribe();
3164
3313
  constructor(params) {
3314
+ Object.defineProperty(this, "lines", {
3315
+ enumerable: true,
3316
+ configurable: true,
3317
+ writable: true,
3318
+ value: []
3319
+ });
3320
+ Object.defineProperty(this, "points", {
3321
+ enumerable: true,
3322
+ configurable: true,
3323
+ writable: true,
3324
+ value: []
3325
+ });
3326
+ Object.defineProperty(this, "params", {
3327
+ enumerable: true,
3328
+ configurable: true,
3329
+ writable: true,
3330
+ value: void 0
3331
+ });
3332
+ Object.defineProperty(this, "polylines", {
3333
+ enumerable: true,
3334
+ configurable: true,
3335
+ writable: true,
3336
+ value: []
3337
+ });
3338
+ Object.defineProperty(this, "hook", {
3339
+ enumerable: true,
3340
+ configurable: true,
3341
+ writable: true,
3342
+ value: new five.Subscribe()
3343
+ });
3165
3344
  this.params = params;
3166
3345
  }
3167
3346
  addLine(line) {
@@ -3287,17 +3466,75 @@ function throttle(func, wait = 200) {
3287
3466
  const preventDefault = (e) => e.preventDefault();
3288
3467
 
3289
3468
  class BaseController {
3290
- five;
3291
- group;
3292
- model;
3293
- disposed = false;
3294
- mouseGroup;
3295
- container;
3296
- fiveHelper;
3297
- hook;
3298
- magnifier;
3299
- userDistanceItemCreator;
3300
3469
  constructor(params) {
3470
+ Object.defineProperty(this, "five", {
3471
+ enumerable: true,
3472
+ configurable: true,
3473
+ writable: true,
3474
+ value: void 0
3475
+ });
3476
+ Object.defineProperty(this, "group", {
3477
+ enumerable: true,
3478
+ configurable: true,
3479
+ writable: true,
3480
+ value: void 0
3481
+ });
3482
+ Object.defineProperty(this, "model", {
3483
+ enumerable: true,
3484
+ configurable: true,
3485
+ writable: true,
3486
+ value: void 0
3487
+ });
3488
+ Object.defineProperty(this, "disposed", {
3489
+ enumerable: true,
3490
+ configurable: true,
3491
+ writable: true,
3492
+ value: false
3493
+ });
3494
+ Object.defineProperty(this, "mouseGroup", {
3495
+ enumerable: true,
3496
+ configurable: true,
3497
+ writable: true,
3498
+ value: void 0
3499
+ });
3500
+ Object.defineProperty(this, "container", {
3501
+ enumerable: true,
3502
+ configurable: true,
3503
+ writable: true,
3504
+ value: void 0
3505
+ });
3506
+ Object.defineProperty(this, "fiveHelper", {
3507
+ enumerable: true,
3508
+ configurable: true,
3509
+ writable: true,
3510
+ value: void 0
3511
+ });
3512
+ Object.defineProperty(this, "hook", {
3513
+ enumerable: true,
3514
+ configurable: true,
3515
+ writable: true,
3516
+ value: void 0
3517
+ });
3518
+ Object.defineProperty(this, "magnifier", {
3519
+ enumerable: true,
3520
+ configurable: true,
3521
+ writable: true,
3522
+ value: void 0
3523
+ });
3524
+ Object.defineProperty(this, "userDistanceItemCreator", {
3525
+ enumerable: true,
3526
+ configurable: true,
3527
+ writable: true,
3528
+ value: void 0
3529
+ });
3530
+ Object.defineProperty(this, "updateDistanceUI", {
3531
+ enumerable: true,
3532
+ configurable: true,
3533
+ writable: true,
3534
+ value: () => {
3535
+ this.model.lines.forEach((line) => line.distanceItem.update(this.five));
3536
+ }
3537
+ });
3301
3538
  // ==================== Params ====================
3302
3539
  this.five = params.five;
3303
3540
  this.hook = params.hook;
@@ -3320,9 +3557,6 @@ class BaseController {
3320
3557
  line.distanceItem.remove();
3321
3558
  this.five.needsRender = true;
3322
3559
  }
3323
- updateDistanceUI = () => {
3324
- this.model.lines.forEach((line) => line.distanceItem.update(this.five));
3325
- };
3326
3560
  updateMouseGroup(intersection, mesh) {
3327
3561
  if (!intersection)
3328
3562
  return this.mouseGroup;
@@ -3378,32 +3612,271 @@ function getIntersectionFromEvent(five, event) {
3378
3612
  }
3379
3613
 
3380
3614
  class EditController extends BaseController {
3381
- type = 'edit';
3382
- model = new Model({ userDistanceItemCreator: this.userDistanceItemCreator });
3383
- pressPoint;
3384
- hasAppendDashed = false;
3385
- hasAppendMouseGroup = false;
3386
- fiveElement;
3387
- /** 上一个端点位置 */
3388
- lastPoint = null;
3389
- /** 鼠标点到上一个端点连接的虚线 */
3390
- dashed;
3391
- hammer;
3392
- /** 根据 intersection 更新放大镜和吸附点 */
3393
- onIntersectionUpdate = throttle((intersection, mesh) => {
3394
- if (this.hasAppendMouseGroup === false) {
3395
- this.group.add(this.mouseGroup);
3396
- this.magnifier.appendTo(this.container);
3397
- this.hasAppendMouseGroup = true;
3398
- }
3399
- const position = this.updateMouseGroup(intersection, mesh).position;
3400
- this.pressPoint?.position.copy(position);
3401
- this.updateDashed();
3402
- requestAnimationFrame(() => this.magnifier.updateWithPoint(this.mouseGroup.position));
3403
- this.five.needsRender = true;
3404
- }, 20);
3405
3615
  constructor(params) {
3616
+ var _a;
3406
3617
  super(params);
3618
+ Object.defineProperty(this, "type", {
3619
+ enumerable: true,
3620
+ configurable: true,
3621
+ writable: true,
3622
+ value: 'edit'
3623
+ });
3624
+ Object.defineProperty(this, "model", {
3625
+ enumerable: true,
3626
+ configurable: true,
3627
+ writable: true,
3628
+ value: new Model({ userDistanceItemCreator: this.userDistanceItemCreator })
3629
+ });
3630
+ Object.defineProperty(this, "pressPoint", {
3631
+ enumerable: true,
3632
+ configurable: true,
3633
+ writable: true,
3634
+ value: void 0
3635
+ });
3636
+ Object.defineProperty(this, "hasAppendDashed", {
3637
+ enumerable: true,
3638
+ configurable: true,
3639
+ writable: true,
3640
+ value: false
3641
+ });
3642
+ Object.defineProperty(this, "hasAppendMouseGroup", {
3643
+ enumerable: true,
3644
+ configurable: true,
3645
+ writable: true,
3646
+ value: false
3647
+ });
3648
+ Object.defineProperty(this, "fiveElement", {
3649
+ enumerable: true,
3650
+ configurable: true,
3651
+ writable: true,
3652
+ value: void 0
3653
+ });
3654
+ /** 上一个端点位置 */
3655
+ Object.defineProperty(this, "lastPoint", {
3656
+ enumerable: true,
3657
+ configurable: true,
3658
+ writable: true,
3659
+ value: null
3660
+ });
3661
+ /** 鼠标点到上一个端点连接的虚线 */
3662
+ Object.defineProperty(this, "dashed", {
3663
+ enumerable: true,
3664
+ configurable: true,
3665
+ writable: true,
3666
+ value: void 0
3667
+ });
3668
+ Object.defineProperty(this, "hammer", {
3669
+ enumerable: true,
3670
+ configurable: true,
3671
+ writable: true,
3672
+ value: void 0
3673
+ });
3674
+ /** 根据 intersection 更新放大镜和吸附点 */
3675
+ Object.defineProperty(this, "onIntersectionUpdate", {
3676
+ enumerable: true,
3677
+ configurable: true,
3678
+ writable: true,
3679
+ value: throttle((intersection, mesh) => {
3680
+ var _a;
3681
+ if (this.hasAppendMouseGroup === false) {
3682
+ this.group.add(this.mouseGroup);
3683
+ this.magnifier.appendTo(this.container);
3684
+ this.hasAppendMouseGroup = true;
3685
+ }
3686
+ const position = this.updateMouseGroup(intersection, mesh).position;
3687
+ (_a = this.pressPoint) === null || _a === void 0 ? void 0 : _a.position.copy(position);
3688
+ this.updateDashed();
3689
+ requestAnimationFrame(() => this.magnifier.updateWithPoint(this.mouseGroup.position));
3690
+ this.five.needsRender = true;
3691
+ }, 20)
3692
+ });
3693
+ /** 撤销编辑 */
3694
+ Object.defineProperty(this, "revoke", {
3695
+ enumerable: true,
3696
+ configurable: true,
3697
+ writable: true,
3698
+ value: () => {
3699
+ // ============ revoke points ============
3700
+ // 如果当前没有虚线,只有起始点,需要删除起始点,重置起始状态。并删除虚线实例
3701
+ if (this.model.lines.length === 0 && this.lastPoint) {
3702
+ this.lastPoint = null;
3703
+ this.hasAppendDashed = false;
3704
+ this.dashed.distanceItem.remove();
3705
+ this.group.remove(this.dashed.mesh);
3706
+ this.hook.emit('anchorChange', null);
3707
+ this.five.needsRender = true;
3708
+ return;
3709
+ }
3710
+ if (this.model.lines.length === 0 && !this.lastPoint)
3711
+ return;
3712
+ if (!this.lastPoint)
3713
+ return;
3714
+ const revokedLine = this.model.lines[this.model.lines.length - 1];
3715
+ const lastPoint = revokedLine.findAnotherPoint(this.lastPoint);
3716
+ if (!lastPoint)
3717
+ return;
3718
+ this.lastPoint = lastPoint;
3719
+ this.hook.emit('anchorChange', lastPoint.position);
3720
+ // ============ revoke lines ============
3721
+ this.group.remove(revokedLine.mesh);
3722
+ this.model.removeLine(revokedLine);
3723
+ // ============ revoke mouse group ============
3724
+ this.hasAppendMouseGroup = false;
3725
+ this.mouseGroup.position.copy(this.lastPoint.position);
3726
+ this.group.remove(this.mouseGroup);
3727
+ // ============ revoke lineDistance ============
3728
+ revokedLine.distanceItem.remove();
3729
+ // ============ revoke dashed ============
3730
+ this.updateDashed();
3731
+ // ============ revoke magnifier ============
3732
+ this.magnifier.dispose();
3733
+ this.five.needsRender = true;
3734
+ }
3735
+ });
3736
+ Object.defineProperty(this, "onMouseLeave", {
3737
+ enumerable: true,
3738
+ configurable: true,
3739
+ writable: true,
3740
+ value: () => {
3741
+ this.magnifier.dispose();
3742
+ this.group.remove(this.mouseGroup);
3743
+ this.hasAppendMouseGroup = false;
3744
+ if (this.lastPoint) {
3745
+ this.mouseGroup.position.copy(this.lastPoint.position);
3746
+ this.updateDashed();
3747
+ }
3748
+ }
3749
+ });
3750
+ /** 编辑线条发生改变时通知外部 */
3751
+ Object.defineProperty(this, "onLineChanged", {
3752
+ enumerable: true,
3753
+ configurable: true,
3754
+ writable: true,
3755
+ value: () => {
3756
+ this.hook.emit('editedLineChange', this.model.lines.map((line) => line.toCompletelyJson()));
3757
+ }
3758
+ });
3759
+ Object.defineProperty(this, "onPress", {
3760
+ enumerable: true,
3761
+ configurable: true,
3762
+ writable: true,
3763
+ value: (e) => {
3764
+ const [intersection] = getIntersectionFromEvent(this.five, e);
3765
+ if (!intersection || !intersection.face)
3766
+ return;
3767
+ const nowPoint = new Point(intersection.point);
3768
+ this.pressPoint = nowPoint;
3769
+ this.onIntersectionUpdate(intersection);
3770
+ }
3771
+ });
3772
+ /**
3773
+ * 1. 如果之前没有长按行为「即没有长按点时」-> 滑动全景
3774
+ * 2. 如果有长按点,把长按点位置更新为当前位置
3775
+ */
3776
+ Object.defineProperty(this, "onPan", {
3777
+ enumerable: true,
3778
+ configurable: true,
3779
+ writable: true,
3780
+ value: (e) => {
3781
+ if (!this.pressPoint)
3782
+ return;
3783
+ const [intersection] = getIntersectionFromEvent(this.five, e);
3784
+ if (!intersection || !intersection.face)
3785
+ return;
3786
+ this.onIntersectionUpdate(intersection);
3787
+ }
3788
+ });
3789
+ Object.defineProperty(this, "onPanEnd", {
3790
+ enumerable: true,
3791
+ configurable: true,
3792
+ writable: true,
3793
+ value: (e) => {
3794
+ if (!this.pressPoint)
3795
+ return;
3796
+ this.onTap(e);
3797
+ }
3798
+ });
3799
+ /**
3800
+ * 1. 如果存在上一个点,需要绘制当前点到上一个点的连线
3801
+ * 2. 把上一个点的位置更新为当前点的位置
3802
+ * 3. 清除 mouseGroup 和 magnifier
3803
+ */
3804
+ Object.defineProperty(this, "onTap", {
3805
+ enumerable: true,
3806
+ configurable: true,
3807
+ writable: true,
3808
+ value: (e) => {
3809
+ if (!this.hasAppendDashed) {
3810
+ this.dashed.distanceItem.appendTo(this.container);
3811
+ this.group.add(this.dashed.mesh);
3812
+ }
3813
+ this.hasAppendDashed = true;
3814
+ const [intersection] = getIntersectionFromEvent(this.five, e);
3815
+ this.updateMouseGroup(intersection);
3816
+ const nowPoint = new Point(this.mouseGroup.position);
3817
+ const lastPoint = this.lastPoint;
3818
+ if (nowPoint)
3819
+ this.lastPoint = nowPoint;
3820
+ if (nowPoint && lastPoint) {
3821
+ const line = new Line(lastPoint, nowPoint, this.model);
3822
+ line.distanceItem.appendTo(this.container);
3823
+ this.model.addLine(line);
3824
+ this.group.add(line.mesh);
3825
+ line.distanceItem.update(this.five);
3826
+ }
3827
+ this.pressPoint = undefined;
3828
+ this.hasAppendMouseGroup = false;
3829
+ this.magnifier.dispose();
3830
+ this.group.remove(this.mouseGroup);
3831
+ this.updateDashed();
3832
+ this.five.needsRender = true;
3833
+ this.hook.emit('anchorChange', nowPoint.position);
3834
+ }
3835
+ });
3836
+ Object.defineProperty(this, "onWantsTapGesture", {
3837
+ enumerable: true,
3838
+ configurable: true,
3839
+ writable: true,
3840
+ value: () => false
3841
+ });
3842
+ /** 编辑时取消走点 */
3843
+ Object.defineProperty(this, "onWantsToMoveToPano", {
3844
+ enumerable: true,
3845
+ configurable: true,
3846
+ writable: true,
3847
+ value: () => false
3848
+ });
3849
+ /** 存在长按点时不能移动全景 */
3850
+ Object.defineProperty(this, "onWantsPanGesture", {
3851
+ enumerable: true,
3852
+ configurable: true,
3853
+ writable: true,
3854
+ value: () => (this.pressPoint ? false : undefined)
3855
+ });
3856
+ /** 移动全景时更新 distanceItem 在屏幕上的位置 */
3857
+ Object.defineProperty(this, "onCameraUpdate", {
3858
+ enumerable: true,
3859
+ configurable: true,
3860
+ writable: true,
3861
+ value: () => {
3862
+ this.updateDistanceUI();
3863
+ this.dashed.distanceItem.update(this.five);
3864
+ }
3865
+ });
3866
+ /** 更新虚线 */
3867
+ Object.defineProperty(this, "updateDashed", {
3868
+ enumerable: true,
3869
+ configurable: true,
3870
+ writable: true,
3871
+ value: () => {
3872
+ if (!this.lastPoint)
3873
+ return;
3874
+ this.dashed.points[0].position.copy(this.lastPoint.position);
3875
+ this.dashed.points[1].position.copy(this.mouseGroup.position);
3876
+ this.dashed.mesh.setPoints(this.lastPoint.position, this.mouseGroup.position);
3877
+ this.dashed.distanceItem.update(this.five);
3878
+ }
3879
+ });
3407
3880
  // ==================== 虚线 ====================
3408
3881
  this.dashed = new Line(new Point([0, 0, 0]), new Point([0, 0, 0]), this.model);
3409
3882
  this.dashed.mesh.setMaterial({ dashed: true, dashScale: 100 });
@@ -3429,12 +3902,13 @@ class EditController extends BaseController {
3429
3902
  hammer.on('panend', this.onPanEnd);
3430
3903
  }
3431
3904
  // fiveElement
3432
- this.fiveElement?.addEventListener('mouseleave', this.onMouseLeave);
3905
+ (_a = this.fiveElement) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseleave', this.onMouseLeave);
3433
3906
  // ==================== 其他 ====================
3434
3907
  this.hook.emit('anchorChange', null);
3435
3908
  this.five.refresh();
3436
3909
  }
3437
3910
  dispose() {
3911
+ var _a, _b;
3438
3912
  super.dispose();
3439
3913
  this.group.remove(this.mouseGroup, this.dashed.mesh);
3440
3914
  // ==================== 解除事件监听 ====================
@@ -3448,9 +3922,9 @@ class EditController extends BaseController {
3448
3922
  this.model.hook.off('lineAdded', this.onLineChanged);
3449
3923
  this.model.hook.off('lineRemoved', this.onLineChanged);
3450
3924
  // hammer
3451
- this.hammer?.destroy();
3925
+ (_a = this.hammer) === null || _a === void 0 ? void 0 : _a.destroy();
3452
3926
  // fiveElement
3453
- this.fiveElement?.removeEventListener('mouseleave', this.onMouseLeave);
3927
+ (_b = this.fiveElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', this.onMouseLeave);
3454
3928
  this.magnifier.dispose();
3455
3929
  this.dashed.distanceItem.remove();
3456
3930
  this.five.needsRender = true;
@@ -3458,133 +3932,6 @@ class EditController extends BaseController {
3458
3932
  getEditingLines() {
3459
3933
  return this.model.lines;
3460
3934
  }
3461
- /** 撤销编辑 */
3462
- revoke = () => {
3463
- // ============ revoke points ============
3464
- // 如果当前没有虚线,只有起始点,需要删除起始点,重置起始状态。并删除虚线实例
3465
- if (this.model.lines.length === 0 && this.lastPoint) {
3466
- this.lastPoint = null;
3467
- this.hasAppendDashed = false;
3468
- this.dashed.distanceItem.remove();
3469
- this.group.remove(this.dashed.mesh);
3470
- this.hook.emit('anchorChange', null);
3471
- this.five.needsRender = true;
3472
- return;
3473
- }
3474
- if (this.model.lines.length === 0 && !this.lastPoint)
3475
- return;
3476
- if (!this.lastPoint)
3477
- return;
3478
- const revokedLine = this.model.lines[this.model.lines.length - 1];
3479
- const lastPoint = revokedLine.findAnotherPoint(this.lastPoint);
3480
- if (!lastPoint)
3481
- return;
3482
- this.lastPoint = lastPoint;
3483
- this.hook.emit('anchorChange', lastPoint.position);
3484
- // ============ revoke lines ============
3485
- this.group.remove(revokedLine.mesh);
3486
- this.model.removeLine(revokedLine);
3487
- // ============ revoke mouse group ============
3488
- this.hasAppendMouseGroup = false;
3489
- this.mouseGroup.position.copy(this.lastPoint.position);
3490
- this.group.remove(this.mouseGroup);
3491
- // ============ revoke lineDistance ============
3492
- revokedLine.distanceItem.remove();
3493
- // ============ revoke dashed ============
3494
- this.updateDashed();
3495
- // ============ revoke magnifier ============
3496
- this.magnifier.dispose();
3497
- this.five.needsRender = true;
3498
- };
3499
- onMouseLeave = () => {
3500
- this.magnifier.dispose();
3501
- this.group.remove(this.mouseGroup);
3502
- this.hasAppendMouseGroup = false;
3503
- if (this.lastPoint) {
3504
- this.mouseGroup.position.copy(this.lastPoint.position);
3505
- this.updateDashed();
3506
- }
3507
- };
3508
- /** 编辑线条发生改变时通知外部 */
3509
- onLineChanged = () => {
3510
- this.hook.emit('editedLineChange', this.model.lines.map((line) => line.toCompletelyJson()));
3511
- };
3512
- onPress = (e) => {
3513
- const [intersection] = getIntersectionFromEvent(this.five, e);
3514
- if (!intersection || !intersection.face)
3515
- return;
3516
- const nowPoint = new Point(intersection.point);
3517
- this.pressPoint = nowPoint;
3518
- this.onIntersectionUpdate(intersection);
3519
- };
3520
- /**
3521
- * 1. 如果之前没有长按行为「即没有长按点时」-> 滑动全景
3522
- * 2. 如果有长按点,把长按点位置更新为当前位置
3523
- */
3524
- onPan = (e) => {
3525
- if (!this.pressPoint)
3526
- return;
3527
- const [intersection] = getIntersectionFromEvent(this.five, e);
3528
- if (!intersection || !intersection.face)
3529
- return;
3530
- this.onIntersectionUpdate(intersection);
3531
- };
3532
- onPanEnd = (e) => {
3533
- if (!this.pressPoint)
3534
- return;
3535
- this.onTap(e);
3536
- };
3537
- /**
3538
- * 1. 如果存在上一个点,需要绘制当前点到上一个点的连线
3539
- * 2. 把上一个点的位置更新为当前点的位置
3540
- * 3. 清除 mouseGroup 和 magnifier
3541
- */
3542
- onTap = (e) => {
3543
- if (!this.hasAppendDashed) {
3544
- this.dashed.distanceItem.appendTo(this.container);
3545
- this.group.add(this.dashed.mesh);
3546
- }
3547
- this.hasAppendDashed = true;
3548
- const [intersection] = getIntersectionFromEvent(this.five, e);
3549
- this.updateMouseGroup(intersection);
3550
- const nowPoint = new Point(this.mouseGroup.position);
3551
- const lastPoint = this.lastPoint;
3552
- if (nowPoint)
3553
- this.lastPoint = nowPoint;
3554
- if (nowPoint && lastPoint) {
3555
- const line = new Line(lastPoint, nowPoint, this.model);
3556
- line.distanceItem.appendTo(this.container);
3557
- this.model.addLine(line);
3558
- this.group.add(line.mesh);
3559
- line.distanceItem.update(this.five);
3560
- }
3561
- this.pressPoint = undefined;
3562
- this.hasAppendMouseGroup = false;
3563
- this.magnifier.dispose();
3564
- this.group.remove(this.mouseGroup);
3565
- this.updateDashed();
3566
- this.five.needsRender = true;
3567
- this.hook.emit('anchorChange', nowPoint.position);
3568
- };
3569
- onWantsTapGesture = () => false;
3570
- /** 编辑时取消走点 */
3571
- onWantsToMoveToPano = () => false;
3572
- /** 存在长按点时不能移动全景 */
3573
- onWantsPanGesture = () => (this.pressPoint ? false : undefined);
3574
- /** 移动全景时更新 distanceItem 在屏幕上的位置 */
3575
- onCameraUpdate = () => {
3576
- this.updateDistanceUI();
3577
- this.dashed.distanceItem.update(this.five);
3578
- };
3579
- /** 更新虚线 */
3580
- updateDashed = () => {
3581
- if (!this.lastPoint)
3582
- return;
3583
- this.dashed.points[0].position.copy(this.lastPoint.position);
3584
- this.dashed.points[1].position.copy(this.mouseGroup.position);
3585
- this.dashed.mesh.setPoints(this.lastPoint.position, this.mouseGroup.position);
3586
- this.dashed.distanceItem.update(this.five);
3587
- };
3588
3935
  }
3589
3936
 
3590
3937
  const svg = `<svg class="fpm__delete-icon" width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
@@ -3607,16 +3954,67 @@ const image$1 = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAABACAYAAADBA
3607
3954
  const image = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAABACAYAAADBAT+LAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAiKADAAQAAAABAAAAQAAAAABHi6MyAAAWC0lEQVR4Ae1dfaxl1VVf9955M8www8wwFQpYSpAEEMow0WpBpFGDbUxTjCY2RauJjR2skFbU1PiRQLRa/aM0YrEoTbF/FFsTSWppUyXYELW0FNQAQpWPwkAp4wDDMMMwH+9ef7+192+ffde59513eY+veezHOWudtddee62111p7v3PvPMxeb697YAEP9BboW5au0WjEOfrVtSrjNZ14fZFfz8TZaljjkkPIVo+t+2p5NW/NX4+v6ZJT90d5kjkCk65hhZNWPxNnm8SrPkJe87gO4zqI64V87Qfc1+v12PeSNS7WsrccFAMI7tstf7bWbv3kObZ/z+k2PHSyHT70ZhsNN6PvaMB1cA91oHPpqOzkEfAecEK20N0izMgfxWnmPFuad8H5k1rNfWGJPRgwwg8hm3DC1ML4yp7+AIHRf95Wze23VWuesaM3P24bjv+enbz1EXvnRx6Gr5+DCF67ESwMoGVtSeFlEJmDgvL6dtWPHWtP/ddFduiFtyMIzoZbVtkQvujn6YQTspEuGp+TK5Mb+dy4Nw0Q77TxHFM35iDrgfJSOCFbV3+nPpAhmS6QatLWKfZ16d85H+TSZyNUlXWb77cTT/+G/dQf3GnbfmYnJt2N6zkES54cT0toecWWIAFDc3D07Yrv22b7d19io/m3gcwKkpp8pdmC/5IjxcQhwjUgy5kGIntbPih1RYiC1Ec4qbUFgkuzEgWurJ8wXpyS3iWuiNaACTJrUpI/bxvecKdt/bmb7Zc+dT+6n8a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sBzB4aa6Pst8Q7CshshNuDbYvp3r7V+vP9YeumOj7X5sg+357gZ7Yd86fGttzg7igMvgiQ6MW0IMmMZBSfMu/riA0d5YwuOCdOkXx7dKfpgwBtzC8vkvDQ4hKnHYHOy1Af737KvXPmXrtjxp267YYe/+VX7BmB7xPzoXZlry47JVkGmaIFj4f+DmPwpfi4tnFl4MIP7KzIs68KJbBYEWXDTx1VBjah4eROkwQuFACx7p5OXFVvdFnP01r8bUtHpM3U86W81b9wufNl79rA68JGe4XJWCyr3eXvfAzB74f1jZ3oK55MvlAAAAAElFTkSuQmCC`;
3608
3955
 
3609
3956
  class DeleteDom {
3610
- visible = false;
3611
- five;
3612
- lines = [];
3613
- points = [];
3614
- onClick;
3615
- content = document.createElement('div');
3616
- container = document.createElement('div');
3617
3957
  constructor(five, opts) {
3958
+ Object.defineProperty(this, "visible", {
3959
+ enumerable: true,
3960
+ configurable: true,
3961
+ writable: true,
3962
+ value: false
3963
+ });
3964
+ Object.defineProperty(this, "five", {
3965
+ enumerable: true,
3966
+ configurable: true,
3967
+ writable: true,
3968
+ value: void 0
3969
+ });
3970
+ Object.defineProperty(this, "lines", {
3971
+ enumerable: true,
3972
+ configurable: true,
3973
+ writable: true,
3974
+ value: []
3975
+ });
3976
+ Object.defineProperty(this, "points", {
3977
+ enumerable: true,
3978
+ configurable: true,
3979
+ writable: true,
3980
+ value: []
3981
+ });
3982
+ Object.defineProperty(this, "onClick", {
3983
+ enumerable: true,
3984
+ configurable: true,
3985
+ writable: true,
3986
+ value: void 0
3987
+ });
3988
+ Object.defineProperty(this, "content", {
3989
+ enumerable: true,
3990
+ configurable: true,
3991
+ writable: true,
3992
+ value: document.createElement('div')
3993
+ });
3994
+ Object.defineProperty(this, "container", {
3995
+ enumerable: true,
3996
+ configurable: true,
3997
+ writable: true,
3998
+ value: document.createElement('div')
3999
+ });
4000
+ Object.defineProperty(this, "onMouseEnter", {
4001
+ enumerable: true,
4002
+ configurable: true,
4003
+ writable: true,
4004
+ value: () => {
4005
+ this.content.style.backgroundImage = `url(${image})`;
4006
+ }
4007
+ });
4008
+ Object.defineProperty(this, "onMouseLeave", {
4009
+ enumerable: true,
4010
+ configurable: true,
4011
+ writable: true,
4012
+ value: () => {
4013
+ this.content.style.backgroundImage = `url(${image$1})`;
4014
+ }
4015
+ });
3618
4016
  this.five = five;
3619
- this.onClick = opts?.onClick || (() => void 0);
4017
+ this.onClick = (opts === null || opts === void 0 ? void 0 : opts.onClick) || (() => void 0);
3620
4018
  // container
3621
4019
  this.container.classList.add('fpm__delete');
3622
4020
  this.container.style.opacity = '0';
@@ -3704,12 +4102,6 @@ class DeleteDom {
3704
4102
  this.container.style.pointerEvents = 'auto';
3705
4103
  return this;
3706
4104
  }
3707
- onMouseEnter = () => {
3708
- this.content.style.backgroundImage = `url(${image})`;
3709
- };
3710
- onMouseLeave = () => {
3711
- this.content.style.backgroundImage = `url(${image$1})`;
3712
- };
3713
4105
  }
3714
4106
 
3715
4107
  /**
@@ -3811,14 +4203,240 @@ function findAssociatedLines(line) {
3811
4203
  }
3812
4204
 
3813
4205
  class WatchController extends BaseController {
3814
- type = 'watch';
3815
- deleteDom;
3816
- highlightedLines = [];
3817
- fiveElement;
3818
- editPointState;
3819
- hammer;
3820
4206
  constructor(params) {
3821
4207
  super(params);
4208
+ Object.defineProperty(this, "type", {
4209
+ enumerable: true,
4210
+ configurable: true,
4211
+ writable: true,
4212
+ value: 'watch'
4213
+ });
4214
+ Object.defineProperty(this, "deleteDom", {
4215
+ enumerable: true,
4216
+ configurable: true,
4217
+ writable: true,
4218
+ value: void 0
4219
+ });
4220
+ Object.defineProperty(this, "highlightedLines", {
4221
+ enumerable: true,
4222
+ configurable: true,
4223
+ writable: true,
4224
+ value: []
4225
+ });
4226
+ Object.defineProperty(this, "fiveElement", {
4227
+ enumerable: true,
4228
+ configurable: true,
4229
+ writable: true,
4230
+ value: void 0
4231
+ });
4232
+ Object.defineProperty(this, "editPointState", {
4233
+ enumerable: true,
4234
+ configurable: true,
4235
+ writable: true,
4236
+ value: void 0
4237
+ });
4238
+ Object.defineProperty(this, "hammer", {
4239
+ enumerable: true,
4240
+ configurable: true,
4241
+ writable: true,
4242
+ value: void 0
4243
+ });
4244
+ Object.defineProperty(this, "onPanStart", {
4245
+ enumerable: true,
4246
+ configurable: true,
4247
+ writable: true,
4248
+ value: (e) => {
4249
+ var _a;
4250
+ if (this.model.points.length === 0 || !this.fiveElement)
4251
+ return;
4252
+ const mouse = getPointFromHammerEvent(e).point;
4253
+ const closestPoint = (_a = findClosestPoint(this.five, this.model.points, mouse, 20)) === null || _a === void 0 ? void 0 : _a.point;
4254
+ if (!closestPoint) {
4255
+ this.editPointState = undefined;
4256
+ return;
4257
+ }
4258
+ const editPointState = {
4259
+ point: closestPoint,
4260
+ associatedLines: findAssociatedLines(closestPoint.lines[0]),
4261
+ };
4262
+ const cancelDragLine = this.hook.emit('wantsDragLine', {
4263
+ point: closestPoint.id,
4264
+ lines: editPointState.associatedLines.map(({ id }) => id),
4265
+ });
4266
+ if (cancelDragLine)
4267
+ return;
4268
+ this.editPointState = editPointState;
4269
+ this.magnifier.appendTo(this.container);
4270
+ this.group.add(this.mouseGroup);
4271
+ }
4272
+ });
4273
+ Object.defineProperty(this, "onPanEnd", {
4274
+ enumerable: true,
4275
+ configurable: true,
4276
+ writable: true,
4277
+ value: () => {
4278
+ if (!this.editPointState)
4279
+ return;
4280
+ // 把拖动的线从虚线转换为实线
4281
+ this.editPointState.point.lines.forEach((line) => line.mesh.setMaterial({ dashed: false }));
4282
+ // 还原选中态
4283
+ this.highlightLines(this.editPointState.associatedLines);
4284
+ this.editPointState = undefined;
4285
+ this.magnifier.dispose();
4286
+ this.group.remove(this.mouseGroup);
4287
+ }
4288
+ });
4289
+ Object.defineProperty(this, "onPan", {
4290
+ enumerable: true,
4291
+ configurable: true,
4292
+ writable: true,
4293
+ value: (e) => {
4294
+ if (!this.editPointState || !this.fiveElement)
4295
+ return;
4296
+ const mouse = getPointFromHammerEvent(e).ndcPoint;
4297
+ const raycaster = new three.Raycaster();
4298
+ raycaster.setFromCamera(mouse, this.five.camera);
4299
+ const [intersection] = this.five.model.intersectRaycaster(raycaster);
4300
+ if (!intersection)
4301
+ return;
4302
+ this.onIntersectionUpdate(intersection);
4303
+ }
4304
+ });
4305
+ Object.defineProperty(this, "onIntersectionUpdate", {
4306
+ enumerable: true,
4307
+ configurable: true,
4308
+ writable: true,
4309
+ value: (intersection, mesh) => {
4310
+ if (!this.editPointState)
4311
+ return;
4312
+ // 拖动过程中清除选中态
4313
+ this.clearHighlightLines();
4314
+ // 把拖动点相关的线变成虚线 & 改变相关线的位置
4315
+ this.editPointState.point.position.copy(intersection.point);
4316
+ this.editPointState.point.lines.forEach((line) => {
4317
+ line.mesh.setPoints(line.points[0].position.clone(), line.points[1].position.clone());
4318
+ line.lightMesh.setPoints(line.points[0].position.clone(), line.points[1].position.clone());
4319
+ line.mesh.setMaterial({ dashed: true });
4320
+ });
4321
+ this.updateDistanceUI();
4322
+ this.magnifier.updateWithPoint(intersection.point);
4323
+ this.mouseGroup.position.copy(intersection.point);
4324
+ if (mesh) {
4325
+ this.mouseGroup.quaternion.copy(mesh.quaternion);
4326
+ }
4327
+ else if (intersection.face) {
4328
+ const face = intersection.face.normal;
4329
+ const positionVector = face.clone().multiplyScalar(0.05);
4330
+ const position = intersection.point.clone().add(positionVector);
4331
+ const lookAtVector = position.clone().add(positionVector);
4332
+ this.mouseGroup.lookAt(lookAtVector);
4333
+ }
4334
+ this.five.needsRender = true;
4335
+ this.hook.emit('selectedChange', this.editPointState.associatedLines.map((line) => line.toCompletelyJson()));
4336
+ }
4337
+ });
4338
+ Object.defineProperty(this, "wantsPanGesture", {
4339
+ enumerable: true,
4340
+ configurable: true,
4341
+ writable: true,
4342
+ value: () => {
4343
+ if (this.editPointState)
4344
+ return false;
4345
+ }
4346
+ });
4347
+ Object.defineProperty(this, "wantsTapGesture", {
4348
+ enumerable: true,
4349
+ configurable: true,
4350
+ writable: true,
4351
+ value: (raycaster) => {
4352
+ const [target] = this.five.model.intersectRaycaster(raycaster);
4353
+ if (!target)
4354
+ return;
4355
+ const camera = this.five.camera;
4356
+ const ndcTarget = target.point.clone().project(camera);
4357
+ const screenWidth = this.container.clientWidth;
4358
+ const screenHeight = this.container.clientHeight;
4359
+ const targetScreenPosition = new three.Vector2(ndcTarget.x * screenWidth, ndcTarget.y * screenHeight);
4360
+ // 把线的端点全部映射到屏幕上,过滤掉不在视野内的线,同时乘以屏幕宽 & 高
4361
+ const screenLines = this.model.lines
4362
+ .map((line) => {
4363
+ const [startPoint, endPoint] = line.points;
4364
+ const ndcStartPoint = startPoint.position.clone().project(camera);
4365
+ const ndcEndPoint = endPoint.position.clone().project(camera);
4366
+ if (!isNDCPointInScreen(ndcStartPoint) && !isNDCPointInScreen(ndcEndPoint))
4367
+ return null;
4368
+ const startScreenPosition = new three.Vector2(ndcStartPoint.x * screenWidth, ndcStartPoint.y * screenHeight);
4369
+ const endScreenPosition = new three.Vector2(ndcEndPoint.x * screenWidth, ndcEndPoint.y * screenHeight);
4370
+ return { id: line.id, points: [startScreenPosition, endScreenPosition] };
4371
+ })
4372
+ .filter((line) => !!line);
4373
+ if (screenLines.length === 0)
4374
+ return;
4375
+ // 找这些线距离鼠标点击位置最近的线
4376
+ const distanceLines = screenLines
4377
+ .map((line) => {
4378
+ const closestPoint = closestPointOnLine(targetScreenPosition, line.points);
4379
+ return { id: line.id, distance: closestPoint.distanceTo(targetScreenPosition) };
4380
+ })
4381
+ .sort((a, b) => a.distance - b.distance);
4382
+ const closestScreenLine = distanceLines[0];
4383
+ if (closestScreenLine.distance > 20)
4384
+ return;
4385
+ const closestLine = this.model.lines.find(({ id }) => id === closestScreenLine.id);
4386
+ if (!closestLine)
4387
+ return;
4388
+ this.chooseLine(closestLine);
4389
+ return false;
4390
+ }
4391
+ });
4392
+ Object.defineProperty(this, "chooseLine", {
4393
+ enumerable: true,
4394
+ configurable: true,
4395
+ writable: true,
4396
+ value: (line) => {
4397
+ const highlightLines = findAssociatedLines(line);
4398
+ this.highlightLines(highlightLines);
4399
+ this.five.needsRender = true;
4400
+ this.hook.emit('selectedChange', highlightLines.map((line) => line.toCompletelyJson()));
4401
+ }
4402
+ });
4403
+ Object.defineProperty(this, "lineRemoved", {
4404
+ enumerable: true,
4405
+ configurable: true,
4406
+ writable: true,
4407
+ value: (line) => {
4408
+ this.removeLine(line);
4409
+ // TODO: 这个逻辑不太好,改进一下
4410
+ this.hook.emit('selectedChange', this.model.lines.filter((line) => line.selected).map((line) => line.toCompletelyJson()));
4411
+ }
4412
+ });
4413
+ Object.defineProperty(this, "onCameraUpdate", {
4414
+ enumerable: true,
4415
+ configurable: true,
4416
+ writable: true,
4417
+ value: () => {
4418
+ this.updateDistanceUI();
4419
+ this.highlightedLines.length > 0 && this.deleteDom.updatePosition();
4420
+ }
4421
+ });
4422
+ Object.defineProperty(this, "deleteDomClickCallback", {
4423
+ enumerable: true,
4424
+ configurable: true,
4425
+ writable: true,
4426
+ value: () => {
4427
+ const firstLine = this.highlightedLines[0];
4428
+ // TODO: 优化折线的删除逻辑
4429
+ firstLine
4430
+ .getPolyline()
4431
+ .lines.slice()
4432
+ .reverse()
4433
+ .forEach((line) => this.model.removeLine(line));
4434
+ this.highlightedLines = [];
4435
+ // this.clearHighlightLines()
4436
+ // this.highlightedLines.forEach((line) => this.model.removeLine(line))
4437
+ this.deleteDom.setLines([]).hide();
4438
+ }
4439
+ });
3822
4440
  this.deleteDom = new DeleteDom(this.five, { onClick: this.deleteDomClickCallback }).appendTo(this.container);
3823
4441
  this.model.lines.forEach((line) => {
3824
4442
  line.distanceItem.appendTo(this.container);
@@ -3842,6 +4460,7 @@ class WatchController extends BaseController {
3842
4460
  this.five.needsRender = true;
3843
4461
  }
3844
4462
  dispose() {
4463
+ var _a;
3845
4464
  super.dispose();
3846
4465
  this.deleteDom.dispose();
3847
4466
  this.model.hook.off('lineRemoved', this.lineRemoved);
@@ -3850,7 +4469,7 @@ class WatchController extends BaseController {
3850
4469
  this.five.off('wantsTapGesture', this.wantsTapGesture);
3851
4470
  this.five.needsRender = true;
3852
4471
  this.hook.emit('selectedChange', []);
3853
- this.hammer?.destroy();
4472
+ (_a = this.hammer) === null || _a === void 0 ? void 0 : _a.destroy();
3854
4473
  }
3855
4474
  highlightLine(line) {
3856
4475
  if (line.selected)
@@ -3872,157 +4491,12 @@ class WatchController extends BaseController {
3872
4491
  this.highlightedLines = [];
3873
4492
  this.five.needsRender = true;
3874
4493
  }
3875
- onPanStart = (e) => {
3876
- if (this.model.points.length === 0 || !this.fiveElement)
3877
- return;
3878
- const mouse = getPointFromHammerEvent(e).point;
3879
- const closestPoint = findClosestPoint(this.five, this.model.points, mouse, 20)?.point;
3880
- if (!closestPoint) {
3881
- this.editPointState = undefined;
3882
- return;
3883
- }
3884
- const editPointState = {
3885
- point: closestPoint,
3886
- associatedLines: findAssociatedLines(closestPoint.lines[0]),
3887
- };
3888
- const cancelDragLine = this.hook.emit('wantsDragLine', {
3889
- point: closestPoint.id,
3890
- lines: editPointState.associatedLines.map(({ id }) => id),
3891
- });
3892
- if (cancelDragLine)
3893
- return;
3894
- this.editPointState = editPointState;
3895
- this.magnifier.appendTo(this.container);
3896
- this.group.add(this.mouseGroup);
3897
- };
3898
- onPanEnd = () => {
3899
- if (!this.editPointState)
3900
- return;
3901
- // 把拖动的线从虚线转换为实线
3902
- this.editPointState.point.lines.forEach((line) => line.mesh.setMaterial({ dashed: false }));
3903
- // 还原选中态
3904
- this.highlightLines(this.editPointState.associatedLines);
3905
- this.editPointState = undefined;
3906
- this.magnifier.dispose();
3907
- this.group.remove(this.mouseGroup);
3908
- };
3909
- onPan = (e) => {
3910
- if (!this.editPointState || !this.fiveElement)
3911
- return;
3912
- const mouse = getPointFromHammerEvent(e).ndcPoint;
3913
- const raycaster = new three.Raycaster();
3914
- raycaster.setFromCamera(mouse, this.five.camera);
3915
- const [intersection] = this.five.model.intersectRaycaster(raycaster);
3916
- if (!intersection)
3917
- return;
3918
- this.onIntersectionUpdate(intersection);
3919
- };
3920
- onIntersectionUpdate = (intersection, mesh) => {
3921
- if (!this.editPointState)
3922
- return;
3923
- // 拖动过程中清除选中态
3924
- this.clearHighlightLines();
3925
- // 把拖动点相关的线变成虚线 & 改变相关线的位置
3926
- this.editPointState.point.position.copy(intersection.point);
3927
- this.editPointState.point.lines.forEach((line) => {
3928
- line.mesh.setPoints(line.points[0].position.clone(), line.points[1].position.clone());
3929
- line.lightMesh.setPoints(line.points[0].position.clone(), line.points[1].position.clone());
3930
- line.mesh.setMaterial({ dashed: true });
3931
- });
3932
- this.updateDistanceUI();
3933
- this.magnifier.updateWithPoint(intersection.point);
3934
- this.mouseGroup.position.copy(intersection.point);
3935
- if (mesh) {
3936
- this.mouseGroup.quaternion.copy(mesh.quaternion);
3937
- }
3938
- else if (intersection.face) {
3939
- const face = intersection.face.normal;
3940
- const positionVector = face.clone().multiplyScalar(0.05);
3941
- const position = intersection.point.clone().add(positionVector);
3942
- const lookAtVector = position.clone().add(positionVector);
3943
- this.mouseGroup.lookAt(lookAtVector);
3944
- }
3945
- this.five.needsRender = true;
3946
- this.hook.emit('selectedChange', this.editPointState.associatedLines.map((line) => line.toCompletelyJson()));
3947
- };
3948
- wantsPanGesture = () => {
3949
- if (this.editPointState)
3950
- return false;
3951
- };
3952
- wantsTapGesture = (raycaster) => {
3953
- const [target] = this.five.model.intersectRaycaster(raycaster);
3954
- if (!target)
3955
- return;
3956
- const camera = this.five.camera;
3957
- const ndcTarget = target.point.clone().project(camera);
3958
- const screenWidth = this.container.clientWidth;
3959
- const screenHeight = this.container.clientHeight;
3960
- const targetScreenPosition = new three.Vector2(ndcTarget.x * screenWidth, ndcTarget.y * screenHeight);
3961
- // 把线的端点全部映射到屏幕上,过滤掉不在视野内的线,同时乘以屏幕宽 & 高
3962
- const screenLines = this.model.lines
3963
- .map((line) => {
3964
- const [startPoint, endPoint] = line.points;
3965
- const ndcStartPoint = startPoint.position.clone().project(camera);
3966
- const ndcEndPoint = endPoint.position.clone().project(camera);
3967
- if (!isNDCPointInScreen(ndcStartPoint) && !isNDCPointInScreen(ndcEndPoint))
3968
- return null;
3969
- const startScreenPosition = new three.Vector2(ndcStartPoint.x * screenWidth, ndcStartPoint.y * screenHeight);
3970
- const endScreenPosition = new three.Vector2(ndcEndPoint.x * screenWidth, ndcEndPoint.y * screenHeight);
3971
- return { id: line.id, points: [startScreenPosition, endScreenPosition] };
3972
- })
3973
- .filter((line) => !!line);
3974
- if (screenLines.length === 0)
3975
- return;
3976
- // 找这些线距离鼠标点击位置最近的线
3977
- const distanceLines = screenLines
3978
- .map((line) => {
3979
- const closestPoint = closestPointOnLine(targetScreenPosition, line.points);
3980
- return { id: line.id, distance: closestPoint.distanceTo(targetScreenPosition) };
3981
- })
3982
- .sort((a, b) => a.distance - b.distance);
3983
- const closestScreenLine = distanceLines[0];
3984
- if (closestScreenLine.distance > 20)
3985
- return;
3986
- const closestLine = this.model.lines.find(({ id }) => id === closestScreenLine.id);
3987
- if (!closestLine)
3988
- return;
3989
- this.chooseLine(closestLine);
3990
- return false;
3991
- };
3992
- chooseLine = (line) => {
3993
- const highlightLines = findAssociatedLines(line);
3994
- this.highlightLines(highlightLines);
3995
- this.five.needsRender = true;
3996
- this.hook.emit('selectedChange', highlightLines.map((line) => line.toCompletelyJson()));
3997
- };
3998
4494
  highlightLines(lines) {
3999
4495
  this.clearHighlightLines();
4000
4496
  this.highlightedLines = lines;
4001
4497
  this.deleteDom.setLines(lines).updatePosition().show();
4002
4498
  lines.forEach((line) => this.highlightLine(line));
4003
4499
  }
4004
- lineRemoved = (line) => {
4005
- this.removeLine(line);
4006
- // TODO: 这个逻辑不太好,改进一下
4007
- this.hook.emit('selectedChange', this.model.lines.filter((line) => line.selected).map((line) => line.toCompletelyJson()));
4008
- };
4009
- onCameraUpdate = () => {
4010
- this.updateDistanceUI();
4011
- this.highlightedLines.length > 0 && this.deleteDom.updatePosition();
4012
- };
4013
- deleteDomClickCallback = () => {
4014
- const firstLine = this.highlightedLines[0];
4015
- // TODO: 优化折线的删除逻辑
4016
- firstLine
4017
- .getPolyline()
4018
- .lines.slice()
4019
- .reverse()
4020
- .forEach((line) => this.model.removeLine(line));
4021
- this.highlightedLines = [];
4022
- // this.clearHighlightLines()
4023
- // this.highlightedLines.forEach((line) => this.model.removeLine(line))
4024
- this.deleteDom.setLines([]).hide();
4025
- };
4026
4500
  }
4027
4501
 
4028
4502
  const planTextureUrl = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoAAAI6CAMAAAAZlhLyAAACB1BMVEUAAAD+/v6qqqqgoKCLi4t7e3u4uLhvb29MTExZWVlCQkJgYGBqamo4ODi9vb3///9FRUXPz887Ozv///9QUFBWVlZdXV38/Pzj4+Pn5+f8/Pz5+fn9/f329vZoaGje3t78/Pz////x8fH8/Pzs7OyBgYHd3d39/f319fX+/v79/f2Kior6+vr////+/v76+vr+/v7////8/Pz9/f3+/v7m5ub7+/v+/v7+/v7j4+P////+/v79/f3d3d3h4eH4+Pj+/v79/f12dnbc3Nz9/f3w8PD9/f34+Pj9/f3+/v5jY2P8/Pz9/f2ioqJubm7v7+/+/v76+vr5+fnv7+/09PSDg4P////t7e3+/v7+/v7+/v7///+ZmZl7e3v7+/vy8vL+/v7+/v7p6en19fX////s7Oz+/v6lpaX+/v7r6+vg4OD9/f3q6ur///////+UlJTt7e329vbz8/Pg4OD///+wsLCdnZ2QkJDe3t77+/vz8/Pw8PD+/v7c3Nyqqqrw8PD4+Pj+/v7////4+Pj////s7Oyurq7f39/p6en8/Pz////8/Pz19fVycnK0tLT////q6ure3t7o6Oj////s7Oz39/fd3d3h4eH+/v7j4+P////+/v7n5+f///////////////+ysrLe3t7////////8/PzHx8fl5eX////39/fv7+/d3d3///8S/hbOAAAArHRSTlMAzhATFhkNGyEfIx4dJQ/OKwoozS4wMh3Uy4SPbjs34kJ9EAkGP+8Snk1nRRo5JYl2eDQiA88wY3PXRDYN6dyTX0s751SxPJdhPjRdV1M4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643Pf1PB9Ojma/eeP6cOfgMh+7arx8O1rP/rZ+Pg/nY/0bbT/ehuOq9oPMd85ywKkw2HSoS/OzobSoY1h4klOpMMx0qEvpENLl8PLZgGlLhPpIB06c5lcB5S6TqSDdDhGOvTFpnG9CSi1SaRDuZPNSbOAUieJdJAOnTl5lw6tvGcB0qEjT1mAdOjI0+BpMBgElGq6kQ7SoUPjwXgsHVoYZwHS4TDp0BfTLEA6dGQymTYXUGqSSAfp0Jn5ZDKfS4dy8yyg1N8sQDocJh364jWRDuVes4BSi9fFQjq0sMgCSi3u0wWUuk+kQ7ltKmcbUGqbSAfp0Jntc0M6lHvOAkpVz1VVSYdyVRYgHTpSVXfNAkrdJdJBOnRmvb5br9cBpZpupIN06ND6Jl1AqZtEOkiHY6RDX0iHlm5Ok4BSp9KhdTqzmXQoN8sCpENHZrOHZgGlHhLp0Cqdc+nQwnkWIB0Okw59cX6bLqDUbSIdpENnRrcj6dDGKAuQDh3Z7Xaj3S6g1K4hHVqo611d1wHl6dTSoY1lvazrZUCpZSIdpENnlsljQKnHRDpIh2OkQ1+sGo+rgFKrRDqUu1hdXEiHFi6yAOlwmHToi6ssQDocJh364uXqpVnAv3bp0IhBIAig6HaBh5uJQSJpghSQBtIGhq5zd5qIRTCI934LP+vTWIe8YfgM1uGCoQuwDuesw1NYh4vmapgDsubGOliH22zbXAvI2hrrkLe9rcMl7y7AOtzk1QVYh3PW4SnGxjrkjV1A1jquq3W4YO0CrMM56/AU3y7AOtxkmr61gKypsQ5501HPOQKyynGUYh3ySheQVZZSFuuQt3QB1uGcdXiKvY6z7wFpe4R1/vsBKXObiM3QZ5oAAAAASUVORK5CYII=`;
@@ -4266,24 +4740,53 @@ function requestAnimationFrameInterval(callback, frame = 60) {
4266
4740
  // export { default as tween } from './tween'
4267
4741
 
4268
4742
  class BetterTween extends TWEEN__default["default"].Tween {
4269
- disposeMethods = [];
4270
- animationFrameDisposer;
4271
- onDispose = (callback) => {
4272
- this.disposeMethods.push(callback);
4273
- return this;
4274
- };
4275
- play = () => {
4276
- this.start(0);
4277
- this.animationFrameDisposer = requestAnimationFrameInterval((time) => this.update(time));
4278
- return this;
4279
- };
4280
- dispose = () => {
4281
- this.stop();
4282
- this.animationFrameDisposer?.();
4283
- this.disposeMethods.forEach((fn) => fn());
4284
- this.disposeMethods = [];
4285
- TWEEN__default["default"].remove(this);
4286
- };
4743
+ constructor() {
4744
+ super(...arguments);
4745
+ Object.defineProperty(this, "disposeMethods", {
4746
+ enumerable: true,
4747
+ configurable: true,
4748
+ writable: true,
4749
+ value: []
4750
+ });
4751
+ Object.defineProperty(this, "animationFrameDisposer", {
4752
+ enumerable: true,
4753
+ configurable: true,
4754
+ writable: true,
4755
+ value: void 0
4756
+ });
4757
+ Object.defineProperty(this, "onDispose", {
4758
+ enumerable: true,
4759
+ configurable: true,
4760
+ writable: true,
4761
+ value: (callback) => {
4762
+ this.disposeMethods.push(callback);
4763
+ return this;
4764
+ }
4765
+ });
4766
+ Object.defineProperty(this, "play", {
4767
+ enumerable: true,
4768
+ configurable: true,
4769
+ writable: true,
4770
+ value: () => {
4771
+ this.start(0);
4772
+ this.animationFrameDisposer = requestAnimationFrameInterval((time) => this.update(time));
4773
+ return this;
4774
+ }
4775
+ });
4776
+ Object.defineProperty(this, "dispose", {
4777
+ enumerable: true,
4778
+ configurable: true,
4779
+ writable: true,
4780
+ value: () => {
4781
+ var _a;
4782
+ this.stop();
4783
+ (_a = this.animationFrameDisposer) === null || _a === void 0 ? void 0 : _a.call(this);
4784
+ this.disposeMethods.forEach((fn) => fn());
4785
+ this.disposeMethods = [];
4786
+ TWEEN__default["default"].remove(this);
4787
+ }
4788
+ });
4789
+ }
4287
4790
  }
4288
4791
  function tweenProgress(duration, easing = TWEEN__default["default"].Easing.Linear.None) {
4289
4792
  const tween = new BetterTween({ progress: 0 }).to({ progress: 1 });
@@ -4295,11 +4798,84 @@ function tweenProgress(duration, easing = TWEEN__default["default"].Easing.Linea
4295
4798
  }
4296
4799
 
4297
4800
  class MainBtnController {
4298
- container;
4299
- measureController;
4300
- mainIconMaskTween;
4301
- mainElement;
4302
4801
  constructor(measureController, container) {
4802
+ Object.defineProperty(this, "container", {
4803
+ enumerable: true,
4804
+ configurable: true,
4805
+ writable: true,
4806
+ value: void 0
4807
+ });
4808
+ Object.defineProperty(this, "measureController", {
4809
+ enumerable: true,
4810
+ configurable: true,
4811
+ writable: true,
4812
+ value: void 0
4813
+ });
4814
+ Object.defineProperty(this, "mainIconMaskTween", {
4815
+ enumerable: true,
4816
+ configurable: true,
4817
+ writable: true,
4818
+ value: void 0
4819
+ });
4820
+ Object.defineProperty(this, "mainElement", {
4821
+ enumerable: true,
4822
+ configurable: true,
4823
+ writable: true,
4824
+ value: void 0
4825
+ });
4826
+ /* 鼠标移入时变成蓝色 */
4827
+ Object.defineProperty(this, "onMouseEnter", {
4828
+ enumerable: true,
4829
+ configurable: true,
4830
+ writable: true,
4831
+ value: () => {
4832
+ const { mainItem, pathDom } = this.mainElement;
4833
+ mainItem.style.opacity = '1';
4834
+ pathDom.setAttribute('fill', MAIN_MOUSE_ENTER_FILL);
4835
+ }
4836
+ });
4837
+ /* 鼠标移出时变成灰色 */
4838
+ Object.defineProperty(this, "onMouseLeave", {
4839
+ enumerable: true,
4840
+ configurable: true,
4841
+ writable: true,
4842
+ value: () => {
4843
+ const { mainItem, pathDom } = this.mainElement;
4844
+ mainItem.style.opacity = '0.7';
4845
+ pathDom.setAttribute('fill', MAIN_MOUSE_LEAVE_FILL);
4846
+ }
4847
+ });
4848
+ Object.defineProperty(this, "onClick", {
4849
+ enumerable: true,
4850
+ configurable: true,
4851
+ writable: true,
4852
+ value: () => {
4853
+ const mode = this.measureController.getCurrentMode();
4854
+ mode === 'Watch' ? this.measureController.changeMode('Edit') : this.measureController.save().changeMode('Watch');
4855
+ }
4856
+ });
4857
+ Object.defineProperty(this, "editedLineChangeHandler", {
4858
+ enumerable: true,
4859
+ configurable: true,
4860
+ writable: true,
4861
+ value: (lines) => {
4862
+ // 线的数量大于 1 时,没有状态的变化
4863
+ if (lines.length > 1)
4864
+ return;
4865
+ // 因为撤销导致的状态变更 -> 取消
4866
+ if (lines.length === 0)
4867
+ return this.change2Cancel(false);
4868
+ this.change2Done();
4869
+ }
4870
+ });
4871
+ Object.defineProperty(this, "modeChangeHandler", {
4872
+ enumerable: true,
4873
+ configurable: true,
4874
+ writable: true,
4875
+ value: (mode) => {
4876
+ mode === 'Watch' ? this.change2Add() : this.change2Cancel();
4877
+ }
4878
+ });
4303
4879
  this.measureController = measureController;
4304
4880
  this.container = container;
4305
4881
  this.mainElement = this.getMainElement();
@@ -4322,8 +4898,8 @@ class MainBtnController {
4322
4898
  const mainTextDom = this.container.querySelector('.fpm__main-text');
4323
4899
  const mainItem = this.container.querySelector('.fpm__main');
4324
4900
  const mainIcon = this.container.querySelector('.fpm__main-icon');
4325
- const pathDom = mainItem?.querySelector('.fpm__main-icon-path');
4326
- const maskWhiteRect = mainIcon?.querySelector('#fpm__main-icon-mask-white');
4901
+ const pathDom = mainItem === null || mainItem === void 0 ? void 0 : mainItem.querySelector('.fpm__main-icon-path');
4902
+ const maskWhiteRect = mainIcon === null || mainIcon === void 0 ? void 0 : mainIcon.querySelector('#fpm__main-icon-mask-white');
4327
4903
  if (!mainItem || !mainTextDom || !mainIcon || !pathDom || !maskWhiteRect)
4328
4904
  throw new Error('cannot find dom');
4329
4905
  return { mainTextDom, mainItem, mainIcon, pathDom, maskWhiteRect };
@@ -4334,7 +4910,7 @@ class MainBtnController {
4334
4910
  mainIcon.style.transition = mainTextDom.innerText === '完成' ? 'none' : 'transform 300ms ease-in-out';
4335
4911
  mainIcon.style.transform = 'rotate(0deg)';
4336
4912
  mainTextDom.innerText = '添加';
4337
- pathDom?.setAttribute('d', MAIN_NORMAL_PATH);
4913
+ pathDom === null || pathDom === void 0 ? void 0 : pathDom.setAttribute('d', MAIN_NORMAL_PATH);
4338
4914
  }
4339
4915
  change2Cancel(withAnime = true) {
4340
4916
  const { mainIcon, mainTextDom, pathDom } = this.mainElement;
@@ -4346,6 +4922,7 @@ class MainBtnController {
4346
4922
  this.measureController.hook.on('editedLineChange', this.editedLineChangeHandler);
4347
4923
  }
4348
4924
  change2Done() {
4925
+ var _a;
4349
4926
  const { mainTextDom, mainIcon, pathDom, maskWhiteRect } = this.getMainElement();
4350
4927
  if (mainTextDom.innerText === '完成')
4351
4928
  return;
@@ -4354,51 +4931,71 @@ class MainBtnController {
4354
4931
  mainTextDom.innerText = '完成';
4355
4932
  pathDom.setAttribute('d', MAIN_DONE_PATH);
4356
4933
  pathDom.setAttribute('mask', `url(#fpm__main-icon-mask)`);
4357
- this.mainIconMaskTween?.dispose();
4934
+ (_a = this.mainIconMaskTween) === null || _a === void 0 ? void 0 : _a.dispose();
4358
4935
  this.mainIconMaskTween = tweenProgress()
4359
4936
  .easing(TWEEN__default["default"].Easing.Quartic.InOut)
4360
4937
  .onUpdate(({ progress }) => {
4361
4938
  maskWhiteRect.setAttribute('width', (progress * 30).toString());
4362
4939
  })
4363
- .onComplete(() => this.mainIconMaskTween?.dispose())
4940
+ .onComplete(() => { var _a; return (_a = this.mainIconMaskTween) === null || _a === void 0 ? void 0 : _a.dispose(); })
4364
4941
  .play();
4365
4942
  }
4366
- /* 鼠标移入时变成蓝色 */
4367
- onMouseEnter = () => {
4368
- const { mainItem, pathDom } = this.mainElement;
4369
- mainItem.style.opacity = '1';
4370
- pathDom.setAttribute('fill', MAIN_MOUSE_ENTER_FILL);
4371
- };
4372
- /* 鼠标移出时变成灰色 */
4373
- onMouseLeave = () => {
4374
- const { mainItem, pathDom } = this.mainElement;
4375
- mainItem.style.opacity = '0.7';
4376
- pathDom.setAttribute('fill', MAIN_MOUSE_LEAVE_FILL);
4377
- };
4378
- onClick = () => {
4379
- const mode = this.measureController.getCurrentMode();
4380
- mode === 'Watch' ? this.measureController.changeMode('Edit') : this.measureController.save().changeMode('Watch');
4381
- };
4382
- editedLineChangeHandler = (lines) => {
4383
- // 线的数量大于 1 时,没有状态的变化
4384
- if (lines.length > 1)
4385
- return;
4386
- // 因为撤销导致的状态变更 -> 取消
4387
- if (lines.length === 0)
4388
- return this.change2Cancel(false);
4389
- this.change2Done();
4390
- };
4391
- modeChangeHandler = (mode) => {
4392
- mode === 'Watch' ? this.change2Add() : this.change2Cancel();
4393
- };
4394
4943
  }
4395
4944
 
4396
4945
  class Revoke {
4397
- container;
4398
- revokeIcon;
4399
- revokeItem;
4400
- measureController;
4401
4946
  constructor(measureController, container) {
4947
+ Object.defineProperty(this, "container", {
4948
+ enumerable: true,
4949
+ configurable: true,
4950
+ writable: true,
4951
+ value: void 0
4952
+ });
4953
+ Object.defineProperty(this, "revokeIcon", {
4954
+ enumerable: true,
4955
+ configurable: true,
4956
+ writable: true,
4957
+ value: void 0
4958
+ });
4959
+ Object.defineProperty(this, "revokeItem", {
4960
+ enumerable: true,
4961
+ configurable: true,
4962
+ writable: true,
4963
+ value: void 0
4964
+ });
4965
+ Object.defineProperty(this, "measureController", {
4966
+ enumerable: true,
4967
+ configurable: true,
4968
+ writable: true,
4969
+ value: void 0
4970
+ });
4971
+ Object.defineProperty(this, "onClick", {
4972
+ enumerable: true,
4973
+ configurable: true,
4974
+ writable: true,
4975
+ value: () => {
4976
+ this.measureController.revoke();
4977
+ }
4978
+ });
4979
+ Object.defineProperty(this, "onModeChange", {
4980
+ enumerable: true,
4981
+ configurable: true,
4982
+ writable: true,
4983
+ value: (mode) => {
4984
+ if (mode !== 'Edit') {
4985
+ this.revokeItem.classList.remove('enabled');
4986
+ return;
4987
+ }
4988
+ this.revokeItem.classList.add('enabled');
4989
+ }
4990
+ });
4991
+ Object.defineProperty(this, "handleRevoke", {
4992
+ enumerable: true,
4993
+ configurable: true,
4994
+ writable: true,
4995
+ value: () => {
4996
+ return () => { };
4997
+ }
4998
+ });
4402
4999
  this.measureController = measureController;
4403
5000
  this.container = container;
4404
5001
  const revokeIcon = this.container.querySelector('.fpm__revoke-icon');
@@ -4414,28 +5011,66 @@ class Revoke {
4414
5011
  this.revokeIcon.removeEventListener('click', this.onClick);
4415
5012
  this.measureController.hook.off('modeChange', this.onModeChange);
4416
5013
  }
4417
- onClick = () => {
4418
- this.measureController.revoke();
4419
- };
4420
- onModeChange = (mode) => {
4421
- if (mode !== 'Edit') {
4422
- this.revokeItem.classList.remove('enabled');
4423
- return;
4424
- }
4425
- this.revokeItem.classList.add('enabled');
4426
- };
4427
- handleRevoke = () => {
4428
- return () => { };
4429
- };
4430
5014
  }
4431
5015
 
4432
5016
  class UIController {
4433
- revoke;
4434
- container;
4435
- mainController;
4436
- disposers = [];
4437
- measureController;
4438
5017
  constructor(measureController, params) {
5018
+ Object.defineProperty(this, "revoke", {
5019
+ enumerable: true,
5020
+ configurable: true,
5021
+ writable: true,
5022
+ value: void 0
5023
+ });
5024
+ Object.defineProperty(this, "container", {
5025
+ enumerable: true,
5026
+ configurable: true,
5027
+ writable: true,
5028
+ value: void 0
5029
+ });
5030
+ Object.defineProperty(this, "mainController", {
5031
+ enumerable: true,
5032
+ configurable: true,
5033
+ writable: true,
5034
+ value: void 0
5035
+ });
5036
+ Object.defineProperty(this, "disposers", {
5037
+ enumerable: true,
5038
+ configurable: true,
5039
+ writable: true,
5040
+ value: []
5041
+ });
5042
+ Object.defineProperty(this, "measureController", {
5043
+ enumerable: true,
5044
+ configurable: true,
5045
+ writable: true,
5046
+ value: void 0
5047
+ });
5048
+ Object.defineProperty(this, "handleExit", {
5049
+ enumerable: true,
5050
+ configurable: true,
5051
+ writable: true,
5052
+ value: () => {
5053
+ const exitIcon = this.container.querySelector('.fpm__exit-icon');
5054
+ const exitItem = this.container.querySelector('.fpm__exit');
5055
+ if (!exitItem || !exitIcon)
5056
+ throw new Error('cannot find dom');
5057
+ Object.assign(exitItem.style, exitItemStyle);
5058
+ Object.assign(exitIcon === null || exitIcon === void 0 ? void 0 : exitIcon.style, exitIconStyle);
5059
+ const onMouseEnter = () => (exitItem.style.opacity = '1');
5060
+ const onMouseLeave = () => (exitItem.style.opacity = '0.7');
5061
+ const handleClick = () => {
5062
+ this.measureController.disable();
5063
+ };
5064
+ exitIcon.addEventListener('click', handleClick);
5065
+ exitIcon.addEventListener('mouseenter', onMouseEnter);
5066
+ exitIcon.addEventListener('mouseleave', onMouseLeave);
5067
+ return () => {
5068
+ exitIcon.removeEventListener('click', handleClick);
5069
+ exitIcon.removeEventListener('mouseenter', onMouseEnter);
5070
+ exitIcon.removeEventListener('mouseleave', onMouseLeave);
5071
+ };
5072
+ }
5073
+ });
4439
5074
  this.measureController = measureController;
4440
5075
  this.container = document.createElement('div');
4441
5076
  this.container.innerHTML = htmlString;
@@ -4445,8 +5080,8 @@ class UIController {
4445
5080
  const UIItems = this.container.querySelectorAll('.fpm__ui-item');
4446
5081
  const bgDom = this.container.querySelector('.fpm_ui-bg');
4447
5082
  const operatingSpaceDom = this.container.querySelector('.fpm_operating-space');
4448
- Object.assign(bgDom?.style, controllerBackgroundStyle);
4449
- Object.assign(operatingSpaceDom?.style, operatingSpaceStyle);
5083
+ Object.assign(bgDom === null || bgDom === void 0 ? void 0 : bgDom.style, controllerBackgroundStyle);
5084
+ Object.assign(operatingSpaceDom === null || operatingSpaceDom === void 0 ? void 0 : operatingSpaceDom.style, operatingSpaceStyle);
4450
5085
  Object.assign(this.container.style, uiWrapperStyle);
4451
5086
  UIItems.forEach((item) => Object.assign(item.style, buttonGroupStyle));
4452
5087
  textDoms.forEach((item) => Object.assign(item.style, textStyle));
@@ -4464,43 +5099,80 @@ class UIController {
4464
5099
  return this;
4465
5100
  }
4466
5101
  hide() {
5102
+ var _a, _b;
4467
5103
  this.container.style.opacity = '0';
4468
5104
  this.container.style.transform = 'translate(0, 10px)';
4469
- this.revoke?.dispose();
4470
- this.mainController?.dispose();
5105
+ (_a = this.revoke) === null || _a === void 0 ? void 0 : _a.dispose();
5106
+ (_b = this.mainController) === null || _b === void 0 ? void 0 : _b.dispose();
4471
5107
  this.disposers.forEach((disposer) => disposer());
4472
5108
  this.disposers = [];
4473
5109
  return this;
4474
5110
  }
4475
- handleExit = () => {
4476
- const exitIcon = this.container.querySelector('.fpm__exit-icon');
4477
- const exitItem = this.container.querySelector('.fpm__exit');
4478
- if (!exitItem || !exitIcon)
4479
- throw new Error('cannot find dom');
4480
- Object.assign(exitItem.style, exitItemStyle);
4481
- Object.assign(exitIcon?.style, exitIconStyle);
4482
- const onMouseEnter = () => (exitItem.style.opacity = '1');
4483
- const onMouseLeave = () => (exitItem.style.opacity = '0.7');
4484
- const handleClick = () => {
4485
- this.measureController.disable();
4486
- };
4487
- exitIcon.addEventListener('click', handleClick);
4488
- exitIcon.addEventListener('mouseenter', onMouseEnter);
4489
- exitIcon.addEventListener('mouseleave', onMouseLeave);
4490
- return () => {
4491
- exitIcon.removeEventListener('click', handleClick);
4492
- exitIcon.removeEventListener('mouseenter', onMouseEnter);
4493
- exitIcon.removeEventListener('mouseleave', onMouseLeave);
4494
- };
4495
- };
4496
5111
  }
4497
5112
 
4498
5113
  class GuideController {
4499
- measureController;
4500
- textDom = document.createElement('span');
4501
- container = document.createElement('div');
4502
- hasAnchor = false;
4503
5114
  constructor(measureController, params) {
5115
+ Object.defineProperty(this, "measureController", {
5116
+ enumerable: true,
5117
+ configurable: true,
5118
+ writable: true,
5119
+ value: void 0
5120
+ });
5121
+ Object.defineProperty(this, "textDom", {
5122
+ enumerable: true,
5123
+ configurable: true,
5124
+ writable: true,
5125
+ value: document.createElement('span')
5126
+ });
5127
+ Object.defineProperty(this, "container", {
5128
+ enumerable: true,
5129
+ configurable: true,
5130
+ writable: true,
5131
+ value: document.createElement('div')
5132
+ });
5133
+ Object.defineProperty(this, "hasAnchor", {
5134
+ enumerable: true,
5135
+ configurable: true,
5136
+ writable: true,
5137
+ value: false
5138
+ });
5139
+ Object.defineProperty(this, "onModelChange", {
5140
+ enumerable: true,
5141
+ configurable: true,
5142
+ writable: true,
5143
+ value: (mode) => {
5144
+ if (mode === 'Watch') {
5145
+ this.textDom.innerText = ``;
5146
+ return;
5147
+ }
5148
+ this.textDom.innerText = `请选择第一个测量点,Esc或单击鼠标右键可取消选择`;
5149
+ }
5150
+ });
5151
+ Object.defineProperty(this, "anchorChange", {
5152
+ enumerable: true,
5153
+ configurable: true,
5154
+ writable: true,
5155
+ value: (anchor) => {
5156
+ if (!this.hasAnchor && !!anchor) {
5157
+ this.hasAnchor = true;
5158
+ this.textDom.innerText = `选择下一个测量点,Esc或单击鼠标右键取消选择`;
5159
+ }
5160
+ else if (!anchor) {
5161
+ this.hasAnchor = false;
5162
+ this.textDom.innerText = `请选择第一个测量点,Esc或单击鼠标右键可取消选择`;
5163
+ }
5164
+ }
5165
+ });
5166
+ Object.defineProperty(this, "onEditedLineChange", {
5167
+ enumerable: true,
5168
+ configurable: true,
5169
+ writable: true,
5170
+ value: (lines) => {
5171
+ if (lines.length === 1) {
5172
+ this.textDom.innerText = `可以连续选择测量点,或点击下方“完成”结束测量(Esc取消,Command+S保存)`;
5173
+ }
5174
+ }
5175
+ });
4504
5176
  this.initDom();
4505
5177
  params.container.append(this.container);
4506
5178
  this.measureController = measureController;
@@ -4547,35 +5219,51 @@ class GuideController {
4547
5219
  textDom.innerText = `点击下方“添加”开始测距`;
4548
5220
  container.appendChild(textDom);
4549
5221
  }
4550
- onModelChange = (mode) => {
4551
- if (mode === 'Watch') {
4552
- this.textDom.innerText = ``;
4553
- return;
4554
- }
4555
- this.textDom.innerText = `请选择第一个测量点,Esc或单击鼠标右键可取消选择`;
4556
- };
4557
- anchorChange = (anchor) => {
4558
- if (!this.hasAnchor && !!anchor) {
4559
- this.hasAnchor = true;
4560
- this.textDom.innerText = `选择下一个测量点,Esc或单击鼠标右键取消选择`;
4561
- }
4562
- else if (!anchor) {
4563
- this.hasAnchor = false;
4564
- this.textDom.innerText = `请选择第一个测量点,Esc或单击鼠标右键可取消选择`;
4565
- }
4566
- };
4567
- onEditedLineChange = (lines) => {
4568
- if (lines.length === 1) {
4569
- this.textDom.innerText = `可以连续选择测量点,或点击下方“完成”结束测量(Esc取消,Command+S保存)`;
4570
- }
4571
- };
4572
5222
  }
4573
5223
 
4574
5224
  /** 快捷键控制器 */
4575
5225
  class ShortcutKeyController {
4576
- five;
4577
- measureController;
4578
5226
  constructor(measureController, five) {
5227
+ Object.defineProperty(this, "five", {
5228
+ enumerable: true,
5229
+ configurable: true,
5230
+ writable: true,
5231
+ value: void 0
5232
+ });
5233
+ Object.defineProperty(this, "measureController", {
5234
+ enumerable: true,
5235
+ configurable: true,
5236
+ writable: true,
5237
+ value: void 0
5238
+ });
5239
+ Object.defineProperty(this, "onKeyDown", {
5240
+ enumerable: true,
5241
+ configurable: true,
5242
+ writable: true,
5243
+ value: (e) => {
5244
+ // Command + S -> 保存 & 更改场景
5245
+ if (e.metaKey && e.code === 'KeyS') {
5246
+ this.measureController.save().changeMode('Watch');
5247
+ e.preventDefault();
5248
+ return;
5249
+ }
5250
+ // Escape -> 切换到观察模式 / 如果已经在观察模式,退出功能
5251
+ if (e.code === 'Escape')
5252
+ return this.escape();
5253
+ }
5254
+ });
5255
+ Object.defineProperty(this, "onMouseDown", {
5256
+ enumerable: true,
5257
+ configurable: true,
5258
+ writable: true,
5259
+ value: (e) => {
5260
+ // 鼠标右键取消
5261
+ if (e.button !== 2)
5262
+ return;
5263
+ e.preventDefault();
5264
+ this.escape();
5265
+ }
5266
+ });
4579
5267
  this.five = five;
4580
5268
  this.measureController = measureController;
4581
5269
  const fiveElement = this.five.getElement();
@@ -4596,50 +5284,138 @@ class ShortcutKeyController {
4596
5284
  return this.measureController.disable();
4597
5285
  return this.measureController.changeMode('Watch');
4598
5286
  }
4599
- onKeyDown = (e) => {
4600
- // Command + S -> 保存 & 更改场景
4601
- if (e.metaKey && e.code === 'KeyS') {
4602
- this.measureController.save().changeMode('Watch');
4603
- e.preventDefault();
4604
- return;
4605
- }
4606
- // Escape -> 切换到观察模式 / 如果已经在观察模式,退出功能
4607
- if (e.code === 'Escape')
4608
- return this.escape();
4609
- };
4610
- onMouseDown = (e) => {
4611
- // 鼠标右键取消
4612
- if (e.button !== 2)
4613
- return;
4614
- e.preventDefault();
4615
- this.escape();
4616
- };
4617
5287
  }
4618
5288
 
4619
5289
  class MeasureController {
4620
- hasOpen = false;
4621
- hook = new five.Subscribe();
4622
- five;
4623
- model;
4624
- group;
4625
- magnifier;
4626
- fiveHelper;
4627
- useUIController;
4628
- params;
4629
- useGuideController;
4630
- container = document.createElement('div');
4631
- shortcutKeyController;
4632
- controller = null;
4633
- controllerParams;
4634
- constructor(five, params) {
4635
- this.five = five;
5290
+ constructor(five$1, params) {
5291
+ Object.defineProperty(this, "hasOpen", {
5292
+ enumerable: true,
5293
+ configurable: true,
5294
+ writable: true,
5295
+ value: false
5296
+ });
5297
+ Object.defineProperty(this, "hook", {
5298
+ enumerable: true,
5299
+ configurable: true,
5300
+ writable: true,
5301
+ value: new five.Subscribe()
5302
+ });
5303
+ Object.defineProperty(this, "five", {
5304
+ enumerable: true,
5305
+ configurable: true,
5306
+ writable: true,
5307
+ value: void 0
5308
+ });
5309
+ Object.defineProperty(this, "model", {
5310
+ enumerable: true,
5311
+ configurable: true,
5312
+ writable: true,
5313
+ value: void 0
5314
+ });
5315
+ Object.defineProperty(this, "group", {
5316
+ enumerable: true,
5317
+ configurable: true,
5318
+ writable: true,
5319
+ value: void 0
5320
+ });
5321
+ Object.defineProperty(this, "magnifier", {
5322
+ enumerable: true,
5323
+ configurable: true,
5324
+ writable: true,
5325
+ value: void 0
5326
+ });
5327
+ Object.defineProperty(this, "fiveHelper", {
5328
+ enumerable: true,
5329
+ configurable: true,
5330
+ writable: true,
5331
+ value: void 0
5332
+ });
5333
+ Object.defineProperty(this, "useUIController", {
5334
+ enumerable: true,
5335
+ configurable: true,
5336
+ writable: true,
5337
+ value: void 0
5338
+ });
5339
+ Object.defineProperty(this, "params", {
5340
+ enumerable: true,
5341
+ configurable: true,
5342
+ writable: true,
5343
+ value: void 0
5344
+ });
5345
+ Object.defineProperty(this, "useGuideController", {
5346
+ enumerable: true,
5347
+ configurable: true,
5348
+ writable: true,
5349
+ value: void 0
5350
+ });
5351
+ Object.defineProperty(this, "container", {
5352
+ enumerable: true,
5353
+ configurable: true,
5354
+ writable: true,
5355
+ value: document.createElement('div')
5356
+ });
5357
+ Object.defineProperty(this, "shortcutKeyController", {
5358
+ enumerable: true,
5359
+ configurable: true,
5360
+ writable: true,
5361
+ value: void 0
5362
+ });
5363
+ Object.defineProperty(this, "controller", {
5364
+ enumerable: true,
5365
+ configurable: true,
5366
+ writable: true,
5367
+ value: null
5368
+ });
5369
+ Object.defineProperty(this, "controllerParams", {
5370
+ enumerable: true,
5371
+ configurable: true,
5372
+ writable: true,
5373
+ value: void 0
5374
+ });
5375
+ Object.defineProperty(this, "getCurrentMode", {
5376
+ enumerable: true,
5377
+ configurable: true,
5378
+ writable: true,
5379
+ value: () => {
5380
+ if (this.controller instanceof EditController)
5381
+ return 'Edit';
5382
+ if (this.controller instanceof WatchController)
5383
+ return 'Watch';
5384
+ return null;
5385
+ }
5386
+ });
5387
+ /** 变更场景
5388
+ * @description 如果从编辑场景改变到观看场景,不会自动保存,默认丢弃所有改动
5389
+ */
5390
+ Object.defineProperty(this, "changeMode", {
5391
+ enumerable: true,
5392
+ configurable: true,
5393
+ writable: true,
5394
+ value: (mode) => {
5395
+ var _a;
5396
+ if (!this.hasOpen)
5397
+ return;
5398
+ if (this.getCurrentMode() === mode)
5399
+ return;
5400
+ (_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
5401
+ const controllerMap = {
5402
+ Watch: WatchController,
5403
+ Edit: EditController,
5404
+ };
5405
+ if (!controllerMap[mode])
5406
+ throw new Error('不存在的 Mode');
5407
+ this.controller = new controllerMap[mode](this.controllerParams);
5408
+ this.hook.emit('modeChange', mode);
5409
+ }
5410
+ });
5411
+ this.five = five$1;
4636
5412
  this.params = params;
4637
5413
  this.model = new Model({ userDistanceItemCreator: this.params.userDistanceItemCreator });
4638
- this.fiveHelper = new FiveHelper(five);
5414
+ this.fiveHelper = new FiveHelper(five$1);
4639
5415
  // magnifier
4640
5416
  const magnifierSize = 190;
4641
5417
  const magnifierScale = 2;
4642
- this.magnifier = new Magnifier(five, { scale: magnifierScale, width: magnifierSize, height: magnifierSize });
5418
+ this.magnifier = new Magnifier(five$1, { scale: magnifierScale, width: magnifierSize, height: magnifierSize });
4643
5419
  // ==================== Group ====================
4644
5420
  this.group = new three.Group();
4645
5421
  this.group.name = 'plugin-measure-group';
@@ -4669,9 +5445,10 @@ class MeasureController {
4669
5445
  parent.append(this.container);
4670
5446
  }
4671
5447
  dispose() {
5448
+ var _a, _b;
4672
5449
  this.disable();
4673
- this.useUIController?.dispose();
4674
- this.magnifier?.dispose();
5450
+ (_a = this.useUIController) === null || _a === void 0 ? void 0 : _a.dispose();
5451
+ (_b = this.magnifier) === null || _b === void 0 ? void 0 : _b.dispose();
4675
5452
  this.five.needsRender = true;
4676
5453
  }
4677
5454
  /** 加载数据
@@ -4687,6 +5464,7 @@ class MeasureController {
4687
5464
  * @description 会隐藏当前 VR 内的点位展示
4688
5465
  */
4689
5466
  enable() {
5467
+ var _a, _b;
4690
5468
  if (this.hasOpen)
4691
5469
  return;
4692
5470
  this.hasOpen = true;
@@ -4694,8 +5472,8 @@ class MeasureController {
4694
5472
  // 隐藏点位和鼠标聚焦环
4695
5473
  this.five.helperVisible = false;
4696
5474
  this.controller = new WatchController(this.controllerParams);
4697
- this.useUIController?.show();
4698
- this.useGuideController?.show();
5475
+ (_a = this.useUIController) === null || _a === void 0 ? void 0 : _a.show();
5476
+ (_b = this.useGuideController) === null || _b === void 0 ? void 0 : _b.show();
4699
5477
  this.shortcutKeyController = new ShortcutKeyController(this, this.five);
4700
5478
  this.hook.emit('enable', true);
4701
5479
  }
@@ -4704,43 +5482,19 @@ class MeasureController {
4704
5482
  * @description 还原点位展示和默认鼠标 UI
4705
5483
  */
4706
5484
  disable() {
5485
+ var _a, _b, _c, _d;
4707
5486
  this.hasOpen = false;
4708
5487
  // 展示点位和鼠标聚焦环
4709
- this.controller?.dispose();
4710
- this.useUIController?.hide();
4711
- this.useGuideController?.hide();
4712
- this.shortcutKeyController?.dispose();
5488
+ (_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
5489
+ (_b = this.useUIController) === null || _b === void 0 ? void 0 : _b.hide();
5490
+ (_c = this.useGuideController) === null || _c === void 0 ? void 0 : _c.hide();
5491
+ (_d = this.shortcutKeyController) === null || _d === void 0 ? void 0 : _d.dispose();
4713
5492
  this.controller = null;
4714
5493
  this.five.helperVisible = true;
4715
5494
  this.five.scene.remove(this.group);
4716
5495
  this.five.needsRender = true;
4717
5496
  this.hook.emit('disable', true);
4718
5497
  }
4719
- getCurrentMode = () => {
4720
- if (this.controller instanceof EditController)
4721
- return 'Edit';
4722
- if (this.controller instanceof WatchController)
4723
- return 'Watch';
4724
- return null;
4725
- };
4726
- /** 变更场景
4727
- * @description 如果从编辑场景改变到观看场景,不会自动保存,默认丢弃所有改动
4728
- */
4729
- changeMode = (mode) => {
4730
- if (!this.hasOpen)
4731
- return;
4732
- if (this.getCurrentMode() === mode)
4733
- return;
4734
- this.controller?.dispose();
4735
- const controllerMap = {
4736
- Watch: WatchController,
4737
- Edit: EditController,
4738
- };
4739
- if (!controllerMap[mode])
4740
- throw new Error('不存在的 Mode');
4741
- this.controller = new controllerMap[mode](this.controllerParams);
4742
- this.hook.emit('modeChange', mode);
4743
- };
4744
5498
  /** 撤销编辑 */
4745
5499
  revoke() {
4746
5500
  if (!(this.controller instanceof EditController))