@realsee/dnalogel 2.0.0-alpha.36 → 2.0.0-alpha.39
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 +60 -36
- package/dist/ItemLabelPlugin/typings.d.ts +4 -0
- package/dist/ModelViewPlugin/Plugin.d.ts +4 -4
- package/dist/ModelViewPlugin/index.js +2 -3
- package/dist/PanoRulerProPlugin/Controller.d.ts +15 -0
- package/dist/PanoRulerProPlugin/index.d.ts +8 -0
- package/dist/PanoRulerProPlugin/index.js +1006 -0
- package/dist/PanoRulerProPlugin/typings.d.ts +46 -0
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +2 -1
- package/dist/floorplan/ModelFloorplanPlugin/index.js +8 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +1036 -243
- package/dist/index.js +1037 -242
- package/dist/index.umd.js +1037 -242
- package/dist/shared-utils/logger.d.ts +16 -0
- package/docs/assets/search.js +1 -1
- 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 +2 -2
- 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 -0
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -0
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -0
- package/docs/interfaces/PanoRulerProPluginState.html +1 -0
- 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 +19 -17
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +34 -21
- package/libs/ItemLabelPlugin/Plugin.js +16 -10
- package/libs/ItemLabelPlugin/typings.d.ts +4 -0
- package/libs/ItemLabelPlugin/utils/parseData.js +1 -1
- package/libs/ModelViewPlugin/Plugin.d.ts +4 -4
- package/libs/ModelViewPlugin/Plugin.js +2 -3
- package/libs/PanoRulerProPlugin/Controller.d.ts +15 -0
- package/libs/PanoRulerProPlugin/Controller.js +110 -0
- package/libs/PanoRulerProPlugin/RulerItem.js +314 -0
- package/libs/PanoRulerProPlugin/RulerItems.js +377 -0
- package/libs/PanoRulerProPlugin/index.d.ts +8 -0
- package/libs/PanoRulerProPlugin/index.js +8 -0
- package/libs/PanoRulerProPlugin/typings.d.ts +46 -0
- package/libs/PanoRulerProPlugin/typings.js +1 -0
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +2 -1
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +8 -1
- package/libs/index.d.ts +2 -0
- package/libs/index.js +3 -0
- package/libs/shared-utils/logger.d.ts +16 -0
- package/libs/shared-utils/logger.js +47 -0
- package/package.json +1 -1
|
@@ -41,18 +41,18 @@ function add_css(target) {
|
|
|
41
41
|
|
|
42
42
|
function get_each_context(ctx, list, i) {
|
|
43
43
|
const child_ctx = ctx.slice();
|
|
44
|
-
child_ctx[
|
|
44
|
+
child_ctx[31] = list[i];
|
|
45
45
|
return child_ctx;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// (
|
|
48
|
+
// (235:2) {#if itemLabelItem.visible}
|
|
49
49
|
function create_if_block(ctx) {
|
|
50
50
|
let itemlabelitem;
|
|
51
51
|
let current;
|
|
52
52
|
|
|
53
53
|
itemlabelitem = new ItemLabelItem({
|
|
54
54
|
props: {
|
|
55
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
55
|
+
itemLabel: /*itemLabelItem*/ ctx[31],
|
|
56
56
|
hooks: /*hooks*/ ctx[0],
|
|
57
57
|
anchorEnabled: /*anchorEnabled*/ ctx[2],
|
|
58
58
|
onIconClick: /*onIconClick*/ ctx[6]
|
|
@@ -69,7 +69,7 @@ function create_if_block(ctx) {
|
|
|
69
69
|
},
|
|
70
70
|
p(ctx, dirty) {
|
|
71
71
|
const itemlabelitem_changes = {};
|
|
72
|
-
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
72
|
+
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
|
|
73
73
|
if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
74
74
|
if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
|
|
75
75
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
@@ -89,12 +89,12 @@ function create_if_block(ctx) {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
// (
|
|
92
|
+
// (234: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;
|
|
96
96
|
let current;
|
|
97
|
-
let if_block = /*itemLabelItem*/ ctx[
|
|
97
|
+
let if_block = /*itemLabelItem*/ ctx[31].visible && create_if_block(ctx);
|
|
98
98
|
|
|
99
99
|
return {
|
|
100
100
|
key: key_1,
|
|
@@ -114,7 +114,7 @@ function create_each_block(key_1, ctx) {
|
|
|
114
114
|
p(new_ctx, dirty) {
|
|
115
115
|
ctx = new_ctx;
|
|
116
116
|
|
|
117
|
-
if (/*itemLabelItem*/ ctx[
|
|
117
|
+
if (/*itemLabelItem*/ ctx[31].visible) {
|
|
118
118
|
if (if_block) {
|
|
119
119
|
if_block.p(ctx, dirty);
|
|
120
120
|
|
|
@@ -161,7 +161,7 @@ function create_fragment(ctx) {
|
|
|
161
161
|
let div_resize_listener;
|
|
162
162
|
let current;
|
|
163
163
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
164
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
164
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
|
|
165
165
|
|
|
166
166
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
167
167
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -178,7 +178,7 @@ function create_fragment(ctx) {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
attr(div, "class", "item-labels-container svelte-rmdeb");
|
|
181
|
-
add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
181
|
+
add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
|
|
182
182
|
set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
|
|
183
183
|
},
|
|
184
184
|
m(target, anchor) {
|
|
@@ -188,7 +188,7 @@ function create_fragment(ctx) {
|
|
|
188
188
|
each_blocks[i].m(div, null);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
191
|
+
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
|
|
192
192
|
current = true;
|
|
193
193
|
},
|
|
194
194
|
p(ctx, dirty) {
|
|
@@ -238,6 +238,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
238
238
|
const { Raycaster, Vector3 } = THREE;
|
|
239
239
|
let { five } = $$props;
|
|
240
240
|
let { modelOcclusionEnable } = $$props;
|
|
241
|
+
let { onlyVisibleInPanorama } = $$props;
|
|
241
242
|
let { itemLabels } = $$props;
|
|
242
243
|
let { hooks } = $$props;
|
|
243
244
|
let { displayStrategyType } = $$props;
|
|
@@ -289,7 +290,10 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
289
290
|
const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
|
|
290
291
|
const isFront = Math.abs(offsetZFromCenter) < 1;
|
|
291
292
|
const cssOffset = [ratioFromLeft, ratioFromTop];
|
|
293
|
+
|
|
294
|
+
// 只计算在前面就行
|
|
292
295
|
const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
|
|
296
|
+
|
|
293
297
|
return Boolean(isInViewport);
|
|
294
298
|
};
|
|
295
299
|
|
|
@@ -320,8 +324,15 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
320
324
|
};
|
|
321
325
|
|
|
322
326
|
const getFormatedItemLabels = (five, labels) => {
|
|
327
|
+
console.log(labels);
|
|
328
|
+
|
|
323
329
|
// 计算位置 & 可见性
|
|
324
330
|
const newLabels = labels.map(label => {
|
|
331
|
+
// 不在绑定点位则直接不可见
|
|
332
|
+
if (five.state.panoIndex !== label.panoIndex) {
|
|
333
|
+
return Object.assign(Object.assign({}, label), { visible: false });
|
|
334
|
+
}
|
|
335
|
+
|
|
325
336
|
const cssOffset = getLabelCssOffset(five, label);
|
|
326
337
|
const curLabelWidth = label.name.length * basicWidth;
|
|
327
338
|
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
@@ -441,11 +452,10 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
441
452
|
const onIconClick = itemLabel => {
|
|
442
453
|
if (five.state.mode === Five.Mode.Panorama) return;
|
|
443
454
|
const observers = five.work.observers;
|
|
444
|
-
const fromPositionVector = new Vector3(
|
|
455
|
+
const fromPositionVector = new Vector3().fromArray(itemLabel.position);
|
|
445
456
|
const observer = getNearObserverPano(fromPositionVector, observers);
|
|
446
457
|
|
|
447
458
|
if (observer) {
|
|
448
|
-
console.log('--has observer--');
|
|
449
459
|
itemLabel.observerIndex = observer.panoIndex;
|
|
450
460
|
}
|
|
451
461
|
|
|
@@ -488,12 +498,12 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
488
498
|
onItemLabelUpdate();
|
|
489
499
|
addResizeListener();
|
|
490
500
|
five.on('cameraUpdate', handleCameraUpdateCallback);
|
|
491
|
-
|
|
492
|
-
});
|
|
501
|
+
}); // five.on('modeChange', onFiveModeChange)
|
|
493
502
|
|
|
494
503
|
onDestroy(() => {
|
|
495
504
|
five.off('cameraUpdate', handleCameraUpdateCallback);
|
|
496
|
-
|
|
505
|
+
|
|
506
|
+
// five.off('modeChange', onFiveModeChange)
|
|
497
507
|
window.removeEventListener('resize', onResize, false);
|
|
498
508
|
});
|
|
499
509
|
|
|
@@ -507,10 +517,11 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
507
517
|
$$self.$$set = $$props => {
|
|
508
518
|
if ('five' in $$props) $$invalidate(7, five = $$props.five);
|
|
509
519
|
if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
510
|
-
if ('
|
|
520
|
+
if ('onlyVisibleInPanorama' in $$props) $$invalidate(9, onlyVisibleInPanorama = $$props.onlyVisibleInPanorama);
|
|
521
|
+
if ('itemLabels' in $$props) $$invalidate(10, itemLabels = $$props.itemLabels);
|
|
511
522
|
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
512
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
513
|
-
if ('maxVisibleDistance' in $$props) $$invalidate(
|
|
523
|
+
if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
|
|
524
|
+
if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
|
|
514
525
|
};
|
|
515
526
|
|
|
516
527
|
return [
|
|
@@ -523,6 +534,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
523
534
|
onIconClick,
|
|
524
535
|
five,
|
|
525
536
|
modelOcclusionEnable,
|
|
537
|
+
onlyVisibleInPanorama,
|
|
526
538
|
itemLabels,
|
|
527
539
|
displayStrategyType,
|
|
528
540
|
maxVisibleDistance,
|
|
@@ -543,10 +555,11 @@ class Component extends SvelteComponent {
|
|
|
543
555
|
{
|
|
544
556
|
five: 7,
|
|
545
557
|
modelOcclusionEnable: 8,
|
|
546
|
-
|
|
558
|
+
onlyVisibleInPanorama: 9,
|
|
559
|
+
itemLabels: 10,
|
|
547
560
|
hooks: 0,
|
|
548
|
-
displayStrategyType:
|
|
549
|
-
maxVisibleDistance:
|
|
561
|
+
displayStrategyType: 11,
|
|
562
|
+
maxVisibleDistance: 12
|
|
550
563
|
},
|
|
551
564
|
add_css,
|
|
552
565
|
[-1, -1]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Subscribe } from "@realsee/five";
|
|
1
|
+
import { Five, Subscribe } from "@realsee/five";
|
|
2
2
|
import ItemLabelComponent from './ItemLabelComponent';
|
|
3
3
|
import { ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE } from "./typings";
|
|
4
4
|
import { parseItemLabelPluginData } from "./utils/parseData";
|
|
5
5
|
const defaultMaxVisibleDistance = undefined;
|
|
6
6
|
export const Plugin = (five, params) => {
|
|
7
|
-
var _a, _b, _c;
|
|
7
|
+
var _a, _b, _c, _d;
|
|
8
8
|
const pluginState = {
|
|
9
9
|
container: document.createElement('div'),
|
|
10
10
|
data: null,
|
|
@@ -15,8 +15,9 @@ export const Plugin = (five, params) => {
|
|
|
15
15
|
app: undefined,
|
|
16
16
|
hooks: new Subscribe(),
|
|
17
17
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
onlyVisibleInPanorama: (_b = params === null || params === void 0 ? void 0 : params.onlyVisibleInPanorama) !== null && _b !== void 0 ? _b : true,
|
|
19
|
+
displayStrategyType: (_c = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _c !== void 0 ? _c : ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
|
|
20
|
+
maxVisibleDistance: (_d = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _d !== void 0 ? _d : defaultMaxVisibleDistance,
|
|
20
21
|
};
|
|
21
22
|
pluginState.container.setAttribute('class', 'item-label-plugin-container');
|
|
22
23
|
pluginState.container.style.cssText = `
|
|
@@ -73,6 +74,7 @@ export const Plugin = (five, params) => {
|
|
|
73
74
|
props: {
|
|
74
75
|
five: five,
|
|
75
76
|
modelOcclusionEnable: pluginState.modelOcclusionEnable,
|
|
77
|
+
onlyVisibleInPanorama: pluginState.onlyVisibleInPanorama,
|
|
76
78
|
itemLabels: pluginState.itemLabels,
|
|
77
79
|
wrapper: pluginState.wrapper,
|
|
78
80
|
hooks: pluginState.hooks,
|
|
@@ -90,21 +92,25 @@ export const Plugin = (five, params) => {
|
|
|
90
92
|
};
|
|
91
93
|
// 添加 five 监听
|
|
92
94
|
const addListener4Five = () => {
|
|
93
|
-
|
|
95
|
+
five.on('modeChange', onFiveModeChange);
|
|
94
96
|
five.once('dispose', dispose);
|
|
95
97
|
};
|
|
96
98
|
// 取消 five 监听
|
|
97
99
|
const removeListener4Five = () => {
|
|
98
|
-
|
|
100
|
+
five.off('modeChange', onFiveModeChange);
|
|
99
101
|
};
|
|
100
102
|
const onFiveModeChange = (mode) => {
|
|
101
|
-
if (!pluginState.enabled)
|
|
103
|
+
// if (!pluginState.enabled) return
|
|
104
|
+
if (mode !== Five.Mode.Panorama) {
|
|
105
|
+
pluginState.fiveModeEnabled = false;
|
|
106
|
+
disable();
|
|
102
107
|
return;
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
}
|
|
109
|
+
// pluginState.fiveModeEnabled = false
|
|
110
|
+
// render()
|
|
105
111
|
five.once('initAnimationEnded', () => {
|
|
106
112
|
pluginState.fiveModeEnabled = true;
|
|
107
|
-
|
|
113
|
+
enable();
|
|
108
114
|
});
|
|
109
115
|
};
|
|
110
116
|
addListener4Five();
|
|
@@ -10,10 +10,12 @@ export declare enum ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE {
|
|
|
10
10
|
export interface ItemLabelPluginParametersType {
|
|
11
11
|
maxVisibleDistance?: number;
|
|
12
12
|
modelOcclusionEnable?: boolean;
|
|
13
|
+
onlyVisibleInPanorama?: boolean;
|
|
13
14
|
displayStrategyType?: Partial<ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE>;
|
|
14
15
|
}
|
|
15
16
|
export interface ItemLabelPluginData {
|
|
16
17
|
item_labels: Readonly<{
|
|
18
|
+
panoIndex: number;
|
|
17
19
|
id: string;
|
|
18
20
|
code: string;
|
|
19
21
|
name: string;
|
|
@@ -24,6 +26,7 @@ export interface ItemLabelPluginData {
|
|
|
24
26
|
}>[];
|
|
25
27
|
}
|
|
26
28
|
export interface ItemLabel {
|
|
29
|
+
panoIndex: number;
|
|
27
30
|
id: string;
|
|
28
31
|
code: string;
|
|
29
32
|
name: string;
|
|
@@ -54,6 +57,7 @@ export interface ItemLabelPluginState {
|
|
|
54
57
|
app?: ItemLabelComponent | undefined;
|
|
55
58
|
hooks: Subscribe<PluginEvent>;
|
|
56
59
|
modelOcclusionEnable: boolean;
|
|
60
|
+
onlyVisibleInPanorama: boolean;
|
|
57
61
|
displayStrategyType: Partial<ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE>;
|
|
58
62
|
maxVisibleDistance: number | undefined;
|
|
59
63
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** @description 转成内部所需数据 */
|
|
2
2
|
export function parseItemLabelPluginData(data) {
|
|
3
|
-
return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }
|
|
3
|
+
return data.item_labels.map(label => (Object.assign(Object.assign({}, label), { modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined })));
|
|
4
4
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { FivePlugin } from '@realsee/five';
|
|
2
2
|
export interface ModelViewPluginExportType {
|
|
3
|
-
appendTo(element: HTMLElement, size?: {
|
|
3
|
+
appendTo: (element: HTMLElement, size?: {
|
|
4
4
|
width?: number;
|
|
5
5
|
height?: number;
|
|
6
|
-
})
|
|
7
|
-
refresh(size?: {
|
|
6
|
+
}) => void;
|
|
7
|
+
refresh: (size?: {
|
|
8
8
|
width?: number;
|
|
9
9
|
height?: number;
|
|
10
|
-
})
|
|
10
|
+
}) => void;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Five 模型插件
|
|
@@ -49,8 +49,7 @@ export const ModelViewPlugin = (five) => {
|
|
|
49
49
|
};
|
|
50
50
|
const handleModelLoaded = () => {
|
|
51
51
|
function cloneMaterial(material) {
|
|
52
|
-
material
|
|
53
|
-
material.uniforms.modelAlpha.value = 1;
|
|
52
|
+
material.clone().uniforms.modelAlpha.value = 1;
|
|
54
53
|
if (material.uniforms.map.value) {
|
|
55
54
|
material.uniforms.map.value.needsUpdate = true;
|
|
56
55
|
}
|
|
@@ -98,7 +97,7 @@ export const ModelViewPlugin = (five) => {
|
|
|
98
97
|
return;
|
|
99
98
|
const element = renderer.domElement;
|
|
100
99
|
const container = element.parentNode;
|
|
101
|
-
if (container
|
|
100
|
+
if (container === null || container === void 0 ? void 0 : container.nodeName) {
|
|
102
101
|
const { width = container.offsetWidth, height = container.offsetHeight } = size;
|
|
103
102
|
renderer.setSize(width, height);
|
|
104
103
|
// 修改摄像机 aspect 比值
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Five } from '@realsee/five';
|
|
2
|
+
import type { PanoRulerProPluginDatas, PanoRulerProPluginParameterType, PanoRulerProPluginState } from './typings';
|
|
3
|
+
export default class Controller {
|
|
4
|
+
private five;
|
|
5
|
+
private container;
|
|
6
|
+
private panoRulerProData;
|
|
7
|
+
private rulerItems;
|
|
8
|
+
state: PanoRulerProPluginState;
|
|
9
|
+
constructor(five: Five, params: PanoRulerProPluginParameterType);
|
|
10
|
+
load(serverData: PanoRulerProPluginDatas): Promise<void>;
|
|
11
|
+
enable(): boolean;
|
|
12
|
+
disable(): boolean;
|
|
13
|
+
private render;
|
|
14
|
+
private dispose;
|
|
15
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import RulerItems from './RulerItems';
|
|
2
|
+
export default class Controller {
|
|
3
|
+
constructor(five, params) {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
Object.defineProperty(this, "five", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true,
|
|
9
|
+
value: void 0
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(this, "container", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
writable: true,
|
|
15
|
+
value: document.createElement('div')
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(this, "panoRulerProData", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: void 0
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(this, "rulerItems", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: void 0
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(this, "state", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: {
|
|
34
|
+
enabled: false,
|
|
35
|
+
loaded: false,
|
|
36
|
+
options: {
|
|
37
|
+
className: '',
|
|
38
|
+
distanceText: (distance) => `${distance.toFixed(1)}m`,
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
this.five = five;
|
|
43
|
+
this.container.classList.add('panoRulerProPlugin-container');
|
|
44
|
+
this.container.setAttribute('style', `position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;`);
|
|
45
|
+
if (params) {
|
|
46
|
+
if (params.data) {
|
|
47
|
+
this.load(params.data);
|
|
48
|
+
}
|
|
49
|
+
this.state.options = Object.assign(Object.assign({}, this.state.options), (params.options || {}));
|
|
50
|
+
if ((_a = params.options) === null || _a === void 0 ? void 0 : _a.className)
|
|
51
|
+
this.container.classList.add((_b = params.options) === null || _b === void 0 ? void 0 : _b.className);
|
|
52
|
+
}
|
|
53
|
+
this.five.once('modelLoaded', async () => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
(_b = (_a = this.five.getElement()) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.append(this.container);
|
|
56
|
+
});
|
|
57
|
+
this.five.once('dispose', () => this.dispose());
|
|
58
|
+
}
|
|
59
|
+
async load(serverData) {
|
|
60
|
+
if (!this.five.work)
|
|
61
|
+
return;
|
|
62
|
+
const data = serverData.data;
|
|
63
|
+
if (!data)
|
|
64
|
+
throw new Error('标尺数据依赖不齐全!');
|
|
65
|
+
this.panoRulerProData = data;
|
|
66
|
+
this.state.loaded = true;
|
|
67
|
+
}
|
|
68
|
+
enable() {
|
|
69
|
+
if (!this.state.loaded)
|
|
70
|
+
return false;
|
|
71
|
+
if (this.state.enabled)
|
|
72
|
+
return true;
|
|
73
|
+
this.state.enabled = true;
|
|
74
|
+
this.render();
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
disable() {
|
|
78
|
+
if (!this.state.enabled)
|
|
79
|
+
return true;
|
|
80
|
+
this.state.enabled = false;
|
|
81
|
+
this.render();
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
async render() {
|
|
85
|
+
var _a;
|
|
86
|
+
if (this.state.enabled) {
|
|
87
|
+
if (!this.panoRulerProData || !this.container)
|
|
88
|
+
return;
|
|
89
|
+
this.rulerItems = new RulerItems({
|
|
90
|
+
target: this.container,
|
|
91
|
+
props: {
|
|
92
|
+
five: this.five,
|
|
93
|
+
rulerDatas: this.panoRulerProData,
|
|
94
|
+
options: this.state.options,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
(_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
100
|
+
this.rulerItems = undefined;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
dispose() {
|
|
104
|
+
if (this.container) {
|
|
105
|
+
this.rulerItems.$destroy();
|
|
106
|
+
this.rulerItems = undefined;
|
|
107
|
+
}
|
|
108
|
+
this.container.remove();
|
|
109
|
+
}
|
|
110
|
+
}
|