@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
@@ -4,17 +4,67 @@ import { creatLineMesh } from '../utils/line';
4
4
  import { Subscribe } from '@realsee/five';
5
5
  import { creatDistanceItem } from '../utils/distanceDom';
6
6
  export default class Line {
7
- id;
8
- selected = false;
9
- type = 'line';
10
- model;
11
- mesh;
12
- points;
13
- lightMesh;
14
- hook;
15
- distanceItem;
16
- polyline;
17
7
  constructor(point, anotherPoint, model) {
8
+ Object.defineProperty(this, "id", {
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true,
12
+ value: void 0
13
+ });
14
+ Object.defineProperty(this, "selected", {
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true,
18
+ value: false
19
+ });
20
+ Object.defineProperty(this, "type", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: 'line'
25
+ });
26
+ Object.defineProperty(this, "model", {
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true,
30
+ value: void 0
31
+ });
32
+ Object.defineProperty(this, "mesh", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: void 0
37
+ });
38
+ Object.defineProperty(this, "points", {
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true,
42
+ value: void 0
43
+ });
44
+ Object.defineProperty(this, "lightMesh", {
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true,
48
+ value: void 0
49
+ });
50
+ Object.defineProperty(this, "hook", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: void 0
55
+ });
56
+ Object.defineProperty(this, "distanceItem", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: void 0
61
+ });
62
+ Object.defineProperty(this, "polyline", {
63
+ enumerable: true,
64
+ configurable: true,
65
+ writable: true,
66
+ value: void 0
67
+ });
18
68
  this.id = uuid();
19
69
  this.model = model;
20
70
  if (point.id === anotherPoint.id)
@@ -2,11 +2,31 @@ import { Vector3 } from 'three';
2
2
  import uuid from '../../shared-utils/uuid';
3
3
  import removeArrayItem from '../../shared-utils/removeArrayItem';
4
4
  export default class Point {
5
- id;
6
- lines;
7
- position;
8
- type = 'point';
9
5
  constructor(position) {
6
+ Object.defineProperty(this, "id", {
7
+ enumerable: true,
8
+ configurable: true,
9
+ writable: true,
10
+ value: void 0
11
+ });
12
+ Object.defineProperty(this, "lines", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: void 0
17
+ });
18
+ Object.defineProperty(this, "position", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: void 0
23
+ });
24
+ Object.defineProperty(this, "type", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: 'point'
29
+ });
10
30
  this.id = uuid();
11
31
  this.lines = [];
12
32
  this.position = new Vector3();
@@ -1,8 +1,25 @@
1
1
  import uuid from '../../shared-utils/uuid';
2
2
  export class Polyline {
3
- id = uuid();
4
- points = [];
5
- lines = [];
3
+ constructor() {
4
+ Object.defineProperty(this, "id", {
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true,
8
+ value: uuid()
9
+ });
10
+ Object.defineProperty(this, "points", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: []
15
+ });
16
+ Object.defineProperty(this, "lines", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: []
21
+ });
22
+ }
6
23
  push(line) {
7
24
  const next = this.getNext(line);
8
25
  if (!next)
@@ -2,16 +2,67 @@ import deleteSvg from './_Assets/delete.svg';
2
2
  import deleteBg from './_Assets/delete_bg.png';
3
3
  import deleteHoverBg from './_Assets/delete_hover_bg.png';
4
4
  export default class DeleteDom {
5
- visible = false;
6
- five;
7
- lines = [];
8
- points = [];
9
- onClick;
10
- content = document.createElement('div');
11
- container = document.createElement('div');
12
5
  constructor(five, opts) {
6
+ Object.defineProperty(this, "visible", {
7
+ enumerable: true,
8
+ configurable: true,
9
+ writable: true,
10
+ value: false
11
+ });
12
+ Object.defineProperty(this, "five", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: void 0
17
+ });
18
+ Object.defineProperty(this, "lines", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: []
23
+ });
24
+ Object.defineProperty(this, "points", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: []
29
+ });
30
+ Object.defineProperty(this, "onClick", {
31
+ enumerable: true,
32
+ configurable: true,
33
+ writable: true,
34
+ value: void 0
35
+ });
36
+ Object.defineProperty(this, "content", {
37
+ enumerable: true,
38
+ configurable: true,
39
+ writable: true,
40
+ value: document.createElement('div')
41
+ });
42
+ Object.defineProperty(this, "container", {
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true,
46
+ value: document.createElement('div')
47
+ });
48
+ Object.defineProperty(this, "onMouseEnter", {
49
+ enumerable: true,
50
+ configurable: true,
51
+ writable: true,
52
+ value: () => {
53
+ this.content.style.backgroundImage = `url(${deleteHoverBg})`;
54
+ }
55
+ });
56
+ Object.defineProperty(this, "onMouseLeave", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: () => {
61
+ this.content.style.backgroundImage = `url(${deleteBg})`;
62
+ }
63
+ });
13
64
  this.five = five;
14
- this.onClick = opts?.onClick || (() => void 0);
65
+ this.onClick = (opts === null || opts === void 0 ? void 0 : opts.onClick) || (() => void 0);
15
66
  // container
16
67
  this.container.classList.add('fpm__delete');
17
68
  this.container.style.opacity = '0';
@@ -99,10 +150,4 @@ export default class DeleteDom {
99
150
  this.container.style.pointerEvents = 'auto';
100
151
  return this;
101
152
  }
102
- onMouseEnter = () => {
103
- this.content.style.backgroundImage = `url(${deleteHoverBg})`;
104
- };
105
- onMouseLeave = () => {
106
- this.content.style.backgroundImage = `url(${deleteBg})`;
107
- };
108
153
  }
@@ -1,8 +1,29 @@
1
1
  import { Vector3 } from 'three';
2
2
  export default class FiveHelper {
3
- edges = [];
4
- five;
5
3
  constructor(five) {
4
+ Object.defineProperty(this, "edges", {
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true,
8
+ value: []
9
+ });
10
+ Object.defineProperty(this, "five", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: void 0
15
+ });
16
+ /** 模型加载后获取折线 */
17
+ Object.defineProperty(this, "onModelLoaded", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: () => {
22
+ if (!this.five.model)
23
+ return;
24
+ this.edges = this.five.model.getEdges();
25
+ }
26
+ });
6
27
  this.five = five;
7
28
  this.five.model.loaded ? this.onModelLoaded() : this.five.on('modelLoaded', this.onModelLoaded);
8
29
  }
@@ -24,10 +45,4 @@ export default class FiveHelper {
24
45
  return null;
25
46
  return closestPoint || null;
26
47
  }
27
- /** 模型加载后获取折线 */
28
- onModelLoaded = () => {
29
- if (!this.five.model)
30
- return;
31
- this.edges = this.five.model.getEdges();
32
- };
33
48
  }
@@ -1,9 +1,66 @@
1
1
  export class GuideController {
2
- measureController;
3
- textDom = document.createElement('span');
4
- container = document.createElement('div');
5
- hasAnchor = false;
6
2
  constructor(measureController, params) {
3
+ Object.defineProperty(this, "measureController", {
4
+ enumerable: true,
5
+ configurable: true,
6
+ writable: true,
7
+ value: void 0
8
+ });
9
+ Object.defineProperty(this, "textDom", {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: document.createElement('span')
14
+ });
15
+ Object.defineProperty(this, "container", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: document.createElement('div')
20
+ });
21
+ Object.defineProperty(this, "hasAnchor", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: false
26
+ });
27
+ Object.defineProperty(this, "onModelChange", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: (mode) => {
32
+ if (mode === 'Watch') {
33
+ this.textDom.innerText = ``;
34
+ return;
35
+ }
36
+ this.textDom.innerText = `请选择第一个测量点,Esc或单击鼠标右键可取消选择`;
37
+ }
38
+ });
39
+ Object.defineProperty(this, "anchorChange", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: (anchor) => {
44
+ if (!this.hasAnchor && !!anchor) {
45
+ this.hasAnchor = true;
46
+ this.textDom.innerText = `选择下一个测量点,Esc或单击鼠标右键取消选择`;
47
+ }
48
+ else if (!anchor) {
49
+ this.hasAnchor = false;
50
+ this.textDom.innerText = `请选择第一个测量点,Esc或单击鼠标右键可取消选择`;
51
+ }
52
+ }
53
+ });
54
+ Object.defineProperty(this, "onEditedLineChange", {
55
+ enumerable: true,
56
+ configurable: true,
57
+ writable: true,
58
+ value: (lines) => {
59
+ if (lines.length === 1) {
60
+ this.textDom.innerText = `可以连续选择测量点,或点击下方“完成”结束测量(Esc取消,Command+S保存)`;
61
+ }
62
+ }
63
+ });
7
64
  this.initDom();
8
65
  params.container.append(this.container);
9
66
  this.measureController = measureController;
@@ -50,26 +107,4 @@ export class GuideController {
50
107
  textDom.innerText = `点击下方“添加”开始测距`;
51
108
  container.appendChild(textDom);
52
109
  }
53
- onModelChange = (mode) => {
54
- if (mode === 'Watch') {
55
- this.textDom.innerText = ``;
56
- return;
57
- }
58
- this.textDom.innerText = `请选择第一个测量点,Esc或单击鼠标右键可取消选择`;
59
- };
60
- anchorChange = (anchor) => {
61
- if (!this.hasAnchor && !!anchor) {
62
- this.hasAnchor = true;
63
- this.textDom.innerText = `选择下一个测量点,Esc或单击鼠标右键取消选择`;
64
- }
65
- else if (!anchor) {
66
- this.hasAnchor = false;
67
- this.textDom.innerText = `请选择第一个测量点,Esc或单击鼠标右键可取消选择`;
68
- }
69
- };
70
- onEditedLineChange = (lines) => {
71
- if (lines.length === 1) {
72
- this.textDom.innerText = `可以连续选择测量点,或点击下方“完成”结束测量(Esc取消,Command+S保存)`;
73
- }
74
- };
75
110
  }
@@ -6,17 +6,67 @@ function exchange(array, index1, index2) {
6
6
  array[index2] = value;
7
7
  }
8
8
  export default class Magnifier {
9
- five;
10
- scale;
11
- width;
12
- height;
13
- pixelRatio;
14
- originWidth;
15
- originHeight;
16
- context;
17
- canvas = document.createElement('canvas');
18
- container;
19
9
  constructor(five, options) {
10
+ Object.defineProperty(this, "five", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: void 0
15
+ });
16
+ Object.defineProperty(this, "scale", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: void 0
21
+ });
22
+ Object.defineProperty(this, "width", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: void 0
27
+ });
28
+ Object.defineProperty(this, "height", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: void 0
33
+ });
34
+ Object.defineProperty(this, "pixelRatio", {
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true,
38
+ value: void 0
39
+ });
40
+ Object.defineProperty(this, "originWidth", {
41
+ enumerable: true,
42
+ configurable: true,
43
+ writable: true,
44
+ value: void 0
45
+ });
46
+ Object.defineProperty(this, "originHeight", {
47
+ enumerable: true,
48
+ configurable: true,
49
+ writable: true,
50
+ value: void 0
51
+ });
52
+ Object.defineProperty(this, "context", {
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true,
56
+ value: void 0
57
+ });
58
+ Object.defineProperty(this, "canvas", {
59
+ enumerable: true,
60
+ configurable: true,
61
+ writable: true,
62
+ value: document.createElement('canvas')
63
+ });
64
+ Object.defineProperty(this, "container", {
65
+ enumerable: true,
66
+ configurable: true,
67
+ writable: true,
68
+ value: void 0
69
+ });
20
70
  if (!five.renderer)
21
71
  throw new Error('Five Render 未初始化');
22
72
  this.five = five;
@@ -3,11 +3,84 @@ import { mainIconStyle as mainIconStyle, mainItemStyle as mainItemStyle } from '
3
3
  import { tweenProgress } from '../../../shared-utils/animationFrame/BetterTween';
4
4
  import { MAIN_NORMAL_PATH, MAIN_DONE_PATH, MAIN_MOUSE_ENTER_FILL, MAIN_MOUSE_LEAVE_FILL } from './HTML';
5
5
  export class MainBtnController {
6
- container;
7
- measureController;
8
- mainIconMaskTween;
9
- mainElement;
10
6
  constructor(measureController, container) {
7
+ Object.defineProperty(this, "container", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: void 0
12
+ });
13
+ Object.defineProperty(this, "measureController", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: void 0
18
+ });
19
+ Object.defineProperty(this, "mainIconMaskTween", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: void 0
24
+ });
25
+ Object.defineProperty(this, "mainElement", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: void 0
30
+ });
31
+ /* 鼠标移入时变成蓝色 */
32
+ Object.defineProperty(this, "onMouseEnter", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: () => {
37
+ const { mainItem, pathDom } = this.mainElement;
38
+ mainItem.style.opacity = '1';
39
+ pathDom.setAttribute('fill', MAIN_MOUSE_ENTER_FILL);
40
+ }
41
+ });
42
+ /* 鼠标移出时变成灰色 */
43
+ Object.defineProperty(this, "onMouseLeave", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: () => {
48
+ const { mainItem, pathDom } = this.mainElement;
49
+ mainItem.style.opacity = '0.7';
50
+ pathDom.setAttribute('fill', MAIN_MOUSE_LEAVE_FILL);
51
+ }
52
+ });
53
+ Object.defineProperty(this, "onClick", {
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true,
57
+ value: () => {
58
+ const mode = this.measureController.getCurrentMode();
59
+ mode === 'Watch' ? this.measureController.changeMode('Edit') : this.measureController.save().changeMode('Watch');
60
+ }
61
+ });
62
+ Object.defineProperty(this, "editedLineChangeHandler", {
63
+ enumerable: true,
64
+ configurable: true,
65
+ writable: true,
66
+ value: (lines) => {
67
+ // 线的数量大于 1 时,没有状态的变化
68
+ if (lines.length > 1)
69
+ return;
70
+ // 因为撤销导致的状态变更 -> 取消
71
+ if (lines.length === 0)
72
+ return this.change2Cancel(false);
73
+ this.change2Done();
74
+ }
75
+ });
76
+ Object.defineProperty(this, "modeChangeHandler", {
77
+ enumerable: true,
78
+ configurable: true,
79
+ writable: true,
80
+ value: (mode) => {
81
+ mode === 'Watch' ? this.change2Add() : this.change2Cancel();
82
+ }
83
+ });
11
84
  this.measureController = measureController;
12
85
  this.container = container;
13
86
  this.mainElement = this.getMainElement();
@@ -30,8 +103,8 @@ export class MainBtnController {
30
103
  const mainTextDom = this.container.querySelector('.fpm__main-text');
31
104
  const mainItem = this.container.querySelector('.fpm__main');
32
105
  const mainIcon = this.container.querySelector('.fpm__main-icon');
33
- const pathDom = mainItem?.querySelector('.fpm__main-icon-path');
34
- const maskWhiteRect = mainIcon?.querySelector('#fpm__main-icon-mask-white');
106
+ const pathDom = mainItem === null || mainItem === void 0 ? void 0 : mainItem.querySelector('.fpm__main-icon-path');
107
+ const maskWhiteRect = mainIcon === null || mainIcon === void 0 ? void 0 : mainIcon.querySelector('#fpm__main-icon-mask-white');
35
108
  if (!mainItem || !mainTextDom || !mainIcon || !pathDom || !maskWhiteRect)
36
109
  throw new Error('cannot find dom');
37
110
  return { mainTextDom, mainItem, mainIcon, pathDom, maskWhiteRect };
@@ -42,7 +115,7 @@ export class MainBtnController {
42
115
  mainIcon.style.transition = mainTextDom.innerText === '完成' ? 'none' : 'transform 300ms ease-in-out';
43
116
  mainIcon.style.transform = 'rotate(0deg)';
44
117
  mainTextDom.innerText = '添加';
45
- pathDom?.setAttribute('d', MAIN_NORMAL_PATH);
118
+ pathDom === null || pathDom === void 0 ? void 0 : pathDom.setAttribute('d', MAIN_NORMAL_PATH);
46
119
  }
47
120
  change2Cancel(withAnime = true) {
48
121
  const { mainIcon, mainTextDom, pathDom } = this.mainElement;
@@ -54,6 +127,7 @@ export class MainBtnController {
54
127
  this.measureController.hook.on('editedLineChange', this.editedLineChangeHandler);
55
128
  }
56
129
  change2Done() {
130
+ var _a;
57
131
  const { mainTextDom, mainIcon, pathDom, maskWhiteRect } = this.getMainElement();
58
132
  if (mainTextDom.innerText === '完成')
59
133
  return;
@@ -62,41 +136,13 @@ export class MainBtnController {
62
136
  mainTextDom.innerText = '完成';
63
137
  pathDom.setAttribute('d', MAIN_DONE_PATH);
64
138
  pathDom.setAttribute('mask', `url(#fpm__main-icon-mask)`);
65
- this.mainIconMaskTween?.dispose();
139
+ (_a = this.mainIconMaskTween) === null || _a === void 0 ? void 0 : _a.dispose();
66
140
  this.mainIconMaskTween = tweenProgress()
67
141
  .easing(TWEEN.Easing.Quartic.InOut)
68
142
  .onUpdate(({ progress }) => {
69
143
  maskWhiteRect.setAttribute('width', (progress * 30).toString());
70
144
  })
71
- .onComplete(() => this.mainIconMaskTween?.dispose())
145
+ .onComplete(() => { var _a; return (_a = this.mainIconMaskTween) === null || _a === void 0 ? void 0 : _a.dispose(); })
72
146
  .play();
73
147
  }
74
- /* 鼠标移入时变成蓝色 */
75
- onMouseEnter = () => {
76
- const { mainItem, pathDom } = this.mainElement;
77
- mainItem.style.opacity = '1';
78
- pathDom.setAttribute('fill', MAIN_MOUSE_ENTER_FILL);
79
- };
80
- /* 鼠标移出时变成灰色 */
81
- onMouseLeave = () => {
82
- const { mainItem, pathDom } = this.mainElement;
83
- mainItem.style.opacity = '0.7';
84
- pathDom.setAttribute('fill', MAIN_MOUSE_LEAVE_FILL);
85
- };
86
- onClick = () => {
87
- const mode = this.measureController.getCurrentMode();
88
- mode === 'Watch' ? this.measureController.changeMode('Edit') : this.measureController.save().changeMode('Watch');
89
- };
90
- editedLineChangeHandler = (lines) => {
91
- // 线的数量大于 1 时,没有状态的变化
92
- if (lines.length > 1)
93
- return;
94
- // 因为撤销导致的状态变更 -> 取消
95
- if (lines.length === 0)
96
- return this.change2Cancel(false);
97
- this.change2Done();
98
- };
99
- modeChangeHandler = (mode) => {
100
- mode === 'Watch' ? this.change2Add() : this.change2Cancel();
101
- };
102
148
  }
@@ -1,9 +1,57 @@
1
1
  export default class Revoke {
2
- container;
3
- revokeIcon;
4
- revokeItem;
5
- measureController;
6
2
  constructor(measureController, container) {
3
+ Object.defineProperty(this, "container", {
4
+ enumerable: true,
5
+ configurable: true,
6
+ writable: true,
7
+ value: void 0
8
+ });
9
+ Object.defineProperty(this, "revokeIcon", {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: void 0
14
+ });
15
+ Object.defineProperty(this, "revokeItem", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: void 0
20
+ });
21
+ Object.defineProperty(this, "measureController", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: void 0
26
+ });
27
+ Object.defineProperty(this, "onClick", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: () => {
32
+ this.measureController.revoke();
33
+ }
34
+ });
35
+ Object.defineProperty(this, "onModeChange", {
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true,
39
+ value: (mode) => {
40
+ if (mode !== 'Edit') {
41
+ this.revokeItem.classList.remove('enabled');
42
+ return;
43
+ }
44
+ this.revokeItem.classList.add('enabled');
45
+ }
46
+ });
47
+ Object.defineProperty(this, "handleRevoke", {
48
+ enumerable: true,
49
+ configurable: true,
50
+ writable: true,
51
+ value: () => {
52
+ return () => { };
53
+ }
54
+ });
7
55
  this.measureController = measureController;
8
56
  this.container = container;
9
57
  const revokeIcon = this.container.querySelector('.fpm__revoke-icon');
@@ -19,17 +67,4 @@ export default class Revoke {
19
67
  this.revokeIcon.removeEventListener('click', this.onClick);
20
68
  this.measureController.hook.off('modeChange', this.onModeChange);
21
69
  }
22
- onClick = () => {
23
- this.measureController.revoke();
24
- };
25
- onModeChange = (mode) => {
26
- if (mode !== 'Edit') {
27
- this.revokeItem.classList.remove('enabled');
28
- return;
29
- }
30
- this.revokeItem.classList.add('enabled');
31
- };
32
- handleRevoke = () => {
33
- return () => { };
34
- };
35
70
  }