@realsee/dnalogel 2.0.0-alpha.29 → 2.0.0-alpha.30
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/CHANGELOG.md +8 -1
- package/dist/ItemLabelPlugin/Plugin.d.ts +4 -0
- package/dist/ItemLabelPlugin/events.type.d.ts +9 -0
- package/dist/ItemLabelPlugin/index.d.ts +9 -0
- package/dist/ItemLabelPlugin/index.js +922 -0
- package/dist/ItemLabelPlugin/typings.d.ts +59 -0
- package/dist/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/dist/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/dist/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/dist/ItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/dist/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/dist/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
- package/dist/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/dist/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
- package/dist/PanoMeasurePlugin/Controller/index.d.ts +17 -8
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
- package/dist/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
- package/dist/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/dist/PanoMeasurePlugin/index.d.ts +8 -5
- package/dist/PanoMeasurePlugin/index.js +1893 -3431
- package/dist/PanoMeasurePlugin/typings/data.d.ts +4 -0
- package/dist/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
- package/dist/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
- package/dist/floorplan/ModelFloorplanPlugin/index.js +3 -3
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +4939 -5627
- package/dist/index.js +5607 -6291
- package/dist/index.umd.js +5610 -6295
- package/dist/shared-utils/index.d.ts +1 -0
- package/dist/shared-utils/math/Interval.d.ts +13 -0
- package/dist/shared-utils/math/Rectangle.d.ts +27 -0
- package/dist/shared-utils/math/index.d.ts +2 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +9 -0
- package/docs/classes/ModelRoomLabelController.html +5 -5
- package/docs/classes/PanoFloorplanRadarPluginController.html +2 -2
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -0
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +3 -3
- package/docs/interfaces/CameraMovementPluginExportType.html +3 -3
- package/docs/interfaces/FloorplanBounding.html +5 -5
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +8 -8
- package/docs/interfaces/FloorplanExtraObject.html +4 -4
- package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
- package/docs/interfaces/FloorplanFloorData.html +2 -2
- package/docs/interfaces/FloorplanImagePosition.html +2 -2
- package/docs/interfaces/FloorplanObserver.html +2 -2
- package/docs/interfaces/FloorplanOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanPosition.html +2 -2
- package/docs/interfaces/FloorplanRoomItem.html +7 -7
- package/docs/interfaces/FloorplanRoomLabelItem.html +4 -4
- package/docs/interfaces/FloorplanServerBounding.html +5 -5
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +8 -8
- package/docs/interfaces/FloorplanServerFloorData.html +2 -2
- package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
- package/docs/interfaces/FloorplanServerObserver.html +2 -2
- package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanServerPosition.html +2 -2
- package/docs/interfaces/FloorplanServerRoomItem.html +8 -8
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +4 -4
- package/docs/interfaces/ItemLabelPluginData.html +1 -0
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -0
- package/docs/interfaces/ItemLabelPluginParametersType.html +1 -0
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +3 -3
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/OpenParameter.html +3 -0
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +1 -0
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +10 -10
- package/docs/modules.html +20 -20
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +558 -0
- package/libs/ItemLabelPlugin/ItemLabelItem.js +228 -0
- package/libs/ItemLabelPlugin/Plugin.d.ts +4 -0
- package/libs/ItemLabelPlugin/Plugin.js +120 -0
- package/libs/ItemLabelPlugin/events.type.d.ts +9 -0
- package/libs/ItemLabelPlugin/events.type.js +1 -0
- package/libs/ItemLabelPlugin/index.d.ts +9 -0
- package/libs/ItemLabelPlugin/index.js +8 -0
- package/libs/ItemLabelPlugin/typings.d.ts +59 -0
- package/libs/ItemLabelPlugin/typings.js +7 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.js +3 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.js +16 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.js +12 -0
- package/libs/ItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/libs/ItemLabelPlugin/utils/parseData.js +4 -0
- package/libs/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/libs/ItemLabelPlugin/utils/transform2RenderData.js +4 -0
- package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +9 -1
- package/libs/PanoMeasurePlugin/Controller/EditController.js +4 -4
- package/libs/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/libs/PanoMeasurePlugin/Controller/MixedController.js +337 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +14 -3
- package/libs/PanoMeasurePlugin/Controller/index.d.ts +17 -8
- package/libs/PanoMeasurePlugin/Controller/index.js +57 -18
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -14
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +48 -11
- package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +185 -60
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.js +98 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +24 -7
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +80 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.js +10 -1
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +64 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +265 -0
- package/libs/PanoMeasurePlugin/index.d.ts +8 -5
- package/libs/PanoMeasurePlugin/index.js +2 -0
- package/libs/PanoMeasurePlugin/typings/data.d.ts +4 -0
- package/libs/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.js +15 -0
- package/libs/PanoMeasurePlugin/utils/constants.js +7 -7
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +19 -14
- package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
- package/libs/PanoMeasurePlugin/utils/mouseGroup.js +5 -6
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +3 -3
- package/libs/index.d.ts +1 -0
- package/libs/index.js +2 -1
- package/libs/shared-utils/index.d.ts +1 -0
- package/libs/shared-utils/index.js +1 -0
- package/libs/shared-utils/math/Interval.d.ts +13 -0
- package/libs/shared-utils/math/Interval.js +40 -0
- package/libs/shared-utils/math/Rectangle.d.ts +27 -0
- package/libs/shared-utils/math/Rectangle.js +50 -0
- package/libs/shared-utils/math/index.d.ts +2 -0
- package/libs/shared-utils/math/index.js +2 -0
- package/package.json +3 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { LineJson } from '../typings/data';
|
|
2
|
+
import { Model } from '../Model';
|
|
3
|
+
import Line from '../Model/line';
|
|
4
|
+
import BaseController, { IControllerParams } from './BaseController';
|
|
5
|
+
export declare type State = 'watching' | 'editing';
|
|
6
|
+
export interface EditEvent {
|
|
7
|
+
editedLineChange: (lines: LineJson[]) => void;
|
|
8
|
+
}
|
|
9
|
+
export default class MixedController extends BaseController {
|
|
10
|
+
state: State;
|
|
11
|
+
model: Model;
|
|
12
|
+
private hasAppendDashed;
|
|
13
|
+
private fiveElement?;
|
|
14
|
+
private mobileStartPoint;
|
|
15
|
+
private mobileNowPoint;
|
|
16
|
+
private highlightedLines;
|
|
17
|
+
private deleteDom;
|
|
18
|
+
/** 圆环点到上一个端点连接的虚线 */
|
|
19
|
+
private dashed;
|
|
20
|
+
constructor(params: IControllerParams);
|
|
21
|
+
dispose(): void;
|
|
22
|
+
highlightLine(line: Line): void;
|
|
23
|
+
clearHighlightLines(): void;
|
|
24
|
+
getEditingLines(): Line[];
|
|
25
|
+
/** 编辑线条发生改变时通知外部 */
|
|
26
|
+
private onLineChanged;
|
|
27
|
+
private onWantsTapGesture;
|
|
28
|
+
/** 编辑时取消走点,watch时可以走 */
|
|
29
|
+
private onWantsToMoveToPano;
|
|
30
|
+
/** 移动全景时更新 distanceItem 在屏幕上的位置 */
|
|
31
|
+
private onCameraUpdate;
|
|
32
|
+
/** mobile态时更新虚线 */
|
|
33
|
+
private updateMobileDashed;
|
|
34
|
+
/** mobile态时更新放大镜 */
|
|
35
|
+
private updateMagnifier;
|
|
36
|
+
private onGetStartPoint;
|
|
37
|
+
private onGetEndPoint;
|
|
38
|
+
private onNowPointChange;
|
|
39
|
+
private onWillChangeState;
|
|
40
|
+
private chooseLine;
|
|
41
|
+
private highlightLines;
|
|
42
|
+
private deleteDomClickCallback;
|
|
43
|
+
private cancelDeleteClickCallback;
|
|
44
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { Model } from '../Model';
|
|
2
|
+
import Line from '../Model/line';
|
|
3
|
+
import Point from '../Model/point';
|
|
4
|
+
import BaseController from './BaseController';
|
|
5
|
+
import DeleteDom from '../Modules/DeleteDom';
|
|
6
|
+
import { findAssociatedLines } from '../utils/findAssociatedLines';
|
|
7
|
+
import { Vector2 } from 'three';
|
|
8
|
+
import isNDCPointInScreen from '../utils/isNDCPointInScreen';
|
|
9
|
+
import { closestPointOnLine } from '../utils/math';
|
|
10
|
+
export default class MixedController extends BaseController {
|
|
11
|
+
constructor(params) {
|
|
12
|
+
super(params);
|
|
13
|
+
Object.defineProperty(this, "state", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: 'watching'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(this, "model", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: new Model({ userDistanceItemCreator: this.userDistanceItemCreator })
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(this, "hasAppendDashed", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: false
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(this, "fiveElement", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: void 0
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(this, "mobileStartPoint", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: null
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(this, "mobileNowPoint", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: null
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(this, "highlightedLines", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: []
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(this, "deleteDom", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: void 0
|
|
60
|
+
});
|
|
61
|
+
/** 圆环点到上一个端点连接的虚线 */
|
|
62
|
+
Object.defineProperty(this, "dashed", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
writable: true,
|
|
66
|
+
value: void 0
|
|
67
|
+
});
|
|
68
|
+
/** 编辑线条发生改变时通知外部 */
|
|
69
|
+
Object.defineProperty(this, "onLineChanged", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
configurable: true,
|
|
72
|
+
writable: true,
|
|
73
|
+
value: () => {
|
|
74
|
+
this.hook.emit('editedLineChange', this.model.lines.map((line) => line.toCompletelyJson()));
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(this, "onWantsTapGesture", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: (raycaster) => {
|
|
82
|
+
if (this.state === 'editing')
|
|
83
|
+
return false;
|
|
84
|
+
const [target] = this.five.model.intersectRaycaster(raycaster);
|
|
85
|
+
if (!target)
|
|
86
|
+
return;
|
|
87
|
+
const camera = this.five.camera;
|
|
88
|
+
const ndcTarget = target.point.clone().project(camera);
|
|
89
|
+
const screenWidth = this.container.clientWidth;
|
|
90
|
+
const screenHeight = this.container.clientHeight;
|
|
91
|
+
const targetScreenPosition = new Vector2(ndcTarget.x * screenWidth, ndcTarget.y * screenHeight);
|
|
92
|
+
// 把线的端点全部映射到屏幕上,过滤掉不在视野内的线,同时乘以屏幕宽 & 高
|
|
93
|
+
const screenLines = this.model.lines
|
|
94
|
+
.map((line) => {
|
|
95
|
+
const [startPoint, endPoint] = line.points;
|
|
96
|
+
const ndcStartPoint = startPoint.position.clone().project(camera);
|
|
97
|
+
const ndcEndPoint = endPoint.position.clone().project(camera);
|
|
98
|
+
if (!isNDCPointInScreen(ndcStartPoint) && !isNDCPointInScreen(ndcEndPoint))
|
|
99
|
+
return null;
|
|
100
|
+
const startScreenPosition = new Vector2(ndcStartPoint.x * screenWidth, ndcStartPoint.y * screenHeight);
|
|
101
|
+
const endScreenPosition = new Vector2(ndcEndPoint.x * screenWidth, ndcEndPoint.y * screenHeight);
|
|
102
|
+
return { id: line.id, points: [startScreenPosition, endScreenPosition] };
|
|
103
|
+
})
|
|
104
|
+
.filter((line) => !!line);
|
|
105
|
+
if (screenLines.length === 0)
|
|
106
|
+
return;
|
|
107
|
+
// 找这些线距离鼠标点击位置最近的线
|
|
108
|
+
const distanceLines = screenLines
|
|
109
|
+
.map((line) => {
|
|
110
|
+
const closestPoint = closestPointOnLine(targetScreenPosition, line.points);
|
|
111
|
+
return { id: line.id, distance: closestPoint.distanceTo(targetScreenPosition) };
|
|
112
|
+
})
|
|
113
|
+
.sort((a, b) => a.distance - b.distance);
|
|
114
|
+
const closestScreenLine = distanceLines[0];
|
|
115
|
+
if (closestScreenLine.distance > 20)
|
|
116
|
+
return;
|
|
117
|
+
const closestLine = this.model.lines.find(({ id }) => id === closestScreenLine.id);
|
|
118
|
+
if (!closestLine)
|
|
119
|
+
return;
|
|
120
|
+
this.chooseLine(closestLine);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
/** 编辑时取消走点,watch时可以走 */
|
|
125
|
+
Object.defineProperty(this, "onWantsToMoveToPano", {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
configurable: true,
|
|
128
|
+
writable: true,
|
|
129
|
+
value: () => this.state === 'watching'
|
|
130
|
+
});
|
|
131
|
+
/** 移动全景时更新 distanceItem 在屏幕上的位置 */
|
|
132
|
+
Object.defineProperty(this, "onCameraUpdate", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
configurable: true,
|
|
135
|
+
writable: true,
|
|
136
|
+
value: () => {
|
|
137
|
+
this.updateDistanceUI();
|
|
138
|
+
this.dashed.distanceItem.update(this.five);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
/** mobile态时更新虚线 */
|
|
142
|
+
Object.defineProperty(this, "updateMobileDashed", {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
configurable: true,
|
|
145
|
+
writable: true,
|
|
146
|
+
value: () => {
|
|
147
|
+
if (!this.mobileStartPoint || !this.mobileNowPoint)
|
|
148
|
+
return;
|
|
149
|
+
this.dashed.points[0].position.copy(this.mobileStartPoint.position);
|
|
150
|
+
this.dashed.points[1].position.copy(this.mobileNowPoint.position);
|
|
151
|
+
this.dashed.mesh.setPoints(this.mobileStartPoint.position, this.mobileNowPoint.position);
|
|
152
|
+
this.dashed.distanceItem.update(this.five);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
/** mobile态时更新放大镜 */
|
|
156
|
+
Object.defineProperty(this, "updateMagnifier", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
configurable: true,
|
|
159
|
+
writable: true,
|
|
160
|
+
value: (point) => {
|
|
161
|
+
if (this.magnifier.visible === false) {
|
|
162
|
+
this.magnifier.appendTo(this.container);
|
|
163
|
+
}
|
|
164
|
+
requestAnimationFrame(() => this.magnifier.renderWithPoint(point.position));
|
|
165
|
+
this.five.needsRender = true;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(this, "onGetStartPoint", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
configurable: true,
|
|
171
|
+
writable: true,
|
|
172
|
+
value: (point) => {
|
|
173
|
+
this.mobileStartPoint = point;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
Object.defineProperty(this, "onGetEndPoint", {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
configurable: true,
|
|
179
|
+
writable: true,
|
|
180
|
+
value: (point) => {
|
|
181
|
+
const endPoint = this.mobileNowPoint;
|
|
182
|
+
this.removeLine(this.dashed);
|
|
183
|
+
this.hasAppendDashed = false;
|
|
184
|
+
if (this.mobileStartPoint && endPoint) {
|
|
185
|
+
const line = new Line(this.mobileStartPoint, endPoint, this.model);
|
|
186
|
+
line.distanceItem.appendTo(this.container);
|
|
187
|
+
line.distanceItem.update(this.five);
|
|
188
|
+
line.hook.on('selected', this.chooseLine);
|
|
189
|
+
this.group.add(line.mesh);
|
|
190
|
+
this.model.addLine(line);
|
|
191
|
+
}
|
|
192
|
+
this.mobileStartPoint = null;
|
|
193
|
+
this.mobileNowPoint = null;
|
|
194
|
+
this.five.needsRender = true;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
Object.defineProperty(this, "onNowPointChange", {
|
|
198
|
+
enumerable: true,
|
|
199
|
+
configurable: true,
|
|
200
|
+
writable: true,
|
|
201
|
+
value: (point) => {
|
|
202
|
+
if (this.state === 'watching') {
|
|
203
|
+
this.mobileNowPoint = point;
|
|
204
|
+
this.updateMagnifier(point);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (!this.hasAppendDashed) {
|
|
208
|
+
this.dashed.distanceItem.appendTo(this.container);
|
|
209
|
+
this.group.add(this.dashed.mesh);
|
|
210
|
+
this.hasAppendDashed = true;
|
|
211
|
+
}
|
|
212
|
+
this.five.needsRender = true;
|
|
213
|
+
this.mobileNowPoint = point;
|
|
214
|
+
this.updateMobileDashed();
|
|
215
|
+
this.updateMagnifier(point);
|
|
216
|
+
this.five.needsRender = true;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
Object.defineProperty(this, "onWillChangeState", {
|
|
220
|
+
enumerable: true,
|
|
221
|
+
configurable: true,
|
|
222
|
+
writable: true,
|
|
223
|
+
value: (state, newState) => {
|
|
224
|
+
this.state = newState;
|
|
225
|
+
if (this.state === 'watching') {
|
|
226
|
+
this.five.helperVisible = true;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
// 隐藏点位和鼠标聚焦环
|
|
230
|
+
this.five.helperVisible = false;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
Object.defineProperty(this, "chooseLine", {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
configurable: true,
|
|
237
|
+
writable: true,
|
|
238
|
+
value: (line) => {
|
|
239
|
+
const highlightLines = findAssociatedLines(line);
|
|
240
|
+
this.highlightLines(highlightLines);
|
|
241
|
+
this.five.needsRender = true;
|
|
242
|
+
this.hook.emit('selectedChange', highlightLines.map((line) => line.toCompletelyJson()));
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
Object.defineProperty(this, "deleteDomClickCallback", {
|
|
246
|
+
enumerable: true,
|
|
247
|
+
configurable: true,
|
|
248
|
+
writable: true,
|
|
249
|
+
value: () => {
|
|
250
|
+
this.highlightedLines.forEach((line) => {
|
|
251
|
+
this.removeLine(line);
|
|
252
|
+
this.model.removeLine(line);
|
|
253
|
+
});
|
|
254
|
+
this.highlightedLines = [];
|
|
255
|
+
this.deleteDom.setLines([]).hide();
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
Object.defineProperty(this, "cancelDeleteClickCallback", {
|
|
259
|
+
enumerable: true,
|
|
260
|
+
configurable: true,
|
|
261
|
+
writable: true,
|
|
262
|
+
value: () => {
|
|
263
|
+
this.clearHighlightLines();
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
this.deleteDom = new DeleteDom(this.five, {
|
|
267
|
+
onClick: this.deleteDomClickCallback,
|
|
268
|
+
cancelDelete: this.cancelDeleteClickCallback,
|
|
269
|
+
}).appendTo(this.container);
|
|
270
|
+
// ==================== 虚线 ====================
|
|
271
|
+
this.dashed = new Line(new Point([0, 0, 0]), new Point([0, 0, 0]), this.model);
|
|
272
|
+
this.dashed.mesh.setMaterial({ dashed: true, dashScale: 100 });
|
|
273
|
+
this.dashed.mesh.name = 'dashLine';
|
|
274
|
+
// ==================== 事件监听 ====================
|
|
275
|
+
// five
|
|
276
|
+
this.five.on('cameraUpdate', this.onCameraUpdate);
|
|
277
|
+
this.five.on('wantsTapGesture', this.onWantsTapGesture);
|
|
278
|
+
this.five.on('wantsToMoveToPano', this.onWantsToMoveToPano);
|
|
279
|
+
// model
|
|
280
|
+
this.model.hook.on('lineAdded', this.onLineChanged);
|
|
281
|
+
this.model.hook.on('lineRemoved', this.onLineChanged);
|
|
282
|
+
// ==================== 其他 ====================
|
|
283
|
+
this.hook.on('getStartPoint', this.onGetStartPoint);
|
|
284
|
+
this.hook.on('getEndPoint', this.onGetEndPoint);
|
|
285
|
+
this.hook.on('nowPointChange', this.onNowPointChange);
|
|
286
|
+
this.hook.on('willChangeState', this.onWillChangeState);
|
|
287
|
+
this.five.refresh();
|
|
288
|
+
}
|
|
289
|
+
dispose() {
|
|
290
|
+
super.dispose();
|
|
291
|
+
this.group.remove(this.mouseGroup, this.dashed.mesh);
|
|
292
|
+
// ==================== 解除事件监听 ====================
|
|
293
|
+
// five
|
|
294
|
+
this.five.off('cameraUpdate', this.onCameraUpdate);
|
|
295
|
+
this.five.off('wantsTapGesture', this.onWantsTapGesture);
|
|
296
|
+
this.five.off('wantsToMoveToPano', this.onWantsToMoveToPano);
|
|
297
|
+
// model
|
|
298
|
+
this.model.hook.off('lineAdded', this.onLineChanged);
|
|
299
|
+
this.model.hook.off('lineRemoved', this.onLineChanged);
|
|
300
|
+
this.hook.off('getStartPoint', this.onGetStartPoint);
|
|
301
|
+
this.hook.off('getEndPoint', this.onGetEndPoint);
|
|
302
|
+
this.hook.off('nowPointChange', this.onNowPointChange);
|
|
303
|
+
this.hook.off('willChangeState', this.onWillChangeState);
|
|
304
|
+
this.hook.emit('selectedChange', []);
|
|
305
|
+
this.dashed.distanceItem.remove();
|
|
306
|
+
this.five.needsRender = true;
|
|
307
|
+
}
|
|
308
|
+
highlightLine(line) {
|
|
309
|
+
if (line.selected)
|
|
310
|
+
return;
|
|
311
|
+
line.selected = true;
|
|
312
|
+
this.group.add(line.lightMesh);
|
|
313
|
+
line.distanceItem.highlight();
|
|
314
|
+
this.five.needsRender = true;
|
|
315
|
+
}
|
|
316
|
+
clearHighlightLines() {
|
|
317
|
+
if (this.group.children.length === 0)
|
|
318
|
+
return;
|
|
319
|
+
this.deleteDom.setLines([]).hide();
|
|
320
|
+
this.model.lines.forEach((line) => {
|
|
321
|
+
line.selected = false;
|
|
322
|
+
line.distanceItem.unHighlight();
|
|
323
|
+
this.group.remove(line.lightMesh);
|
|
324
|
+
});
|
|
325
|
+
this.highlightedLines = [];
|
|
326
|
+
this.five.needsRender = true;
|
|
327
|
+
}
|
|
328
|
+
getEditingLines() {
|
|
329
|
+
return this.model.lines;
|
|
330
|
+
}
|
|
331
|
+
highlightLines(lines) {
|
|
332
|
+
this.clearHighlightLines();
|
|
333
|
+
this.highlightedLines = lines;
|
|
334
|
+
this.deleteDom.setLines(lines).updatePosition().show();
|
|
335
|
+
lines.forEach((line) => this.highlightLine(line));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
@@ -87,7 +87,7 @@ export default class WatchController extends BaseController {
|
|
|
87
87
|
// 还原选中态
|
|
88
88
|
this.highlightLines(this.editPointState.associatedLines);
|
|
89
89
|
this.editPointState = undefined;
|
|
90
|
-
this.magnifier.
|
|
90
|
+
this.magnifier.remove();
|
|
91
91
|
this.group.remove(this.mouseGroup);
|
|
92
92
|
}
|
|
93
93
|
});
|
|
@@ -124,7 +124,7 @@ export default class WatchController extends BaseController {
|
|
|
124
124
|
line.mesh.setMaterial({ dashed: true });
|
|
125
125
|
});
|
|
126
126
|
this.updateDistanceUI();
|
|
127
|
-
this.magnifier.
|
|
127
|
+
this.magnifier.renderWithPoint(intersection.point);
|
|
128
128
|
this.mouseGroup.position.copy(intersection.point);
|
|
129
129
|
if (mesh) {
|
|
130
130
|
this.mouseGroup.quaternion.copy(mesh.quaternion);
|
|
@@ -242,7 +242,18 @@ export default class WatchController extends BaseController {
|
|
|
242
242
|
this.deleteDom.setLines([]).hide();
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
|
-
|
|
245
|
+
Object.defineProperty(this, "cancelDeleteClickCallback", {
|
|
246
|
+
enumerable: true,
|
|
247
|
+
configurable: true,
|
|
248
|
+
writable: true,
|
|
249
|
+
value: () => {
|
|
250
|
+
this.clearHighlightLines();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
this.deleteDom = new DeleteDom(this.five, {
|
|
254
|
+
onClick: this.deleteDomClickCallback,
|
|
255
|
+
cancelDelete: this.cancelDeleteClickCallback,
|
|
256
|
+
}).appendTo(this.container);
|
|
246
257
|
this.model.lines.forEach((line) => {
|
|
247
258
|
line.distanceItem.appendTo(this.container);
|
|
248
259
|
line.distanceItem.update(this.five);
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import type { PluginData } from '../typings/data';
|
|
2
|
-
import type {
|
|
1
|
+
import type { OpenParameter, PluginData } from '../typings/data';
|
|
2
|
+
import type { PanoMeasurePluginEvent } from '../typings/event.type';
|
|
3
3
|
import type { UserDistanceItem } from '../utils/distanceDom';
|
|
4
|
+
import Magnifier, { MagnifierParameter } from '../Modules/Magnifier';
|
|
4
5
|
import { Five, Subscribe } from '@realsee/five';
|
|
5
|
-
export declare type Mode = 'Watch' | 'Edit';
|
|
6
|
-
export interface
|
|
6
|
+
export declare type Mode = 'Watch' | 'Edit' | 'Mixed';
|
|
7
|
+
export interface PanoMeasureParameterType {
|
|
8
|
+
openParams?: OpenParameter;
|
|
9
|
+
magnifierParams?: MagnifierParameter;
|
|
7
10
|
useUIController?: boolean;
|
|
8
11
|
useGuideController?: boolean;
|
|
9
12
|
userDistanceItemCreator?: () => UserDistanceItem;
|
|
10
13
|
}
|
|
11
14
|
export default class MeasureController {
|
|
12
15
|
hasOpen: boolean;
|
|
13
|
-
hook: Subscribe<
|
|
16
|
+
hook: Subscribe<PanoMeasurePluginEvent>;
|
|
17
|
+
magnifier: Magnifier;
|
|
14
18
|
private five;
|
|
15
19
|
private model;
|
|
16
20
|
private group;
|
|
17
|
-
private magnifier;
|
|
18
21
|
private fiveHelper;
|
|
19
22
|
private useUIController?;
|
|
20
23
|
private params;
|
|
21
24
|
private useGuideController?;
|
|
25
|
+
private rangePieceController?;
|
|
22
26
|
private container;
|
|
23
27
|
private shortcutKeyController?;
|
|
24
28
|
private controller;
|
|
25
29
|
private controllerParams;
|
|
26
|
-
constructor(five: Five, params:
|
|
30
|
+
constructor(five: Five, params: PanoMeasureParameterType);
|
|
27
31
|
appendTo(parent: HTMLElement): void;
|
|
28
32
|
dispose(): void;
|
|
29
33
|
/** 加载数据
|
|
@@ -45,7 +49,7 @@ export default class MeasureController {
|
|
|
45
49
|
/** 变更场景
|
|
46
50
|
* @description 如果从编辑场景改变到观看场景,不会自动保存,默认丢弃所有改动
|
|
47
51
|
*/
|
|
48
|
-
changeMode: (mode: Mode) =>
|
|
52
|
+
changeMode: (mode: Mode) => Error;
|
|
49
53
|
/** 撤销编辑 */
|
|
50
54
|
revoke(): void;
|
|
51
55
|
removeLineByID(lineID: string): void;
|
|
@@ -58,4 +62,9 @@ export default class MeasureController {
|
|
|
58
62
|
save(): this;
|
|
59
63
|
/** 把当前以保存的数据转换成 JSON 对象 */
|
|
60
64
|
toJson(): PluginData;
|
|
65
|
+
/**
|
|
66
|
+
* @description 改变插件的模式(pc端模式或移动端模式)
|
|
67
|
+
* @param isMobile true为移动端模式,false为pc端
|
|
68
|
+
*/
|
|
69
|
+
changeIsMobile(isMobile: boolean): void;
|
|
61
70
|
}
|
|
@@ -2,6 +2,7 @@ import Magnifier from '../Modules/Magnifier';
|
|
|
2
2
|
import FiveHelper from '../Modules/FiveHelper';
|
|
3
3
|
import EditController from './EditController';
|
|
4
4
|
import WatchController from './WatchController';
|
|
5
|
+
import MixedController from './MixedController';
|
|
5
6
|
import { Group } from 'three';
|
|
6
7
|
import { Model } from '../Model';
|
|
7
8
|
import { Subscribe } from '@realsee/five';
|
|
@@ -9,8 +10,10 @@ import { getMouseGroup } from '../utils/mouseGroup';
|
|
|
9
10
|
import { UIController } from '../Modules/UIController';
|
|
10
11
|
import { GuideController } from '../Modules/GuideController';
|
|
11
12
|
import { ShortcutKeyController } from './ShortcutKeyController';
|
|
13
|
+
import RangePieceController from '../Modules/rangePiece';
|
|
12
14
|
export default class MeasureController {
|
|
13
15
|
constructor(five, params) {
|
|
16
|
+
var _a, _b;
|
|
14
17
|
Object.defineProperty(this, "hasOpen", {
|
|
15
18
|
enumerable: true,
|
|
16
19
|
configurable: true,
|
|
@@ -23,25 +26,25 @@ export default class MeasureController {
|
|
|
23
26
|
writable: true,
|
|
24
27
|
value: new Subscribe()
|
|
25
28
|
});
|
|
26
|
-
Object.defineProperty(this, "
|
|
29
|
+
Object.defineProperty(this, "magnifier", {
|
|
27
30
|
enumerable: true,
|
|
28
31
|
configurable: true,
|
|
29
32
|
writable: true,
|
|
30
33
|
value: void 0
|
|
31
34
|
});
|
|
32
|
-
Object.defineProperty(this, "
|
|
35
|
+
Object.defineProperty(this, "five", {
|
|
33
36
|
enumerable: true,
|
|
34
37
|
configurable: true,
|
|
35
38
|
writable: true,
|
|
36
39
|
value: void 0
|
|
37
40
|
});
|
|
38
|
-
Object.defineProperty(this, "
|
|
41
|
+
Object.defineProperty(this, "model", {
|
|
39
42
|
enumerable: true,
|
|
40
43
|
configurable: true,
|
|
41
44
|
writable: true,
|
|
42
45
|
value: void 0
|
|
43
46
|
});
|
|
44
|
-
Object.defineProperty(this, "
|
|
47
|
+
Object.defineProperty(this, "group", {
|
|
45
48
|
enumerable: true,
|
|
46
49
|
configurable: true,
|
|
47
50
|
writable: true,
|
|
@@ -71,6 +74,12 @@ export default class MeasureController {
|
|
|
71
74
|
writable: true,
|
|
72
75
|
value: void 0
|
|
73
76
|
});
|
|
77
|
+
Object.defineProperty(this, "rangePieceController", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: void 0
|
|
82
|
+
});
|
|
74
83
|
Object.defineProperty(this, "container", {
|
|
75
84
|
enumerable: true,
|
|
76
85
|
configurable: true,
|
|
@@ -104,6 +113,8 @@ export default class MeasureController {
|
|
|
104
113
|
return 'Edit';
|
|
105
114
|
if (this.controller instanceof WatchController)
|
|
106
115
|
return 'Watch';
|
|
116
|
+
if (this.controller instanceof MixedController)
|
|
117
|
+
return 'Mixed';
|
|
107
118
|
return null;
|
|
108
119
|
}
|
|
109
120
|
});
|
|
@@ -120,6 +131,9 @@ export default class MeasureController {
|
|
|
120
131
|
return;
|
|
121
132
|
if (this.getCurrentMode() === mode)
|
|
122
133
|
return;
|
|
134
|
+
// 不支持Mixed模式与其他模式切换
|
|
135
|
+
if (this.getCurrentMode() === 'Mixed' || mode === 'Mixed')
|
|
136
|
+
return new Error('不支持切换的Mode');
|
|
123
137
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
124
138
|
const controllerMap = {
|
|
125
139
|
Watch: WatchController,
|
|
@@ -136,9 +150,7 @@ export default class MeasureController {
|
|
|
136
150
|
this.model = new Model({ userDistanceItemCreator: this.params.userDistanceItemCreator });
|
|
137
151
|
this.fiveHelper = new FiveHelper(five);
|
|
138
152
|
// magnifier
|
|
139
|
-
|
|
140
|
-
const magnifierScale = 2;
|
|
141
|
-
this.magnifier = new Magnifier(five, { scale: magnifierScale, width: magnifierSize, height: magnifierSize });
|
|
153
|
+
this.magnifier = new Magnifier(five, (_a = params.magnifierParams) !== null && _a !== void 0 ? _a : { width: 190, height: 190, scale: 2 });
|
|
142
154
|
// ==================== Group ====================
|
|
143
155
|
this.group = new Group();
|
|
144
156
|
this.group.name = 'plugin-measure-group';
|
|
@@ -149,6 +161,7 @@ export default class MeasureController {
|
|
|
149
161
|
this.container.style.height = '100%';
|
|
150
162
|
this.container.style.opacity = '0';
|
|
151
163
|
this.container.style.background = 'rgba(0, 0, 0, 0.15)';
|
|
164
|
+
const openParams = (_b = this.params.openParams) !== null && _b !== void 0 ? _b : {};
|
|
152
165
|
this.controllerParams = {
|
|
153
166
|
five: this.five,
|
|
154
167
|
hook: this.hook,
|
|
@@ -157,15 +170,18 @@ export default class MeasureController {
|
|
|
157
170
|
magnifier: this.magnifier,
|
|
158
171
|
container: this.container,
|
|
159
172
|
fiveHelper: this.fiveHelper,
|
|
173
|
+
openParams,
|
|
160
174
|
mouseGroup: getMouseGroup(),
|
|
161
175
|
userDistanceItemCreator: this.params.userDistanceItemCreator,
|
|
162
176
|
};
|
|
163
177
|
if (this.params.useUIController !== false)
|
|
164
178
|
this.useUIController = new UIController(this, this.controllerParams);
|
|
165
|
-
if (this.params.
|
|
179
|
+
if (this.params.useGuideController !== false)
|
|
166
180
|
this.useGuideController = new GuideController(this, this.controllerParams);
|
|
167
181
|
}
|
|
168
182
|
appendTo(parent) {
|
|
183
|
+
// const intersect = new IntersectController(this.five)
|
|
184
|
+
// intersect.appendTo(parent)
|
|
169
185
|
parent.append(this.container);
|
|
170
186
|
}
|
|
171
187
|
dispose() {
|
|
@@ -188,18 +204,24 @@ export default class MeasureController {
|
|
|
188
204
|
* @description 会隐藏当前 VR 内的点位展示
|
|
189
205
|
*/
|
|
190
206
|
enable() {
|
|
191
|
-
var _a, _b;
|
|
207
|
+
var _a, _b, _c;
|
|
192
208
|
if (this.hasOpen)
|
|
193
209
|
return;
|
|
194
210
|
this.hasOpen = true;
|
|
195
211
|
this.five.scene.add(this.group);
|
|
196
212
|
// 修改透明度
|
|
197
213
|
this.container.style.opacity = '1';
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
214
|
+
if ((_a = this.params.openParams) === null || _a === void 0 ? void 0 : _a.isMobile) {
|
|
215
|
+
this.controller = new MixedController(this.controllerParams);
|
|
216
|
+
this.rangePieceController = new RangePieceController(this.controllerParams);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
// 隐藏点位和鼠标聚焦环
|
|
220
|
+
this.five.helperVisible = false;
|
|
221
|
+
this.controller = new WatchController(this.controllerParams);
|
|
222
|
+
}
|
|
223
|
+
(_b = this.useUIController) === null || _b === void 0 ? void 0 : _b.show();
|
|
224
|
+
(_c = this.useGuideController) === null || _c === void 0 ? void 0 : _c.show();
|
|
203
225
|
this.shortcutKeyController = new ShortcutKeyController(this, this.five);
|
|
204
226
|
this.hook.emit('enable', true);
|
|
205
227
|
}
|
|
@@ -208,15 +230,16 @@ export default class MeasureController {
|
|
|
208
230
|
* @description 还原点位展示和默认鼠标 UI
|
|
209
231
|
*/
|
|
210
232
|
disable() {
|
|
211
|
-
var _a, _b, _c, _d;
|
|
233
|
+
var _a, _b, _c, _d, _e;
|
|
212
234
|
this.hasOpen = false;
|
|
213
235
|
// 修改透明度
|
|
214
236
|
this.container.style.opacity = '0';
|
|
215
237
|
// 展示点位和鼠标聚焦环
|
|
216
238
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
217
|
-
(_b = this.
|
|
218
|
-
(_c = this.
|
|
219
|
-
(_d = this.
|
|
239
|
+
(_b = this.rangePieceController) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
240
|
+
(_c = this.useUIController) === null || _c === void 0 ? void 0 : _c.hide();
|
|
241
|
+
(_d = this.useGuideController) === null || _d === void 0 ? void 0 : _d.hide();
|
|
242
|
+
(_e = this.shortcutKeyController) === null || _e === void 0 ? void 0 : _e.dispose();
|
|
220
243
|
this.controller = null;
|
|
221
244
|
this.five.helperVisible = true;
|
|
222
245
|
this.five.scene.remove(this.group);
|
|
@@ -262,4 +285,20 @@ export default class MeasureController {
|
|
|
262
285
|
toJson() {
|
|
263
286
|
return this.model.toJson();
|
|
264
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* @description 改变插件的模式(pc端模式或移动端模式)
|
|
290
|
+
* @param isMobile true为移动端模式,false为pc端
|
|
291
|
+
*/
|
|
292
|
+
changeIsMobile(isMobile) {
|
|
293
|
+
var _a, _b;
|
|
294
|
+
if (((_a = this.controllerParams.openParams) === null || _a === void 0 ? void 0 : _a.isMobile) === undefined) {
|
|
295
|
+
this.controllerParams.openParams.isMobile = isMobile;
|
|
296
|
+
}
|
|
297
|
+
if (this.controllerParams.openParams.isMobile === isMobile)
|
|
298
|
+
return;
|
|
299
|
+
this.controllerParams.openParams.isMobile = isMobile;
|
|
300
|
+
if (this.params.useUIController !== false)
|
|
301
|
+
(_b = this.useUIController) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
302
|
+
this.useUIController = new UIController(this, this.controllerParams);
|
|
303
|
+
}
|
|
265
304
|
}
|