@realsee/dnalogel 0.1.5 → 0.1.7-alpha.11
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.
- package/components/ARVideoFigure/ImgBgTransparentMesh.js +2 -2
- package/components/GLTFView/index.d.ts +123 -0
- package/components/GLTFView/index.js +204 -0
- package/components/GlassFilters/index.js +2 -2
- package/components/ModelView/ModelViewController.js +6 -5
- package/data/81zxMaeVKLQU93OZMG.d.ts +49 -0
- package/data/81zxMaeVKLQU93OZMG.js +633 -0
- package/data/PrXel3aqGbp34JQn.js +139 -1
- package/data/_vLykj3NWrllMrG06.d.ts +95 -0
- package/data/_vLykj3NWrllMrG06.js +1 -0
- package/data/vLykj3NWrllMrG06.js +335 -71
- package/libs/gltf-viewer/Subscribe.d.ts +76 -0
- package/libs/gltf-viewer/Subscribe.js +233 -0
- package/libs/gltf-viewer/coordsMoveByOffset.d.ts +13 -0
- package/libs/gltf-viewer/coordsMoveByOffset.js +22 -0
- package/libs/gltf-viewer/coordsToDirection.d.ts +5 -0
- package/{components/PBRView/index.js → libs/gltf-viewer/coordsToDirection.js} +14 -18
- package/libs/gltf-viewer/formatRad.d.ts +1 -0
- package/libs/gltf-viewer/formatRad.js +13 -0
- package/libs/gltf-viewer/getFrameTime.d.ts +1 -0
- package/libs/gltf-viewer/getFrameTime.js +28 -0
- package/libs/gltf-viewer/index.d.ts +79 -0
- package/libs/gltf-viewer/index.js +765 -0
- package/libs/gltf-viewer/mouseWheel.d.ts +2 -0
- package/libs/gltf-viewer/mouseWheel.js +59 -0
- package/libs/gltf-viewer/requestAnimationFrame.d.ts +1 -0
- package/libs/gltf-viewer/requestAnimationFrame.js +18 -0
- package/libs/gltf-viewer/requestAnimationFrameInterval.d.ts +1 -0
- package/libs/gltf-viewer/requestAnimationFrameInterval.js +31 -0
- package/libs/gltf-viewer/uuid.d.ts +4 -0
- package/libs/gltf-viewer/uuid.js +28 -0
- package/package.json +5 -4
- package/plugins/CSS3DRenderPlugin/components/Marker/index.js +2 -0
- package/plugins/CSS3DRenderPlugin/index.js +17 -12
- package/plugins/CSS3DRenderPlugin/utils/createResizeObserver.d.ts +7 -0
- package/plugins/CSS3DRenderPlugin/utils/createResizeObserver.js +34 -0
- package/plugins/ModelChassisCompassPlugin/index.d.ts +1 -1
- package/plugins/ModelChassisCompassPlugin/index.js +2 -1
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +6 -2
- package/plugins/ModelEntryDoorGuidePlugin/index.js +28 -19
- package/plugins/ModelExtrudeWallsPlugin/index.js +2 -2
- package/plugins/ModelRoomLabelPlugin/Controller.js +1 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +5 -5
- package/plugins/ModelRoomLabelPlugin/RoomLabelItems.js +2 -2
- package/plugins/ModelRoomLabelPlugin/index.d.ts +4 -0
- package/plugins/ModelRoomLabelPlugin/index.js +7 -2
- package/plugins/ModelTVVideoPlugin/index.js +4 -2
- package/plugins/ModelViewPlugin/index.js +2 -2
- package/plugins/PanoCursorRaycasterPlugin/index.js +2 -0
- package/plugins/PanoMaskSelectorPlugin/createBox.js +3 -0
- package/plugins/PanoMaskSelectorPlugin/index.js +3 -1
- package/plugins/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
- package/plugins/PanoMeasurePlugin/Controller/BaseController.js +105 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.js +343 -0
- package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
- package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.js +69 -0
- package/plugins/PanoMeasurePlugin/Controller/WatchController.d.ts +25 -0
- package/plugins/PanoMeasurePlugin/Controller/WatchController.js +373 -0
- package/plugins/PanoMeasurePlugin/Controller/index.d.ts +61 -0
- package/plugins/PanoMeasurePlugin/Controller/index.js +230 -0
- package/plugins/PanoMeasurePlugin/Model/index.d.ts +38 -0
- package/plugins/PanoMeasurePlugin/Model/index.js +237 -0
- package/plugins/PanoMeasurePlugin/Model/line.d.ts +30 -0
- package/plugins/PanoMeasurePlugin/Model/line.js +123 -0
- package/plugins/PanoMeasurePlugin/Model/point.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/point.js +72 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.js +111 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +22 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.js +184 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.js +68 -0
- package/plugins/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
- package/plugins/PanoMeasurePlugin/Modules/GuideController.js +107 -0
- package/plugins/PanoMeasurePlugin/Modules/Magnifier.d.ts +24 -0
- package/plugins/PanoMeasurePlugin/Modules/Magnifier.js +139 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +6 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.js +26 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +18 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +169 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +12 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +59 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/index.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/index.js +125 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/style.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/style.js +103 -0
- package/plugins/PanoMeasurePlugin/index.d.ts +7 -0
- package/plugins/PanoMeasurePlugin/index.js +20 -0
- package/plugins/PanoMeasurePlugin/typings/data.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/typings/data.js +7 -0
- package/plugins/PanoMeasurePlugin/typings/event.type.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/typings/event.type.js +7 -0
- package/plugins/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
- package/plugins/PanoMeasurePlugin/typings/utils.type.js +7 -0
- package/plugins/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/clearGroup.js +16 -0
- package/plugins/PanoMeasurePlugin/utils/constants.d.ts +4 -0
- package/plugins/PanoMeasurePlugin/utils/constants.js +47 -0
- package/plugins/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/utils/distanceDom.js +147 -0
- package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.js +39 -0
- package/plugins/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
- package/plugins/PanoMeasurePlugin/utils/findClosestPoint.js +49 -0
- package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
- package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.js +20 -0
- package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
- package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.js +33 -0
- package/plugins/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
- package/plugins/PanoMeasurePlugin/utils/ironbox.js +14 -0
- package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.js +16 -0
- package/plugins/PanoMeasurePlugin/utils/line.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/utils/line.js +61 -0
- package/plugins/PanoMeasurePlugin/utils/math.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/utils/math.js +57 -0
- package/plugins/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/mouseGroup.js +42 -0
- package/plugins/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
- package/plugins/PanoMeasurePlugin/utils/ndc2Screen.js +16 -0
- package/plugins/PanoRulerPlugin/index.d.ts +4 -0
- package/plugins/PanoRulerPlugin/index.js +8 -3
- package/plugins/PanoTVVideoPlugin/index.d.ts +2 -0
- package/plugins/PanoTVVideoPlugin/index.js +20 -14
- package/plugins/TreasurePlugin/Controller.js +2 -2
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +2 -2
- package/plugins/floorplan/Assets/floorplanExtraObject.d.ts +1 -1
- package/plugins/floorplan/Assets/floorplanExtraObject.js +3 -3
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.d.ts +5 -2
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +22 -11
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +4 -4
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +5 -5
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +2 -2
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +2 -2
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.d.ts +11 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.js +174 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.d.ts +8 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.js +182 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.d.ts +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +14 -2
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.d.ts +3 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +1 -1
- package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.d.ts +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.js +7 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +1 -1
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +1 -1
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +1 -1
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +3 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +4 -4
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +1 -1
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +3 -3
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.d.ts +3 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +16 -6
- package/plugins/floorplan/index.d.ts +4 -0
- package/plugins/floorplan/index.js +13 -0
- package/plugins/floorplan/typings/floorplanData.d.ts +2 -0
- package/plugins/floorplan/typings/floorplanServerData.d.ts +3 -1
- package/plugins/floorplan/typings/floorplanServerData.js +3 -3
- package/plugins/floorplan/utils/formatData.js +3 -2
- package/plugins/floorplan/utils/formatPosition.js +2 -0
- package/shared-utils/Subscribe.js +4 -2
- package/shared-utils/animationFrame/BetterTween.js +5 -1
- package/shared-utils/changeModelCanvasOpacity.d.ts +2 -0
- package/shared-utils/{changeModelCanvansOpacity.js → changeModelCanvasOpacity.js} +2 -2
- package/shared-utils/filter.js +4 -2
- package/shared-utils/math/evenNumber.d.ts +3 -1
- package/shared-utils/math/evenNumber.js +4 -2
- package/shared-utils/math/planimetry.js +2 -0
- package/shared-utils/removeArrayItem.d.ts +7 -0
- package/shared-utils/removeArrayItem.js +22 -0
- package/shared-utils/three/loadTexture.d.ts +2 -2
- package/shared-utils/three/loadTexture.js +21 -2
- package/typedoc/libs.d.ts +1 -0
- package/typedoc/libs.js +7 -0
- package/components/PBRView/index.d.ts +0 -14
- package/shared-utils/changeModelCanvansOpacity.d.ts +0 -2
|
@@ -13,6 +13,8 @@ require("core-js/modules/es.string.sub.js");
|
|
|
13
13
|
|
|
14
14
|
require("core-js/modules/es.array.for-each.js");
|
|
15
15
|
|
|
16
|
+
require("core-js/modules/es.object.to-string.js");
|
|
17
|
+
|
|
16
18
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
17
19
|
|
|
18
20
|
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
|
|
@@ -25,6 +25,8 @@ require("core-js/modules/es.object.assign.js");
|
|
|
25
25
|
|
|
26
26
|
require("core-js/modules/es.array.map.js");
|
|
27
27
|
|
|
28
|
+
require("core-js/modules/es.function.name.js");
|
|
29
|
+
|
|
28
30
|
var THREE = _interopRequireWildcard(require("three"));
|
|
29
31
|
|
|
30
32
|
var _vertexShader = require("./vertexShader");
|
|
@@ -75,5 +77,6 @@ function createBox(textures, observer, _config) {
|
|
|
75
77
|
box.geometry.scale(-1, 1, 1);
|
|
76
78
|
box.position.set(observer.position.x, observer.position.y, observer.position.z);
|
|
77
79
|
box.quaternion.multiply(observer.quaternion);
|
|
80
|
+
box.name = 'PanoMaskSelectorPlugin';
|
|
78
81
|
return box;
|
|
79
82
|
}
|
|
@@ -133,9 +133,11 @@ var PanoMaskSelectorPlugin = function PanoMaskSelectorPlugin(five) {
|
|
|
133
133
|
|
|
134
134
|
if (state.box) {
|
|
135
135
|
five.scene.remove(state.box);
|
|
136
|
+
state.box = undefined;
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
var panoramaImgs = state.data.panoramaImgs[five.panoIndex];
|
|
140
|
+
state.currentLoadedIndex = five.panoIndex;
|
|
139
141
|
|
|
140
142
|
if (!panoramaImgs) {
|
|
141
143
|
state.textures = undefined;
|
|
@@ -149,7 +151,7 @@ var PanoMaskSelectorPlugin = function PanoMaskSelectorPlugin(five) {
|
|
|
149
151
|
thickness: ((_state$data$config2 = state.data.config) === null || _state$data$config2 === void 0 ? void 0 : _state$data$config2.thickness) || 0.005
|
|
150
152
|
});
|
|
151
153
|
five.scene.add(state.box);
|
|
152
|
-
|
|
154
|
+
five.needsRender = true;
|
|
153
155
|
return true;
|
|
154
156
|
};
|
|
155
157
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Line from '../Model/line';
|
|
2
|
+
import Magnifier from '../Modules/Magnifier';
|
|
3
|
+
import FiveHelper from '../Modules/FiveHelper';
|
|
4
|
+
import { Group } from 'three';
|
|
5
|
+
import { Model } from '../Model';
|
|
6
|
+
import { PluginEvent } from '../typings/event.type';
|
|
7
|
+
import { Five, Intersection, IntersectMeshInterface, Subscribe } from '@realsee/five';
|
|
8
|
+
import { UserDistanceItem } from '../utils/distanceDom';
|
|
9
|
+
export interface IControllerParams {
|
|
10
|
+
five: Five;
|
|
11
|
+
group: Group;
|
|
12
|
+
model: Model;
|
|
13
|
+
mouseGroup: Group;
|
|
14
|
+
container: Element;
|
|
15
|
+
magnifier: Magnifier;
|
|
16
|
+
fiveHelper: FiveHelper;
|
|
17
|
+
hook: Subscribe<PluginEvent>;
|
|
18
|
+
userDistanceItemCreator?: () => UserDistanceItem;
|
|
19
|
+
}
|
|
20
|
+
export default abstract class BaseController {
|
|
21
|
+
protected five: Five;
|
|
22
|
+
protected group: Group;
|
|
23
|
+
protected model: Model;
|
|
24
|
+
protected disposed: boolean;
|
|
25
|
+
protected mouseGroup: Group;
|
|
26
|
+
protected container: Element;
|
|
27
|
+
protected fiveHelper: FiveHelper;
|
|
28
|
+
protected hook: IControllerParams['hook'];
|
|
29
|
+
protected magnifier: IControllerParams['magnifier'];
|
|
30
|
+
protected userDistanceItemCreator: IControllerParams['userDistanceItemCreator'];
|
|
31
|
+
constructor(params: IControllerParams);
|
|
32
|
+
protected removeLine(line: Line): void;
|
|
33
|
+
protected updateDistanceUI: () => void;
|
|
34
|
+
protected updateMouseGroup(intersection: Intersection, mesh?: IntersectMeshInterface): Group;
|
|
35
|
+
protected dispose(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
require("core-js/modules/es.array.for-each.js");
|
|
13
|
+
|
|
14
|
+
require("core-js/modules/es.object.to-string.js");
|
|
15
|
+
|
|
16
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
17
|
+
|
|
18
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
+
|
|
20
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
+
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
+
|
|
24
|
+
var _ironbox = require("../utils/ironbox");
|
|
25
|
+
|
|
26
|
+
var BaseController = /*#__PURE__*/function () {
|
|
27
|
+
function BaseController(params) {
|
|
28
|
+
var _this = this;
|
|
29
|
+
|
|
30
|
+
(0, _classCallCheck2["default"])(this, BaseController);
|
|
31
|
+
(0, _defineProperty2["default"])(this, "disposed", false);
|
|
32
|
+
(0, _defineProperty2["default"])(this, "updateDistanceUI", function () {
|
|
33
|
+
_this.model.lines.forEach(function (line) {
|
|
34
|
+
return line.distanceItem.update(_this.five);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
// ==================== Params ====================
|
|
38
|
+
this.five = params.five;
|
|
39
|
+
this.hook = params.hook;
|
|
40
|
+
this.model = params.model;
|
|
41
|
+
this.magnifier = params.magnifier;
|
|
42
|
+
this.container = params.container;
|
|
43
|
+
this.fiveHelper = params.fiveHelper;
|
|
44
|
+
this.userDistanceItemCreator = params.userDistanceItemCreator; // ==================== Groups ====================
|
|
45
|
+
|
|
46
|
+
this.group = params.group;
|
|
47
|
+
this.mouseGroup = params.mouseGroup;
|
|
48
|
+
var fiveElement = this.five.getElement();
|
|
49
|
+
|
|
50
|
+
if (fiveElement) {
|
|
51
|
+
fiveElement.addEventListener('touchstart', _ironbox.preventDefault);
|
|
52
|
+
fiveElement.addEventListener('contextmenu', _ironbox.preventDefault);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
(0, _createClass2["default"])(BaseController, [{
|
|
57
|
+
key: "removeLine",
|
|
58
|
+
value: function removeLine(line) {
|
|
59
|
+
this.group.remove(line.mesh, line.lightMesh);
|
|
60
|
+
line.distanceItem.remove();
|
|
61
|
+
this.five.needsRender = true;
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "updateMouseGroup",
|
|
65
|
+
value: function updateMouseGroup(intersection, mesh) {
|
|
66
|
+
if (!intersection) return this.mouseGroup; // ============ update mouseGroup position ============
|
|
67
|
+
|
|
68
|
+
var adsorbentPoint = this.fiveHelper.getAdsorbentPoint(intersection);
|
|
69
|
+
var viewPosition = adsorbentPoint ? adsorbentPoint : intersection.point;
|
|
70
|
+
this.mouseGroup.position.copy(viewPosition); // ============ update mouseGroup quaternion ============
|
|
71
|
+
|
|
72
|
+
if (mesh) {
|
|
73
|
+
this.mouseGroup.quaternion.copy(mesh.quaternion);
|
|
74
|
+
} else if (intersection.face) {
|
|
75
|
+
var normal = intersection.face.normal;
|
|
76
|
+
var positionVector = normal.clone().multiplyScalar(0.05);
|
|
77
|
+
var position = intersection.point.clone().add(positionVector);
|
|
78
|
+
var lookAtVector = position.clone().add(positionVector);
|
|
79
|
+
this.mouseGroup.lookAt(lookAtVector);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return this.mouseGroup;
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "dispose",
|
|
86
|
+
value: function dispose() {
|
|
87
|
+
var _this2 = this;
|
|
88
|
+
|
|
89
|
+
this.disposed = true;
|
|
90
|
+
this.magnifier.dispose();
|
|
91
|
+
this.model.lines.forEach(function (line) {
|
|
92
|
+
return _this2.removeLine(line);
|
|
93
|
+
});
|
|
94
|
+
var fiveElement = this.five.getElement();
|
|
95
|
+
|
|
96
|
+
if (fiveElement) {
|
|
97
|
+
fiveElement.removeEventListener('touchstart', _ironbox.preventDefault);
|
|
98
|
+
fiveElement.removeEventListener('contextmenu', _ironbox.preventDefault);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}]);
|
|
102
|
+
return BaseController;
|
|
103
|
+
}();
|
|
104
|
+
|
|
105
|
+
exports["default"] = BaseController;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Model } from '../Model';
|
|
2
|
+
import Line from '../Model/line';
|
|
3
|
+
import { LineJson } from '../typings/data';
|
|
4
|
+
import BaseController, { IControllerParams } from './BaseController';
|
|
5
|
+
export interface EditEvent {
|
|
6
|
+
editedLineChange: (lines: LineJson[]) => void;
|
|
7
|
+
}
|
|
8
|
+
export default class EditController extends BaseController {
|
|
9
|
+
type: string;
|
|
10
|
+
model: Model;
|
|
11
|
+
private pressPoint?;
|
|
12
|
+
private hasAppendDashed;
|
|
13
|
+
private hasAppendMouseGroup;
|
|
14
|
+
private fiveElement?;
|
|
15
|
+
/** 上一个端点位置 */
|
|
16
|
+
private lastPoint;
|
|
17
|
+
/** 鼠标点到上一个端点连接的虚线 */
|
|
18
|
+
private dashed;
|
|
19
|
+
private hammer?;
|
|
20
|
+
/** 根据 intersection 更新放大镜和吸附点 */
|
|
21
|
+
private onIntersectionUpdate;
|
|
22
|
+
constructor(params: IControllerParams);
|
|
23
|
+
dispose(): void;
|
|
24
|
+
getEditingLines(): Line[];
|
|
25
|
+
/** 撤销编辑 */
|
|
26
|
+
revoke: () => void;
|
|
27
|
+
private onMouseLeave;
|
|
28
|
+
/** 编辑线条发生改变时通知外部 */
|
|
29
|
+
private onLineChanged;
|
|
30
|
+
private onPress;
|
|
31
|
+
/**
|
|
32
|
+
* 1. 如果之前没有长按行为「即没有长按点时」-> 滑动全景
|
|
33
|
+
* 2. 如果有长按点,把长按点位置更新为当前位置
|
|
34
|
+
*/
|
|
35
|
+
private onPan;
|
|
36
|
+
private onPanEnd;
|
|
37
|
+
/**
|
|
38
|
+
* 1. 如果存在上一个点,需要绘制当前点到上一个点的连线
|
|
39
|
+
* 2. 把上一个点的位置更新为当前点的位置
|
|
40
|
+
* 3. 清除 mouseGroup 和 magnifier
|
|
41
|
+
*/
|
|
42
|
+
private onTap;
|
|
43
|
+
private onWantsTapGesture;
|
|
44
|
+
/** 编辑时取消走点 */
|
|
45
|
+
private onWantsToMoveToPano;
|
|
46
|
+
/** 存在长按点时不能移动全景 */
|
|
47
|
+
private onWantsPanGesture;
|
|
48
|
+
/** 移动全景时更新 distanceItem 在屏幕上的位置 */
|
|
49
|
+
private onCameraUpdate;
|
|
50
|
+
/** 更新虚线 */
|
|
51
|
+
private updateDashed;
|
|
52
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.to-string.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.reflect.construct.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.object.define-property.js");
|
|
8
|
+
|
|
9
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports["default"] = void 0;
|
|
15
|
+
|
|
16
|
+
require("core-js/modules/es.array.map.js");
|
|
17
|
+
|
|
18
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
+
|
|
20
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
21
|
+
|
|
22
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
23
|
+
|
|
24
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
25
|
+
|
|
26
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
27
|
+
|
|
28
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
29
|
+
|
|
30
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
31
|
+
|
|
32
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
33
|
+
|
|
34
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
35
|
+
|
|
36
|
+
var _hammerjs = _interopRequireDefault(require("hammerjs"));
|
|
37
|
+
|
|
38
|
+
var _Model = require("../Model");
|
|
39
|
+
|
|
40
|
+
var _line = _interopRequireDefault(require("../Model/line"));
|
|
41
|
+
|
|
42
|
+
var _point = _interopRequireDefault(require("../Model/point"));
|
|
43
|
+
|
|
44
|
+
var _throttle = _interopRequireDefault(require("../../../shared-utils/throttle"));
|
|
45
|
+
|
|
46
|
+
var _BaseController2 = _interopRequireDefault(require("./BaseController"));
|
|
47
|
+
|
|
48
|
+
var _getIntersectionFromEvent = require("../utils/getIntersectionFromEvent");
|
|
49
|
+
|
|
50
|
+
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); }; }
|
|
51
|
+
|
|
52
|
+
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; } }
|
|
53
|
+
|
|
54
|
+
var EditController = /*#__PURE__*/function (_BaseController) {
|
|
55
|
+
(0, _inherits2["default"])(EditController, _BaseController);
|
|
56
|
+
|
|
57
|
+
var _super = _createSuper(EditController);
|
|
58
|
+
|
|
59
|
+
/** 上一个端点位置 */
|
|
60
|
+
|
|
61
|
+
/** 根据 intersection 更新放大镜和吸附点 */
|
|
62
|
+
function EditController(params) {
|
|
63
|
+
var _this$fiveElement;
|
|
64
|
+
|
|
65
|
+
var _this;
|
|
66
|
+
|
|
67
|
+
(0, _classCallCheck2["default"])(this, EditController);
|
|
68
|
+
_this = _super.call(this, params); // ==================== 虚线 ====================
|
|
69
|
+
|
|
70
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "type", 'edit');
|
|
71
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "model", new _Model.Model({
|
|
72
|
+
userDistanceItemCreator: _this.userDistanceItemCreator
|
|
73
|
+
}));
|
|
74
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "hasAppendDashed", false);
|
|
75
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "hasAppendMouseGroup", false);
|
|
76
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "lastPoint", null);
|
|
77
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onIntersectionUpdate", (0, _throttle["default"])(function (intersection, mesh) {
|
|
78
|
+
var _this$pressPoint;
|
|
79
|
+
|
|
80
|
+
if (_this.hasAppendMouseGroup === false) {
|
|
81
|
+
_this.group.add(_this.mouseGroup);
|
|
82
|
+
|
|
83
|
+
_this.magnifier.appendTo(_this.container);
|
|
84
|
+
|
|
85
|
+
_this.hasAppendMouseGroup = true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var position = _this.updateMouseGroup(intersection, mesh).position;
|
|
89
|
+
|
|
90
|
+
(_this$pressPoint = _this.pressPoint) === null || _this$pressPoint === void 0 ? void 0 : _this$pressPoint.position.copy(position);
|
|
91
|
+
|
|
92
|
+
_this.updateDashed();
|
|
93
|
+
|
|
94
|
+
requestAnimationFrame(function () {
|
|
95
|
+
return _this.magnifier.updateWithPoint(_this.mouseGroup.position);
|
|
96
|
+
});
|
|
97
|
+
_this.five.needsRender = true;
|
|
98
|
+
}, 20));
|
|
99
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "revoke", function () {
|
|
100
|
+
// ============ revoke points ============
|
|
101
|
+
// 如果当前没有虚线,只有起始点,需要删除起始点,重置起始状态。并删除虚线实例
|
|
102
|
+
if (_this.model.lines.length === 0 && _this.lastPoint) {
|
|
103
|
+
_this.lastPoint = null;
|
|
104
|
+
_this.hasAppendDashed = false;
|
|
105
|
+
|
|
106
|
+
_this.dashed.distanceItem.remove();
|
|
107
|
+
|
|
108
|
+
_this.group.remove(_this.dashed.mesh);
|
|
109
|
+
|
|
110
|
+
_this.hook.emit('anchorChange', null);
|
|
111
|
+
|
|
112
|
+
_this.five.needsRender = true;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (_this.model.lines.length === 0 && !_this.lastPoint) return;
|
|
117
|
+
if (!_this.lastPoint) return;
|
|
118
|
+
var revokedLine = _this.model.lines[_this.model.lines.length - 1];
|
|
119
|
+
var lastPoint = revokedLine.findAnotherPoint(_this.lastPoint);
|
|
120
|
+
if (!lastPoint) return;
|
|
121
|
+
_this.lastPoint = lastPoint;
|
|
122
|
+
|
|
123
|
+
_this.hook.emit('anchorChange', lastPoint.position); // ============ revoke lines ============
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
_this.group.remove(revokedLine.mesh);
|
|
127
|
+
|
|
128
|
+
_this.model.removeLine(revokedLine); // ============ revoke mouse group ============
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
_this.hasAppendMouseGroup = false;
|
|
132
|
+
|
|
133
|
+
_this.mouseGroup.position.copy(_this.lastPoint.position);
|
|
134
|
+
|
|
135
|
+
_this.group.remove(_this.mouseGroup); // ============ revoke lineDistance ============
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
revokedLine.distanceItem.remove(); // ============ revoke dashed ============
|
|
139
|
+
|
|
140
|
+
_this.updateDashed(); // ============ revoke magnifier ============
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
_this.magnifier.dispose();
|
|
144
|
+
|
|
145
|
+
_this.five.needsRender = true;
|
|
146
|
+
});
|
|
147
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onMouseLeave", function () {
|
|
148
|
+
_this.magnifier.dispose();
|
|
149
|
+
|
|
150
|
+
_this.group.remove(_this.mouseGroup);
|
|
151
|
+
|
|
152
|
+
_this.hasAppendMouseGroup = false;
|
|
153
|
+
|
|
154
|
+
if (_this.lastPoint) {
|
|
155
|
+
_this.mouseGroup.position.copy(_this.lastPoint.position);
|
|
156
|
+
|
|
157
|
+
_this.updateDashed();
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onLineChanged", function () {
|
|
161
|
+
_this.hook.emit('editedLineChange', _this.model.lines.map(function (line) {
|
|
162
|
+
return line.toCompletelyJson();
|
|
163
|
+
}));
|
|
164
|
+
});
|
|
165
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPress", function (e) {
|
|
166
|
+
var _getIntersectionFromE = (0, _getIntersectionFromEvent.getIntersectionFromEvent)(_this.five, e),
|
|
167
|
+
_getIntersectionFromE2 = (0, _slicedToArray2["default"])(_getIntersectionFromE, 1),
|
|
168
|
+
intersection = _getIntersectionFromE2[0];
|
|
169
|
+
|
|
170
|
+
if (!intersection || !intersection.face) return;
|
|
171
|
+
var nowPoint = new _point["default"](intersection.point);
|
|
172
|
+
_this.pressPoint = nowPoint;
|
|
173
|
+
|
|
174
|
+
_this.onIntersectionUpdate(intersection);
|
|
175
|
+
});
|
|
176
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPan", function (e) {
|
|
177
|
+
if (!_this.pressPoint) return;
|
|
178
|
+
|
|
179
|
+
var _getIntersectionFromE3 = (0, _getIntersectionFromEvent.getIntersectionFromEvent)(_this.five, e),
|
|
180
|
+
_getIntersectionFromE4 = (0, _slicedToArray2["default"])(_getIntersectionFromE3, 1),
|
|
181
|
+
intersection = _getIntersectionFromE4[0];
|
|
182
|
+
|
|
183
|
+
if (!intersection || !intersection.face) return;
|
|
184
|
+
|
|
185
|
+
_this.onIntersectionUpdate(intersection);
|
|
186
|
+
});
|
|
187
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPanEnd", function (e) {
|
|
188
|
+
if (!_this.pressPoint) return;
|
|
189
|
+
|
|
190
|
+
_this.onTap(e);
|
|
191
|
+
});
|
|
192
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTap", function (e) {
|
|
193
|
+
if (!_this.hasAppendDashed) {
|
|
194
|
+
_this.dashed.distanceItem.appendTo(_this.container);
|
|
195
|
+
|
|
196
|
+
_this.group.add(_this.dashed.mesh);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
_this.hasAppendDashed = true;
|
|
200
|
+
|
|
201
|
+
var _getIntersectionFromE5 = (0, _getIntersectionFromEvent.getIntersectionFromEvent)(_this.five, e),
|
|
202
|
+
_getIntersectionFromE6 = (0, _slicedToArray2["default"])(_getIntersectionFromE5, 1),
|
|
203
|
+
intersection = _getIntersectionFromE6[0];
|
|
204
|
+
|
|
205
|
+
_this.updateMouseGroup(intersection);
|
|
206
|
+
|
|
207
|
+
var nowPoint = new _point["default"](_this.mouseGroup.position);
|
|
208
|
+
var lastPoint = _this.lastPoint;
|
|
209
|
+
if (nowPoint) _this.lastPoint = nowPoint;
|
|
210
|
+
|
|
211
|
+
if (nowPoint && lastPoint) {
|
|
212
|
+
var line = new _line["default"](lastPoint, nowPoint, _this.model);
|
|
213
|
+
line.distanceItem.appendTo(_this.container);
|
|
214
|
+
|
|
215
|
+
_this.model.addLine(line);
|
|
216
|
+
|
|
217
|
+
_this.group.add(line.mesh);
|
|
218
|
+
|
|
219
|
+
line.distanceItem.update(_this.five);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
_this.pressPoint = undefined;
|
|
223
|
+
_this.hasAppendMouseGroup = false;
|
|
224
|
+
|
|
225
|
+
_this.magnifier.dispose();
|
|
226
|
+
|
|
227
|
+
_this.group.remove(_this.mouseGroup);
|
|
228
|
+
|
|
229
|
+
_this.updateDashed();
|
|
230
|
+
|
|
231
|
+
_this.five.needsRender = true;
|
|
232
|
+
|
|
233
|
+
_this.hook.emit('anchorChange', nowPoint.position);
|
|
234
|
+
});
|
|
235
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onWantsTapGesture", function () {
|
|
236
|
+
return false;
|
|
237
|
+
});
|
|
238
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onWantsToMoveToPano", function () {
|
|
239
|
+
return false;
|
|
240
|
+
});
|
|
241
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onWantsPanGesture", function () {
|
|
242
|
+
return _this.pressPoint ? false : undefined;
|
|
243
|
+
});
|
|
244
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onCameraUpdate", function () {
|
|
245
|
+
_this.updateDistanceUI();
|
|
246
|
+
|
|
247
|
+
_this.dashed.distanceItem.update(_this.five);
|
|
248
|
+
});
|
|
249
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateDashed", function () {
|
|
250
|
+
if (!_this.lastPoint) return;
|
|
251
|
+
|
|
252
|
+
_this.dashed.points[0].position.copy(_this.lastPoint.position);
|
|
253
|
+
|
|
254
|
+
_this.dashed.points[1].position.copy(_this.mouseGroup.position);
|
|
255
|
+
|
|
256
|
+
_this.dashed.mesh.setPoints(_this.lastPoint.position, _this.mouseGroup.position);
|
|
257
|
+
|
|
258
|
+
_this.dashed.distanceItem.update(_this.five);
|
|
259
|
+
});
|
|
260
|
+
_this.dashed = new _line["default"](new _point["default"]([0, 0, 0]), new _point["default"]([0, 0, 0]), _this.model);
|
|
261
|
+
|
|
262
|
+
_this.dashed.mesh.setMaterial({
|
|
263
|
+
dashed: true,
|
|
264
|
+
dashScale: 100
|
|
265
|
+
}); // ==================== 事件监听 ====================
|
|
266
|
+
// five
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
_this.five.on('cameraUpdate', _this.onCameraUpdate);
|
|
270
|
+
|
|
271
|
+
_this.five.on('wantsPanGesture', _this.onWantsPanGesture);
|
|
272
|
+
|
|
273
|
+
_this.five.on('wantsTapGesture', _this.onWantsTapGesture);
|
|
274
|
+
|
|
275
|
+
_this.five.on('wantsToMoveToPano', _this.onWantsToMoveToPano);
|
|
276
|
+
|
|
277
|
+
_this.five.on('intersectionOnModelUpdate', _this.onIntersectionUpdate); // model
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
_this.model.hook.on('lineAdded', _this.onLineChanged);
|
|
281
|
+
|
|
282
|
+
_this.model.hook.on('lineRemoved', _this.onLineChanged); // hammer
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
var fiveElement = _this.five.getElement();
|
|
286
|
+
|
|
287
|
+
if (fiveElement) {
|
|
288
|
+
_this.fiveElement = fiveElement;
|
|
289
|
+
var hammer = new _hammerjs["default"](fiveElement);
|
|
290
|
+
_this.hammer = hammer;
|
|
291
|
+
hammer.on('tap', _this.onTap);
|
|
292
|
+
hammer.on('pan', _this.onPan);
|
|
293
|
+
hammer.on('press', _this.onPress);
|
|
294
|
+
hammer.on('panend', _this.onPanEnd);
|
|
295
|
+
} // fiveElement
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
(_this$fiveElement = _this.fiveElement) === null || _this$fiveElement === void 0 ? void 0 : _this$fiveElement.addEventListener('mouseleave', _this.onMouseLeave); // ==================== 其他 ====================
|
|
299
|
+
|
|
300
|
+
_this.hook.emit('anchorChange', null);
|
|
301
|
+
|
|
302
|
+
_this.five.refresh();
|
|
303
|
+
|
|
304
|
+
return _this;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
(0, _createClass2["default"])(EditController, [{
|
|
308
|
+
key: "dispose",
|
|
309
|
+
value: function dispose() {
|
|
310
|
+
var _this$hammer, _this$fiveElement2;
|
|
311
|
+
|
|
312
|
+
(0, _get2["default"])((0, _getPrototypeOf2["default"])(EditController.prototype), "dispose", this).call(this);
|
|
313
|
+
this.group.remove(this.mouseGroup, this.dashed.mesh); // ==================== 解除事件监听 ====================
|
|
314
|
+
// five
|
|
315
|
+
|
|
316
|
+
this.five.off('cameraUpdate', this.onCameraUpdate);
|
|
317
|
+
this.five.off('wantsPanGesture', this.onWantsPanGesture);
|
|
318
|
+
this.five.off('wantsTapGesture', this.onWantsTapGesture);
|
|
319
|
+
this.five.off('wantsToMoveToPano', this.onWantsToMoveToPano);
|
|
320
|
+
this.five.off('intersectionOnModelUpdate', this.onIntersectionUpdate); // model
|
|
321
|
+
|
|
322
|
+
this.model.hook.off('lineAdded', this.onLineChanged);
|
|
323
|
+
this.model.hook.off('lineRemoved', this.onLineChanged); // hammer
|
|
324
|
+
|
|
325
|
+
(_this$hammer = this.hammer) === null || _this$hammer === void 0 ? void 0 : _this$hammer.destroy(); // fiveElement
|
|
326
|
+
|
|
327
|
+
(_this$fiveElement2 = this.fiveElement) === null || _this$fiveElement2 === void 0 ? void 0 : _this$fiveElement2.removeEventListener('mouseleave', this.onMouseLeave);
|
|
328
|
+
this.magnifier.dispose();
|
|
329
|
+
this.dashed.distanceItem.remove();
|
|
330
|
+
this.five.needsRender = true;
|
|
331
|
+
}
|
|
332
|
+
}, {
|
|
333
|
+
key: "getEditingLines",
|
|
334
|
+
value: function getEditingLines() {
|
|
335
|
+
return this.model.lines;
|
|
336
|
+
}
|
|
337
|
+
/** 撤销编辑 */
|
|
338
|
+
|
|
339
|
+
}]);
|
|
340
|
+
return EditController;
|
|
341
|
+
}(_BaseController2["default"]);
|
|
342
|
+
|
|
343
|
+
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;
|