@realsee/dnalogel 0.1.5 → 0.1.7-alpha.4

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 (151) hide show
  1. package/components/GLTFView/index.d.ts +104 -0
  2. package/components/GLTFView/index.js +181 -0
  3. package/data/81zxMaeVKLQU93OZMG.d.ts +49 -0
  4. package/data/81zxMaeVKLQU93OZMG.js +633 -0
  5. package/data/PrXel3aqGbp34JQn.js +139 -1
  6. package/data/vLykj3NWrllMrG06.js +335 -71
  7. package/libs/gltf-viewer/Subscribe.d.ts +76 -0
  8. package/libs/gltf-viewer/Subscribe.js +231 -0
  9. package/libs/gltf-viewer/coordsMoveByOffset.d.ts +13 -0
  10. package/libs/gltf-viewer/coordsMoveByOffset.js +22 -0
  11. package/libs/gltf-viewer/coordsToDirection.d.ts +5 -0
  12. package/{components/PBRView/index.js → libs/gltf-viewer/coordsToDirection.js} +14 -18
  13. package/libs/gltf-viewer/formatRad.d.ts +1 -0
  14. package/libs/gltf-viewer/formatRad.js +13 -0
  15. package/libs/gltf-viewer/getFrameTime.d.ts +1 -0
  16. package/libs/gltf-viewer/getFrameTime.js +28 -0
  17. package/libs/gltf-viewer/index.d.ts +69 -0
  18. package/libs/gltf-viewer/index.js +744 -0
  19. package/libs/gltf-viewer/mouseWheel.d.ts +2 -0
  20. package/libs/gltf-viewer/mouseWheel.js +59 -0
  21. package/libs/gltf-viewer/requestAnimationFrame.d.ts +1 -0
  22. package/libs/gltf-viewer/requestAnimationFrame.js +18 -0
  23. package/libs/gltf-viewer/requestAnimationFrameInterval.d.ts +1 -0
  24. package/libs/gltf-viewer/requestAnimationFrameInterval.js +31 -0
  25. package/libs/gltf-viewer/uuid.d.ts +4 -0
  26. package/libs/gltf-viewer/uuid.js +28 -0
  27. package/package.json +5 -4
  28. package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +6 -2
  29. package/plugins/ModelEntryDoorGuidePlugin/index.js +22 -14
  30. package/plugins/ModelRoomLabelPlugin/Controller.js +1 -0
  31. package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +5 -5
  32. package/plugins/ModelRoomLabelPlugin/index.d.ts +4 -0
  33. package/plugins/ModelRoomLabelPlugin/index.js +7 -2
  34. package/plugins/PanoMaskSelectorPlugin/createBox.js +3 -0
  35. package/plugins/PanoMaskSelectorPlugin/index.js +3 -1
  36. package/plugins/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
  37. package/plugins/PanoMeasurePlugin/Controller/BaseController.js +103 -0
  38. package/plugins/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
  39. package/plugins/PanoMeasurePlugin/Controller/EditController.js +341 -0
  40. package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
  41. package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.js +69 -0
  42. package/plugins/PanoMeasurePlugin/Controller/WatchController.d.ts +25 -0
  43. package/plugins/PanoMeasurePlugin/Controller/WatchController.js +371 -0
  44. package/plugins/PanoMeasurePlugin/Controller/index.d.ts +61 -0
  45. package/plugins/PanoMeasurePlugin/Controller/index.js +230 -0
  46. package/plugins/PanoMeasurePlugin/Model/index.d.ts +38 -0
  47. package/plugins/PanoMeasurePlugin/Model/index.js +235 -0
  48. package/plugins/PanoMeasurePlugin/Model/line.d.ts +30 -0
  49. package/plugins/PanoMeasurePlugin/Model/line.js +121 -0
  50. package/plugins/PanoMeasurePlugin/Model/point.d.ts +16 -0
  51. package/plugins/PanoMeasurePlugin/Model/point.js +68 -0
  52. package/plugins/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
  53. package/plugins/PanoMeasurePlugin/Model/polyline.js +109 -0
  54. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
  55. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -0
  56. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
  57. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +11 -0
  58. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
  59. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +11 -0
  60. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +22 -0
  61. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.js +182 -0
  62. package/plugins/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
  63. package/plugins/PanoMeasurePlugin/Modules/FiveHelper.js +66 -0
  64. package/plugins/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
  65. package/plugins/PanoMeasurePlugin/Modules/GuideController.js +107 -0
  66. package/plugins/PanoMeasurePlugin/Modules/Magnifier.d.ts +24 -0
  67. package/plugins/PanoMeasurePlugin/Modules/Magnifier.js +139 -0
  68. package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +6 -0
  69. package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.js +26 -0
  70. package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +18 -0
  71. package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +169 -0
  72. package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +12 -0
  73. package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +59 -0
  74. package/plugins/PanoMeasurePlugin/Modules/UIController/index.d.ts +16 -0
  75. package/plugins/PanoMeasurePlugin/Modules/UIController/index.js +123 -0
  76. package/plugins/PanoMeasurePlugin/Modules/UIController/style.d.ts +17 -0
  77. package/plugins/PanoMeasurePlugin/Modules/UIController/style.js +103 -0
  78. package/plugins/PanoMeasurePlugin/index.d.ts +7 -0
  79. package/plugins/PanoMeasurePlugin/index.js +20 -0
  80. package/plugins/PanoMeasurePlugin/typings/data.d.ts +28 -0
  81. package/plugins/PanoMeasurePlugin/typings/data.js +7 -0
  82. package/plugins/PanoMeasurePlugin/typings/event.type.d.ts +28 -0
  83. package/plugins/PanoMeasurePlugin/typings/event.type.js +7 -0
  84. package/plugins/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
  85. package/plugins/PanoMeasurePlugin/typings/utils.type.js +7 -0
  86. package/plugins/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
  87. package/plugins/PanoMeasurePlugin/utils/clearGroup.js +16 -0
  88. package/plugins/PanoMeasurePlugin/utils/constants.d.ts +4 -0
  89. package/plugins/PanoMeasurePlugin/utils/constants.js +47 -0
  90. package/plugins/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
  91. package/plugins/PanoMeasurePlugin/utils/distanceDom.js +147 -0
  92. package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
  93. package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.js +37 -0
  94. package/plugins/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
  95. package/plugins/PanoMeasurePlugin/utils/findClosestPoint.js +49 -0
  96. package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
  97. package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.js +20 -0
  98. package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
  99. package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.js +33 -0
  100. package/plugins/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
  101. package/plugins/PanoMeasurePlugin/utils/ironbox.js +14 -0
  102. package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
  103. package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.js +16 -0
  104. package/plugins/PanoMeasurePlugin/utils/line.d.ts +17 -0
  105. package/plugins/PanoMeasurePlugin/utils/line.js +61 -0
  106. package/plugins/PanoMeasurePlugin/utils/math.d.ts +17 -0
  107. package/plugins/PanoMeasurePlugin/utils/math.js +57 -0
  108. package/plugins/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -0
  109. package/plugins/PanoMeasurePlugin/utils/mouseGroup.js +42 -0
  110. package/plugins/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
  111. package/plugins/PanoMeasurePlugin/utils/ndc2Screen.js +16 -0
  112. package/plugins/PanoRulerPlugin/index.d.ts +4 -0
  113. package/plugins/PanoRulerPlugin/index.js +6 -1
  114. package/plugins/PanoTVVideoPlugin/index.d.ts +2 -0
  115. package/plugins/PanoTVVideoPlugin/index.js +20 -14
  116. package/plugins/floorplan/ModelFloorplanPlugin/Controller.d.ts +5 -2
  117. package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +22 -11
  118. package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +4 -4
  119. package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +5 -5
  120. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +2 -2
  121. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.d.ts +11 -0
  122. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.js +174 -0
  123. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.d.ts +8 -0
  124. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.js +179 -0
  125. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.d.ts +2 -0
  126. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +14 -2
  127. package/plugins/floorplan/ModelFloorplanPlugin/components/index.d.ts +3 -0
  128. package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +1 -1
  129. package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.d.ts +2 -0
  130. package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.js +7 -0
  131. package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +1 -1
  132. package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +1 -1
  133. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +1 -0
  134. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +4 -4
  135. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +2 -2
  136. package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +3 -3
  137. package/plugins/floorplan/index.d.ts +4 -0
  138. package/plugins/floorplan/index.js +13 -0
  139. package/plugins/floorplan/typings/floorplanData.d.ts +2 -0
  140. package/plugins/floorplan/typings/floorplanServerData.d.ts +2 -0
  141. package/plugins/floorplan/utils/formatData.js +2 -1
  142. package/shared-utils/changeModelCanvasOpacity.d.ts +2 -0
  143. package/shared-utils/{changeModelCanvansOpacity.js → changeModelCanvasOpacity.js} +2 -2
  144. package/shared-utils/removeArrayItem.d.ts +7 -0
  145. package/shared-utils/removeArrayItem.js +22 -0
  146. package/shared-utils/three/loadTexture.d.ts +2 -2
  147. package/shared-utils/three/loadTexture.js +21 -2
  148. package/typedoc/libs.d.ts +1 -0
  149. package/typedoc/libs.js +7 -0
  150. package/components/PBRView/index.d.ts +0 -14
  151. package/shared-utils/changeModelCanvansOpacity.d.ts +0 -2
@@ -0,0 +1,341 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.reflect.construct.js");
4
+
5
+ require("core-js/modules/es.object.define-property.js");
6
+
7
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
8
+
9
+ Object.defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+ exports["default"] = void 0;
13
+
14
+ require("core-js/modules/es.array.map.js");
15
+
16
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
+
18
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
+
20
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
21
+
22
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
23
+
24
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
25
+
26
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
27
+
28
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
29
+
30
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
31
+
32
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
33
+
34
+ var _hammerjs = _interopRequireDefault(require("hammerjs"));
35
+
36
+ var _Model = require("../Model");
37
+
38
+ var _line = _interopRequireDefault(require("../Model/line"));
39
+
40
+ var _point = _interopRequireDefault(require("../Model/point"));
41
+
42
+ var _throttle = _interopRequireDefault(require("../../../shared-utils/throttle"));
43
+
44
+ var _BaseController2 = _interopRequireDefault(require("./BaseController"));
45
+
46
+ var _getIntersectionFromEvent = require("../utils/getIntersectionFromEvent");
47
+
48
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
49
+
50
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
51
+
52
+ var EditController = /*#__PURE__*/function (_BaseController) {
53
+ (0, _inherits2["default"])(EditController, _BaseController);
54
+
55
+ var _super = _createSuper(EditController);
56
+
57
+ /** 上一个端点位置 */
58
+
59
+ /** 根据 intersection 更新放大镜和吸附点 */
60
+ function EditController(params) {
61
+ var _this$fiveElement;
62
+
63
+ var _this;
64
+
65
+ (0, _classCallCheck2["default"])(this, EditController);
66
+ _this = _super.call(this, params); // ==================== 虚线 ====================
67
+
68
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "type", 'edit');
69
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "model", new _Model.Model({
70
+ userDistanceItemCreator: _this.userDistanceItemCreator
71
+ }));
72
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "hasAppendDashed", false);
73
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "hasAppendMouseGroup", false);
74
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "lastPoint", null);
75
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onIntersectionUpdate", (0, _throttle["default"])(function (intersection, mesh) {
76
+ var _this$pressPoint;
77
+
78
+ if (_this.hasAppendMouseGroup === false) {
79
+ _this.group.add(_this.mouseGroup);
80
+
81
+ _this.magnifier.appendTo(_this.container);
82
+
83
+ _this.hasAppendMouseGroup = true;
84
+ }
85
+
86
+ var position = _this.updateMouseGroup(intersection, mesh).position;
87
+
88
+ (_this$pressPoint = _this.pressPoint) === null || _this$pressPoint === void 0 ? void 0 : _this$pressPoint.position.copy(position);
89
+
90
+ _this.updateDashed();
91
+
92
+ requestAnimationFrame(function () {
93
+ return _this.magnifier.updateWithPoint(_this.mouseGroup.position);
94
+ });
95
+ _this.five.needsRender = true;
96
+ }, 20));
97
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "revoke", function () {
98
+ // ============ revoke points ============
99
+ // 如果当前没有虚线,只有起始点,需要删除起始点,重置起始状态。并删除虚线实例
100
+ if (_this.model.lines.length === 0 && _this.lastPoint) {
101
+ _this.lastPoint = null;
102
+ _this.hasAppendDashed = false;
103
+
104
+ _this.dashed.distanceItem.remove();
105
+
106
+ _this.group.remove(_this.dashed.mesh);
107
+
108
+ _this.hook.emit('anchorChange', null);
109
+
110
+ _this.five.needsRender = true;
111
+ return;
112
+ }
113
+
114
+ if (_this.model.lines.length === 0 && !_this.lastPoint) return;
115
+ if (!_this.lastPoint) return;
116
+ var revokedLine = _this.model.lines[_this.model.lines.length - 1];
117
+ var lastPoint = revokedLine.findAnotherPoint(_this.lastPoint);
118
+ if (!lastPoint) return;
119
+ _this.lastPoint = lastPoint;
120
+
121
+ _this.hook.emit('anchorChange', lastPoint.position); // ============ revoke lines ============
122
+
123
+
124
+ _this.group.remove(revokedLine.mesh);
125
+
126
+ _this.model.removeLine(revokedLine); // ============ revoke mouse group ============
127
+
128
+
129
+ _this.hasAppendMouseGroup = false;
130
+
131
+ _this.mouseGroup.position.copy(_this.lastPoint.position);
132
+
133
+ _this.group.remove(_this.mouseGroup); // ============ revoke lineDistance ============
134
+
135
+
136
+ revokedLine.distanceItem.remove(); // ============ revoke dashed ============
137
+
138
+ _this.updateDashed(); // ============ revoke magnifier ============
139
+
140
+
141
+ _this.magnifier.dispose();
142
+
143
+ _this.five.needsRender = true;
144
+ });
145
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onMouseLeave", function () {
146
+ _this.magnifier.dispose();
147
+
148
+ _this.group.remove(_this.mouseGroup);
149
+
150
+ _this.hasAppendMouseGroup = false;
151
+
152
+ if (_this.lastPoint) {
153
+ _this.mouseGroup.position.copy(_this.lastPoint.position);
154
+
155
+ _this.updateDashed();
156
+ }
157
+ });
158
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onLineChanged", function () {
159
+ _this.hook.emit('editedLineChange', _this.model.lines.map(function (line) {
160
+ return line.toCompletelyJson();
161
+ }));
162
+ });
163
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPress", function (e) {
164
+ var _getIntersectionFromE = (0, _getIntersectionFromEvent.getIntersectionFromEvent)(_this.five, e),
165
+ _getIntersectionFromE2 = (0, _slicedToArray2["default"])(_getIntersectionFromE, 1),
166
+ intersection = _getIntersectionFromE2[0];
167
+
168
+ if (!intersection || !intersection.face) return;
169
+ var nowPoint = new _point["default"](intersection.point);
170
+ _this.pressPoint = nowPoint;
171
+
172
+ _this.onIntersectionUpdate(intersection);
173
+ });
174
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPan", function (e) {
175
+ if (!_this.pressPoint) return;
176
+
177
+ var _getIntersectionFromE3 = (0, _getIntersectionFromEvent.getIntersectionFromEvent)(_this.five, e),
178
+ _getIntersectionFromE4 = (0, _slicedToArray2["default"])(_getIntersectionFromE3, 1),
179
+ intersection = _getIntersectionFromE4[0];
180
+
181
+ if (!intersection || !intersection.face) return;
182
+
183
+ _this.onIntersectionUpdate(intersection);
184
+ });
185
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPanEnd", function (e) {
186
+ if (!_this.pressPoint) return;
187
+
188
+ _this.onTap(e);
189
+ });
190
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTap", function (e) {
191
+ if (!_this.hasAppendDashed) {
192
+ _this.dashed.distanceItem.appendTo(_this.container);
193
+
194
+ _this.group.add(_this.dashed.mesh);
195
+ }
196
+
197
+ _this.hasAppendDashed = true;
198
+
199
+ var _getIntersectionFromE5 = (0, _getIntersectionFromEvent.getIntersectionFromEvent)(_this.five, e),
200
+ _getIntersectionFromE6 = (0, _slicedToArray2["default"])(_getIntersectionFromE5, 1),
201
+ intersection = _getIntersectionFromE6[0];
202
+
203
+ _this.updateMouseGroup(intersection);
204
+
205
+ var nowPoint = new _point["default"](_this.mouseGroup.position);
206
+ var lastPoint = _this.lastPoint;
207
+ if (nowPoint) _this.lastPoint = nowPoint;
208
+
209
+ if (nowPoint && lastPoint) {
210
+ var line = new _line["default"](lastPoint, nowPoint, _this.model);
211
+ line.distanceItem.appendTo(_this.container);
212
+
213
+ _this.model.addLine(line);
214
+
215
+ _this.group.add(line.mesh);
216
+
217
+ line.distanceItem.update(_this.five);
218
+ }
219
+
220
+ _this.pressPoint = undefined;
221
+ _this.hasAppendMouseGroup = false;
222
+
223
+ _this.magnifier.dispose();
224
+
225
+ _this.group.remove(_this.mouseGroup);
226
+
227
+ _this.updateDashed();
228
+
229
+ _this.five.needsRender = true;
230
+
231
+ _this.hook.emit('anchorChange', nowPoint.position);
232
+ });
233
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onWantsTapGesture", function () {
234
+ return false;
235
+ });
236
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onWantsToMoveToPano", function () {
237
+ return false;
238
+ });
239
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onWantsPanGesture", function () {
240
+ return _this.pressPoint ? false : undefined;
241
+ });
242
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onCameraUpdate", function () {
243
+ _this.updateDistanceUI();
244
+
245
+ _this.dashed.distanceItem.update(_this.five);
246
+ });
247
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateDashed", function () {
248
+ if (!_this.lastPoint) return;
249
+
250
+ _this.dashed.points[0].position.copy(_this.lastPoint.position);
251
+
252
+ _this.dashed.points[1].position.copy(_this.mouseGroup.position);
253
+
254
+ _this.dashed.mesh.setPoints(_this.lastPoint.position, _this.mouseGroup.position);
255
+
256
+ _this.dashed.distanceItem.update(_this.five);
257
+ });
258
+ _this.dashed = new _line["default"](new _point["default"]([0, 0, 0]), new _point["default"]([0, 0, 0]), _this.model);
259
+
260
+ _this.dashed.mesh.setMaterial({
261
+ dashed: true,
262
+ dashScale: 100
263
+ }); // ==================== 事件监听 ====================
264
+ // five
265
+
266
+
267
+ _this.five.on('cameraUpdate', _this.onCameraUpdate);
268
+
269
+ _this.five.on('wantsPanGesture', _this.onWantsPanGesture);
270
+
271
+ _this.five.on('wantsTapGesture', _this.onWantsTapGesture);
272
+
273
+ _this.five.on('wantsToMoveToPano', _this.onWantsToMoveToPano);
274
+
275
+ _this.five.on('intersectionOnModelUpdate', _this.onIntersectionUpdate); // model
276
+
277
+
278
+ _this.model.hook.on('lineAdded', _this.onLineChanged);
279
+
280
+ _this.model.hook.on('lineRemoved', _this.onLineChanged); // hammer
281
+
282
+
283
+ var fiveElement = _this.five.getElement();
284
+
285
+ if (fiveElement) {
286
+ _this.fiveElement = fiveElement;
287
+ var hammer = new _hammerjs["default"](fiveElement);
288
+ _this.hammer = hammer;
289
+ hammer.on('tap', _this.onTap);
290
+ hammer.on('pan', _this.onPan);
291
+ hammer.on('press', _this.onPress);
292
+ hammer.on('panend', _this.onPanEnd);
293
+ } // fiveElement
294
+
295
+
296
+ (_this$fiveElement = _this.fiveElement) === null || _this$fiveElement === void 0 ? void 0 : _this$fiveElement.addEventListener('mouseleave', _this.onMouseLeave); // ==================== 其他 ====================
297
+
298
+ _this.hook.emit('anchorChange', null);
299
+
300
+ _this.five.refresh();
301
+
302
+ return _this;
303
+ }
304
+
305
+ (0, _createClass2["default"])(EditController, [{
306
+ key: "dispose",
307
+ value: function dispose() {
308
+ var _this$hammer, _this$fiveElement2;
309
+
310
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(EditController.prototype), "dispose", this).call(this);
311
+ this.group.remove(this.mouseGroup, this.dashed.mesh); // ==================== 解除事件监听 ====================
312
+ // five
313
+
314
+ this.five.off('cameraUpdate', this.onCameraUpdate);
315
+ this.five.off('wantsPanGesture', this.onWantsPanGesture);
316
+ this.five.off('wantsTapGesture', this.onWantsTapGesture);
317
+ this.five.off('wantsToMoveToPano', this.onWantsToMoveToPano);
318
+ this.five.off('intersectionOnModelUpdate', this.onIntersectionUpdate); // model
319
+
320
+ this.model.hook.off('lineAdded', this.onLineChanged);
321
+ this.model.hook.off('lineRemoved', this.onLineChanged); // hammer
322
+
323
+ (_this$hammer = this.hammer) === null || _this$hammer === void 0 ? void 0 : _this$hammer.destroy(); // fiveElement
324
+
325
+ (_this$fiveElement2 = this.fiveElement) === null || _this$fiveElement2 === void 0 ? void 0 : _this$fiveElement2.removeEventListener('mouseleave', this.onMouseLeave);
326
+ this.magnifier.dispose();
327
+ this.dashed.distanceItem.remove();
328
+ this.five.needsRender = true;
329
+ }
330
+ }, {
331
+ key: "getEditingLines",
332
+ value: function getEditingLines() {
333
+ return this.model.lines;
334
+ }
335
+ /** 撤销编辑 */
336
+
337
+ }]);
338
+ return EditController;
339
+ }(_BaseController2["default"]);
340
+
341
+ exports["default"] = EditController;
@@ -0,0 +1,12 @@
1
+ import MeasureController from '.';
2
+ import { Five } from '@realsee/five';
3
+ /** 快捷键控制器 */
4
+ export declare class ShortcutKeyController {
5
+ five: Five;
6
+ measureController: MeasureController;
7
+ constructor(measureController: MeasureController, five: Five);
8
+ dispose(): void;
9
+ private escape;
10
+ private onKeyDown;
11
+ private onMouseDown;
12
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.define-property.js");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.ShortcutKeyController = void 0;
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
+
18
+ /** 快捷键控制器 */
19
+ var ShortcutKeyController = /*#__PURE__*/function () {
20
+ function ShortcutKeyController(measureController, five) {
21
+ var _this = this;
22
+
23
+ (0, _classCallCheck2["default"])(this, ShortcutKeyController);
24
+ (0, _defineProperty2["default"])(this, "onKeyDown", function (e) {
25
+ // Command + S -> 保存 & 更改场景
26
+ if (e.metaKey && e.code === 'KeyS') {
27
+ _this.measureController.save().changeMode('Watch');
28
+
29
+ e.preventDefault();
30
+ return;
31
+ } // Escape -> 切换到观察模式 / 如果已经在观察模式,退出功能
32
+
33
+
34
+ if (e.code === 'Escape') return _this.escape();
35
+ });
36
+ (0, _defineProperty2["default"])(this, "onMouseDown", function (e) {
37
+ // 鼠标右键取消
38
+ if (e.button !== 2) return;
39
+ e.preventDefault();
40
+
41
+ _this.escape();
42
+ });
43
+ this.five = five;
44
+ this.measureController = measureController;
45
+ var fiveElement = this.five.getElement();
46
+ if (!fiveElement) return;
47
+ document.body.addEventListener('keydown', this.onKeyDown);
48
+ fiveElement.addEventListener('mousedown', this.onMouseDown);
49
+ }
50
+
51
+ (0, _createClass2["default"])(ShortcutKeyController, [{
52
+ key: "dispose",
53
+ value: function dispose() {
54
+ var fiveElement = this.five.getElement();
55
+ if (!fiveElement) return;
56
+ document.body.removeEventListener('keydown', this.onKeyDown);
57
+ fiveElement.removeEventListener('mousedown', this.onMouseDown);
58
+ }
59
+ }, {
60
+ key: "escape",
61
+ value: function escape() {
62
+ if (this.measureController.getCurrentMode() === 'Watch') return this.measureController.close();
63
+ return this.measureController.changeMode('Watch');
64
+ }
65
+ }]);
66
+ return ShortcutKeyController;
67
+ }();
68
+
69
+ exports.ShortcutKeyController = ShortcutKeyController;
@@ -0,0 +1,25 @@
1
+ import Line from '../Model/line';
2
+ import BaseController, { IControllerParams } from './BaseController';
3
+ export default class WatchController extends BaseController {
4
+ type: string;
5
+ private deleteDom;
6
+ private highlightedLines;
7
+ private fiveElement?;
8
+ private editPointState?;
9
+ private hammer?;
10
+ constructor(params: IControllerParams);
11
+ dispose(): void;
12
+ highlightLine(line: Line): void;
13
+ clearHighlightLines(): void;
14
+ private onPanStart;
15
+ private onPanEnd;
16
+ private onPan;
17
+ private onIntersectionUpdate;
18
+ private wantsPanGesture;
19
+ private wantsTapGesture;
20
+ private chooseLine;
21
+ private highlightLines;
22
+ private lineRemoved;
23
+ private onCameraUpdate;
24
+ private deleteDomClickCallback;
25
+ }