@realsee/dnalogel 2.0.0-alpha.39 → 2.0.0-alpha.41
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/dist/ItemLabelPlugin/index.js +2 -4
- package/dist/PanoMeasurePlugin/Controller/ViewController.d.ts +16 -0
- package/dist/PanoMeasurePlugin/Controller/index.d.ts +1 -1
- package/dist/PanoMeasurePlugin/index.js +232 -75
- package/dist/PanoMeasurePlugin/utils/constants.d.ts +4 -4
- package/dist/PanoMeasurePlugin/utils/distanceDom.d.ts +2 -2
- package/dist/PanoMeasurePlugin/utils/line.d.ts +3 -3
- package/dist/index.es.js +236 -81
- package/dist/index.js +236 -81
- package/dist/index.umd.js +236 -81
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- 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 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +1 -1
- package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- 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 +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- 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 +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- package/docs/interfaces/ItemLabelPluginData.html +1 -1
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
- 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/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 +2 -2
- 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/PanoMeasureParameterType.html +1 -1
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginState.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/modules.html +18 -18
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +2 -4
- package/libs/PanoMeasurePlugin/Controller/ViewController.d.ts +16 -0
- package/libs/PanoMeasurePlugin/Controller/ViewController.js +160 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +1 -0
- package/libs/PanoMeasurePlugin/Controller/index.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Controller/index.js +2 -0
- package/libs/PanoMeasurePlugin/Model/line.js +5 -5
- package/libs/PanoMeasurePlugin/utils/constants.d.ts +4 -4
- package/libs/PanoMeasurePlugin/utils/distanceDom.d.ts +2 -2
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -3
- package/libs/PanoMeasurePlugin/utils/line.d.ts +3 -3
- package/libs/PanoMeasurePlugin/utils/line.js +3 -3
- package/package.json +2 -2
|
@@ -45,7 +45,7 @@ function get_each_context(ctx, list, i) {
|
|
|
45
45
|
return child_ctx;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// (
|
|
48
|
+
// (234:2) {#if itemLabelItem.visible}
|
|
49
49
|
function create_if_block(ctx) {
|
|
50
50
|
let itemlabelitem;
|
|
51
51
|
let current;
|
|
@@ -89,7 +89,7 @@ function create_if_block(ctx) {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
// (
|
|
92
|
+
// (233:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
93
93
|
function create_each_block(key_1, ctx) {
|
|
94
94
|
let first;
|
|
95
95
|
let if_block_anchor;
|
|
@@ -324,8 +324,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
324
324
|
};
|
|
325
325
|
|
|
326
326
|
const getFormatedItemLabels = (five, labels) => {
|
|
327
|
-
console.log(labels);
|
|
328
|
-
|
|
329
327
|
// 计算位置 & 可见性
|
|
330
328
|
const newLabels = labels.map(label => {
|
|
331
329
|
// 不在绑定点位则直接不可见
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type Line from '../Model/line';
|
|
2
|
+
import BaseController, { IControllerParams } from './BaseController';
|
|
3
|
+
export default class ViewController extends BaseController {
|
|
4
|
+
type: string;
|
|
5
|
+
private highlightedLines;
|
|
6
|
+
private hammer?;
|
|
7
|
+
constructor(params: IControllerParams);
|
|
8
|
+
dispose(): void;
|
|
9
|
+
highlightLine(line: Line): void;
|
|
10
|
+
clearHighlightLines(): void;
|
|
11
|
+
private wantsTapGesture;
|
|
12
|
+
private chooseLine;
|
|
13
|
+
private highlightLines;
|
|
14
|
+
private lineRemoved;
|
|
15
|
+
private onCameraUpdate;
|
|
16
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import Hammer from 'hammerjs';
|
|
2
|
+
import { Vector2 } from 'three';
|
|
3
|
+
import { closestPointOnLine } from '../utils/math';
|
|
4
|
+
import isNDCPointInScreen from '../utils/isNDCPointInScreen';
|
|
5
|
+
import { findAssociatedLines } from '../utils/findAssociatedLines';
|
|
6
|
+
import BaseController from './BaseController';
|
|
7
|
+
export default class ViewController extends BaseController {
|
|
8
|
+
constructor(params) {
|
|
9
|
+
super(params);
|
|
10
|
+
Object.defineProperty(this, "type", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: 'view'
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "highlightedLines", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: []
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "hammer", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: void 0
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "wantsTapGesture", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: (raycaster) => {
|
|
33
|
+
// 不存在线
|
|
34
|
+
if (this.model.lines.length === 0)
|
|
35
|
+
return;
|
|
36
|
+
const [target] = this.five.model.intersectRaycaster(raycaster);
|
|
37
|
+
// 点击射线与模型没有交点
|
|
38
|
+
if (!target)
|
|
39
|
+
return;
|
|
40
|
+
const camera = this.five.camera;
|
|
41
|
+
const ndcTarget = target.point.clone().project(camera);
|
|
42
|
+
const screenWidth = this.container.clientWidth;
|
|
43
|
+
const screenHeight = this.container.clientHeight;
|
|
44
|
+
const targetScreenPosition = new Vector2(ndcTarget.x * screenWidth, ndcTarget.y * screenHeight);
|
|
45
|
+
// 把线的端点全部映射到屏幕上,过滤掉不在视野内的线,同时乘以屏幕宽 & 高
|
|
46
|
+
const screenLines = this.model.lines
|
|
47
|
+
.map((line) => {
|
|
48
|
+
const [startPoint, endPoint] = line.points;
|
|
49
|
+
const ndcStartPoint = startPoint.position.clone().project(camera);
|
|
50
|
+
const ndcEndPoint = endPoint.position.clone().project(camera);
|
|
51
|
+
if (!isNDCPointInScreen(ndcStartPoint) && !isNDCPointInScreen(ndcEndPoint))
|
|
52
|
+
return null;
|
|
53
|
+
const startScreenPosition = new Vector2(ndcStartPoint.x * screenWidth, ndcStartPoint.y * screenHeight);
|
|
54
|
+
const endScreenPosition = new Vector2(ndcEndPoint.x * screenWidth, ndcEndPoint.y * screenHeight);
|
|
55
|
+
return { id: line.id, points: [startScreenPosition, endScreenPosition] };
|
|
56
|
+
})
|
|
57
|
+
.filter((line) => !!line);
|
|
58
|
+
if (screenLines.length === 0)
|
|
59
|
+
return;
|
|
60
|
+
// 找这些线距离鼠标点击位置最近的线
|
|
61
|
+
const distanceLines = screenLines
|
|
62
|
+
.map((line) => {
|
|
63
|
+
const closestPoint = closestPointOnLine(targetScreenPosition, line.points);
|
|
64
|
+
return { id: line.id, distance: closestPoint.distanceTo(targetScreenPosition) };
|
|
65
|
+
})
|
|
66
|
+
.sort((a, b) => a.distance - b.distance);
|
|
67
|
+
const closestScreenLine = distanceLines[0];
|
|
68
|
+
const closestLine = closestScreenLine.distance > 20
|
|
69
|
+
? undefined
|
|
70
|
+
: this.model.lines.find(({ id }) => id === closestScreenLine.id);
|
|
71
|
+
if (this.highlightedLines.length > 0 && !closestLine) {
|
|
72
|
+
this.clearHighlightLines();
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (closestLine) {
|
|
76
|
+
this.chooseLine(closestLine);
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(this, "chooseLine", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
configurable: true,
|
|
84
|
+
writable: true,
|
|
85
|
+
value: (line) => {
|
|
86
|
+
const highlightLines = findAssociatedLines(line);
|
|
87
|
+
this.highlightLines(highlightLines);
|
|
88
|
+
this.five.needsRender = true;
|
|
89
|
+
this.hook.emit('selectedChange', highlightLines.map((line) => line.toCompletelyJson()));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(this, "lineRemoved", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
configurable: true,
|
|
95
|
+
writable: true,
|
|
96
|
+
value: (line) => {
|
|
97
|
+
this.removeLine(line);
|
|
98
|
+
// TODO: 这个逻辑不太好,改进一下
|
|
99
|
+
this.hook.emit('selectedChange', this.model.lines.filter((line) => line.selected).map((line) => line.toCompletelyJson()));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(this, "onCameraUpdate", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
configurable: true,
|
|
105
|
+
writable: true,
|
|
106
|
+
value: () => {
|
|
107
|
+
this.updateDistanceUI();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
this.model.lines.forEach((line) => {
|
|
111
|
+
line.distanceItem.appendTo(this.container);
|
|
112
|
+
line.distanceItem.update(this.five);
|
|
113
|
+
line.hook.on('selected', this.chooseLine);
|
|
114
|
+
this.group.add(line.mesh);
|
|
115
|
+
});
|
|
116
|
+
const fiveElement = this.five.getElement();
|
|
117
|
+
if (fiveElement) {
|
|
118
|
+
const hammer = new Hammer(fiveElement);
|
|
119
|
+
this.hammer = hammer;
|
|
120
|
+
}
|
|
121
|
+
this.model.hook.on('lineRemoved', this.lineRemoved);
|
|
122
|
+
this.five.on('cameraUpdate', this.onCameraUpdate);
|
|
123
|
+
this.five.on('wantsTapGesture', this.wantsTapGesture);
|
|
124
|
+
this.five.needsRender = true;
|
|
125
|
+
}
|
|
126
|
+
dispose() {
|
|
127
|
+
var _a;
|
|
128
|
+
super.dispose();
|
|
129
|
+
this.model.hook.off('lineRemoved', this.lineRemoved);
|
|
130
|
+
this.five.off('cameraUpdate', this.onCameraUpdate);
|
|
131
|
+
this.five.off('wantsTapGesture', this.wantsTapGesture);
|
|
132
|
+
this.five.needsRender = true;
|
|
133
|
+
this.hook.emit('selectedChange', []);
|
|
134
|
+
(_a = this.hammer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
135
|
+
}
|
|
136
|
+
highlightLine(line) {
|
|
137
|
+
if (line.selected)
|
|
138
|
+
return;
|
|
139
|
+
line.selected = true;
|
|
140
|
+
this.group.add(line.lightMesh);
|
|
141
|
+
line.distanceItem.highlight();
|
|
142
|
+
this.five.needsRender = true;
|
|
143
|
+
}
|
|
144
|
+
clearHighlightLines() {
|
|
145
|
+
if (this.group.children.length === 0)
|
|
146
|
+
return;
|
|
147
|
+
this.model.lines.forEach((line) => {
|
|
148
|
+
line.selected = false;
|
|
149
|
+
line.distanceItem.unHighlight();
|
|
150
|
+
this.group.remove(line.lightMesh);
|
|
151
|
+
});
|
|
152
|
+
this.highlightedLines = [];
|
|
153
|
+
this.five.needsRender = true;
|
|
154
|
+
}
|
|
155
|
+
highlightLines(lines) {
|
|
156
|
+
this.clearHighlightLines();
|
|
157
|
+
this.highlightedLines = lines;
|
|
158
|
+
lines.forEach((line) => this.highlightLine(line));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -280,6 +280,7 @@ export default class WatchController extends BaseController {
|
|
|
280
280
|
super.dispose();
|
|
281
281
|
this.deleteDom.dispose();
|
|
282
282
|
this.model.hook.off('lineRemoved', this.lineRemoved);
|
|
283
|
+
this.model.lines.forEach((line) => line.hook.off('selected', this.chooseLine));
|
|
283
284
|
this.five.off('cameraUpdate', this.onCameraUpdate);
|
|
284
285
|
this.five.off('wantsPanGesture', this.wantsPanGesture);
|
|
285
286
|
this.five.off('wantsTapGesture', this.wantsTapGesture);
|
|
@@ -3,7 +3,7 @@ import type { PanoMeasurePluginEvent } from '../typings/event.type';
|
|
|
3
3
|
import type { UserDistanceItem } from '../utils/distanceDom';
|
|
4
4
|
import Magnifier, { MagnifierParameter } from '../Modules/Magnifier';
|
|
5
5
|
import { Five, Subscribe } from '@realsee/five';
|
|
6
|
-
export declare type Mode = 'Watch' | 'Edit' | 'Mixed';
|
|
6
|
+
export declare type Mode = 'Watch' | 'Edit' | 'Mixed' | 'View';
|
|
7
7
|
export interface PanoMeasureParameterType {
|
|
8
8
|
openParams?: OpenParameter;
|
|
9
9
|
magnifierParams?: MagnifierParameter;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Magnifier from '../Modules/Magnifier';
|
|
2
2
|
import FiveHelper from '../Modules/FiveHelper';
|
|
3
3
|
import EditController from './EditController';
|
|
4
|
+
import ViewController from './ViewController';
|
|
4
5
|
import WatchController from './WatchController';
|
|
5
6
|
import MixedController from './MixedController';
|
|
6
7
|
import { Group } from 'three';
|
|
@@ -136,6 +137,7 @@ export default class MeasureController {
|
|
|
136
137
|
return new Error('不支持切换的Mode');
|
|
137
138
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
138
139
|
const controllerMap = {
|
|
140
|
+
View: ViewController,
|
|
139
141
|
Watch: WatchController,
|
|
140
142
|
Edit: EditController,
|
|
141
143
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import uuid from '../../shared-utils/uuid';
|
|
2
2
|
import { Polyline } from './polyline';
|
|
3
|
-
import {
|
|
3
|
+
import { createLineMesh } from '../utils/line';
|
|
4
4
|
import { Subscribe } from '@realsee/five';
|
|
5
|
-
import {
|
|
5
|
+
import { createDistanceItem } from '../utils/distanceDom';
|
|
6
6
|
export default class Line {
|
|
7
7
|
constructor(point, anotherPoint, model) {
|
|
8
8
|
Object.defineProperty(this, "id", {
|
|
@@ -71,9 +71,9 @@ export default class Line {
|
|
|
71
71
|
throw new Error('无效的线段, 一个点无法构成线段');
|
|
72
72
|
this.hook = new Subscribe();
|
|
73
73
|
this.points = [point, anotherPoint];
|
|
74
|
-
this.mesh =
|
|
75
|
-
this.lightMesh =
|
|
76
|
-
this.distanceItem =
|
|
74
|
+
this.mesh = createLineMesh(this, 'normal');
|
|
75
|
+
this.lightMesh = createLineMesh(this, 'light');
|
|
76
|
+
this.distanceItem = createDistanceItem({
|
|
77
77
|
line: this,
|
|
78
78
|
clickCallback: () => this.hook.emit('selected', this),
|
|
79
79
|
userDistanceItem: this.model.params.userDistanceItemCreator
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const normalLineOpts:
|
|
3
|
-
export declare const dashLineOpts:
|
|
4
|
-
export declare const lightLineOpts:
|
|
1
|
+
import type { ICreateLineOpts } from './line';
|
|
2
|
+
export declare const normalLineOpts: ICreateLineOpts;
|
|
3
|
+
export declare const dashLineOpts: ICreateLineOpts;
|
|
4
|
+
export declare const lightLineOpts: ICreateLineOpts;
|
|
@@ -2,7 +2,7 @@ import type Line from '../Model/line';
|
|
|
2
2
|
import type { Five } from '@realsee/five';
|
|
3
3
|
import type { LineCompletelyJson, PolylineCompletelyJson } from '../typings/data';
|
|
4
4
|
import { Vector3 } from 'three';
|
|
5
|
-
export declare type DistanceItem = ReturnType<typeof
|
|
5
|
+
export declare type DistanceItem = ReturnType<typeof createDistanceItem>;
|
|
6
6
|
export interface UserDistanceItem {
|
|
7
7
|
element: Element;
|
|
8
8
|
highlight: () => void;
|
|
@@ -17,7 +17,7 @@ export interface IDistanceItemProps {
|
|
|
17
17
|
userDistanceItem?: UserDistanceItem;
|
|
18
18
|
clickCallback?: (item: DistanceItem) => unknown;
|
|
19
19
|
}
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function createDistanceItem(props: IDistanceItemProps): {
|
|
21
21
|
lineID: string;
|
|
22
22
|
ndcPosition: Vector3;
|
|
23
23
|
update: (five: Five) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector2, Vector3 } from 'three';
|
|
2
2
|
import isNDCPointInScreen from './isNDCPointInScreen';
|
|
3
|
-
function
|
|
3
|
+
function createContentDom() {
|
|
4
4
|
const contentDom = document.createElement('div');
|
|
5
5
|
contentDom.setAttribute('style', `backdrop-filter: blur(4px);-webkit-backdrop-filter: blur(4px);`);
|
|
6
6
|
contentDom.style.padding = '3px 6px';
|
|
@@ -28,7 +28,7 @@ function createContainerDom(line) {
|
|
|
28
28
|
containerDom.style.transformOrigin = 'left top';
|
|
29
29
|
return containerDom;
|
|
30
30
|
}
|
|
31
|
-
export function
|
|
31
|
+
export function createDistanceItem(props) {
|
|
32
32
|
function handleClick() {
|
|
33
33
|
var _a;
|
|
34
34
|
// 线被选中时才高亮,外部手动触发高亮
|
|
@@ -102,7 +102,7 @@ export function creatDistanceItem(props) {
|
|
|
102
102
|
}
|
|
103
103
|
const { line } = props;
|
|
104
104
|
const lineID = line.id;
|
|
105
|
-
const contentDom =
|
|
105
|
+
const contentDom = createContentDom();
|
|
106
106
|
const containerDom = createContainerDom(line);
|
|
107
107
|
const userDistanceItem = props.userDistanceItem;
|
|
108
108
|
const ndcPosition = new Vector3(0, 0, 0);
|
|
@@ -2,7 +2,7 @@ import type Line from '../Model/line';
|
|
|
2
2
|
import { Line as FiveLine } from '@realsee/five/line';
|
|
3
3
|
import { Color, Texture, Vector3 } from 'three';
|
|
4
4
|
declare type ISetMaterialOpts = Parameters<FiveLine['setMaterial']>[0];
|
|
5
|
-
export interface
|
|
5
|
+
export interface ICreateLineOpts extends ISetMaterialOpts {
|
|
6
6
|
hasPoint?: boolean;
|
|
7
7
|
pointSize?: number;
|
|
8
8
|
lineWidth?: number;
|
|
@@ -12,6 +12,6 @@ export interface ICreatLineOpts extends ISetMaterialOpts {
|
|
|
12
12
|
lineColor?: Color | string | number;
|
|
13
13
|
pointColor?: Color | string | number;
|
|
14
14
|
}
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function
|
|
15
|
+
export declare function createLine(start: Vector3, end: Vector3, opts?: ICreateLineOpts): FiveLine;
|
|
16
|
+
export declare function createLineMesh(line: Line, type: 'normal' | 'light'): FiveLine;
|
|
17
17
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Line as FiveLine } from '@realsee/five/line';
|
|
2
2
|
import { lightLineOpts, normalLineOpts } from './constants';
|
|
3
3
|
import { Color } from 'three';
|
|
4
|
-
export function
|
|
4
|
+
export function createLine(start, end, opts) {
|
|
5
5
|
var _a, _b, _c, _d, _e;
|
|
6
6
|
const lineWidth = (_a = opts === null || opts === void 0 ? void 0 : opts.lineWidth) !== null && _a !== void 0 ? _a : 2;
|
|
7
7
|
const lineColor = (_b = opts === null || opts === void 0 ? void 0 : opts.lineColor) !== null && _b !== void 0 ? _b : new Color(0xffffff);
|
|
@@ -24,10 +24,10 @@ export function creatLine(start, end, opts) {
|
|
|
24
24
|
pointMaterial.map = opts.pointTexture;
|
|
25
25
|
return line;
|
|
26
26
|
}
|
|
27
|
-
export function
|
|
27
|
+
export function createLineMesh(line, type) {
|
|
28
28
|
const [point, anotherPoint] = line.points;
|
|
29
29
|
const opts = type === 'light' ? lightLineOpts : normalLineOpts;
|
|
30
|
-
const fiveLine =
|
|
30
|
+
const fiveLine = createLine(point.position, anotherPoint.position, opts);
|
|
31
31
|
fiveLine.name = 'normalLine_' + line.id;
|
|
32
32
|
return fiveLine;
|
|
33
33
|
}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"repository": "https://github.com/realsee-developer/dnalogel.git",
|
|
9
9
|
"description": "如视 VR 看房插件合集",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "2.0.0-alpha.
|
|
11
|
+
"version": "2.0.0-alpha.41",
|
|
12
12
|
"license": "SEE LICENSE IN TERMS.txt",
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "yarn run tsb && yarn run build:rollup && yarn run build:components && yarn build:docs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/core": "^7.17.5",
|
|
33
|
-
"@realsee/five": "5.0.0-alpha.
|
|
33
|
+
"@realsee/five": "5.0.0-alpha.141",
|
|
34
34
|
"@rollup/plugin-alias": "^3.1.9",
|
|
35
35
|
"@rollup/plugin-commonjs": "^21.1.0",
|
|
36
36
|
"@rollup/plugin-typescript": "^8.3.2",
|