@realsee/dnalogel 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/CSS3DRenderPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  2. package/dist/CameraMovementPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  3. package/dist/CruisePlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  4. package/dist/GuideLinePlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  5. package/dist/ItemLabelPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  6. package/dist/ModelChassisCompassPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  7. package/dist/ModelEntryDoorGuidePlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  8. package/dist/ModelItemLabelPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  9. package/dist/ModelRoomLabelPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  10. package/dist/ModelRoomLabelPlugin/index.js +19 -22
  11. package/dist/ModelTVVideoPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  12. package/dist/ModelViewPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  13. package/dist/ModelViewPlugin/Plugin.d.ts +13 -2
  14. package/dist/ModelViewPlugin/index.js +53 -28
  15. package/dist/PanoCompassPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  16. package/dist/PanoCursorRaycasterPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  17. package/dist/PanoDoorLabelPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  18. package/dist/PanoMeasurePlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  19. package/dist/PanoRulerPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  20. package/dist/PanoRulerProPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  21. package/dist/PanoSpatialTagPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  22. package/dist/floorplan/MapviewFloorplanPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  23. package/dist/floorplan/ModelFloorplanPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  24. package/dist/floorplan/PanoFloorplanRadarPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  25. package/dist/floorplan/TopviewFloorplanPlugin/ModelViewPlugin/Plugin.d.ts +13 -2
  26. package/dist/index.es.js +64 -43
  27. package/dist/index.js +72 -51
  28. package/dist/index.umd.js +75 -54
  29. package/docs/assets/search.js +1 -1
  30. package/docs/classes/CruisePluginController.html +14 -14
  31. package/docs/classes/Magnifier.html +4 -4
  32. package/docs/classes/ModelRoomLabelController.html +4 -4
  33. package/docs/enums/CameraMovementEffect.html +2 -2
  34. package/docs/enums/DIRECTION.html +1 -1
  35. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  36. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  37. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  38. package/docs/enums/Rotation.html +2 -2
  39. package/docs/index.html +1 -1
  40. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  41. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  42. package/docs/interfaces/FloorplanBounding.html +4 -4
  43. package/docs/interfaces/FloorplanData.html +2 -2
  44. package/docs/interfaces/FloorplanEntrance.html +7 -7
  45. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  46. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  47. package/docs/interfaces/FloorplanFloorData.html +2 -2
  48. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  49. package/docs/interfaces/FloorplanObserver.html +2 -2
  50. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  51. package/docs/interfaces/FloorplanPosition.html +2 -2
  52. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  53. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  54. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  55. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  56. package/docs/interfaces/FloorplanServerData.html +2 -2
  57. package/docs/interfaces/FloorplanServerDoorItem.html +1 -1
  58. package/docs/interfaces/FloorplanServerDoorPosition.html +1 -1
  59. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  60. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  61. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  62. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  63. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  64. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  65. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  66. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  67. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  68. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  69. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  70. package/docs/interfaces/LineJson.html +1 -1
  71. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  72. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  73. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  74. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  75. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  76. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  77. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  78. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  79. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  80. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  81. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  82. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  83. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  84. package/docs/interfaces/OpenParameter.html +2 -2
  85. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  86. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  87. package/docs/interfaces/PanoMeasureParameterType.html +2 -2
  88. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  89. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  90. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  91. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
  92. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
  93. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
  94. package/docs/interfaces/PanoRulerProPluginState.html +1 -1
  95. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  96. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  97. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  98. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  99. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  100. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  101. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  102. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  103. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  104. package/docs/interfaces/Point.html +1 -1
  105. package/docs/interfaces/PointJson.html +1 -1
  106. package/docs/interfaces/Room.html +1 -1
  107. package/docs/interfaces/RoomInfo.html +1 -1
  108. package/docs/interfaces/RoomLabel.html +7 -7
  109. package/docs/interfaces/RoomRules.html +1 -1
  110. package/docs/interfaces/Rooms.html +1 -1
  111. package/docs/modules.html +18 -18
  112. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +19 -22
  113. package/libs/ModelViewPlugin/Plugin.d.ts +13 -2
  114. package/libs/ModelViewPlugin/Plugin.js +45 -20
  115. package/package.json +3 -3
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -118,11 +118,11 @@ function add_css(target) {
118
118
 
119
119
  function get_each_context(ctx, list, i) {
120
120
  const child_ctx = ctx.slice();
121
- child_ctx[12] = list[i];
121
+ child_ctx[13] = list[i];
122
122
  return child_ctx;
123
123
  }
124
124
 
125
- // (82:2) {#each roomLabels as roomLableItem (roomLableItem.id)}
125
+ // (79:2) {#each roomLabels as roomLableItem (roomLableItem.id)}
126
126
  function create_each_block(key_1, ctx) {
127
127
  let first;
128
128
  let roomlabelitem;
@@ -130,7 +130,7 @@ function create_each_block(key_1, ctx) {
130
130
 
131
131
  roomlabelitem = new RoomLabelItem({
132
132
  props: {
133
- roomLabel: /*roomLableItem*/ ctx[12],
133
+ roomLabel: /*roomLableItem*/ ctx[13],
134
134
  five: /*five*/ ctx[1]
135
135
  }
136
136
  });
@@ -151,7 +151,7 @@ function create_each_block(key_1, ctx) {
151
151
  p(new_ctx, dirty) {
152
152
  ctx = new_ctx;
153
153
  const roomlabelitem_changes = {};
154
- if (dirty & /*roomLabels*/ 1) roomlabelitem_changes.roomLabel = /*roomLableItem*/ ctx[12];
154
+ if (dirty & /*roomLabels*/ 1) roomlabelitem_changes.roomLabel = /*roomLableItem*/ ctx[13];
155
155
  if (dirty & /*five*/ 2) roomlabelitem_changes.five = /*five*/ ctx[1];
156
156
  roomlabelitem.$set(roomlabelitem_changes);
157
157
  },
@@ -178,7 +178,7 @@ function create_fragment(ctx) {
178
178
  let div_resize_listener;
179
179
  let current;
180
180
  let each_value = /*roomLabels*/ ctx[0];
181
- const get_key = ctx => /*roomLableItem*/ ctx[12].id;
181
+ const get_key = ctx => /*roomLableItem*/ ctx[13].id;
182
182
 
183
183
  for (let i = 0; i < each_value.length; i += 1) {
184
184
  let child_ctx = get_each_context(ctx, each_value, i);
@@ -245,13 +245,19 @@ function create_fragment(ctx) {
245
245
 
246
246
  function instance($$self, $$props, $$invalidate) {
247
247
  let rendererSize;
248
+ var _a;
248
249
  let { five } = $$props;
249
250
  let { roomLabels } = $$props;
250
251
  let containerWidth;
251
252
  let containerHeight;
252
- let shownFloor = null;
253
+
254
+ let shownFloor = (_a = five.model.shownFloor) !== null && _a !== void 0
255
+ ? _a
256
+ : null;
253
257
 
254
258
  function getLabelVisible(item) {
259
+ const isLabelInFloor = shownFloor === null || item.floorIndex === shownFloor;
260
+ if (!isLabelInFloor) return false;
255
261
  const raycaster = new three.Raycaster();
256
262
  const cameraPosition = five.camera.position.clone();
257
263
  const position = new three.Vector3(item.position.x, item.position.y, item.position.z);
@@ -270,7 +276,9 @@ function instance($$self, $$props, $$invalidate) {
270
276
  return `translate(${xOffset}px, ${yOffset}px)`;
271
277
  }
272
278
 
273
- function getFormatedRoomLabels(rendererSize) {
279
+ function getFormatedRoomLabels(params) {
280
+ const { rendererSize, shownFloor } = params;
281
+
274
282
  // 因为 item distance 需要重复计算,所以缓存一下
275
283
  const distanceMap = new Map();
276
284
 
@@ -303,7 +311,7 @@ function instance($$self, $$props, $$invalidate) {
303
311
  }
304
312
 
305
313
  function onFiveCameraUpdate() {
306
- $$invalidate(0, roomLabels = getFormatedRoomLabels(rendererSize));
314
+ $$invalidate(0, roomLabels = getFormatedRoomLabels({ rendererSize, shownFloor }));
307
315
  }
308
316
 
309
317
  function onFiveModelShownFloorChange(floorIndex) {
@@ -335,21 +343,10 @@ function instance($$self, $$props, $$invalidate) {
335
343
  $$invalidate(5, rendererSize = { x: containerWidth, y: containerHeight });
336
344
  }
337
345
 
338
- if ($$self.$$.dirty & /*rendererSize*/ 32) {
339
- {
340
- // rendererSize 变化时,触发 reRender
341
- $$invalidate(0, roomLabels = getFormatedRoomLabels(rendererSize));
342
- }
343
- }
344
-
345
- if ($$self.$$.dirty & /*roomLabels, shownFloor*/ 17) {
346
+ if ($$self.$$.dirty & /*rendererSize, shownFloor*/ 48) {
346
347
  {
347
- // shownFloor 变化时,更新 item visible
348
- $$invalidate(0, roomLabels = roomLabels.map(item => {
349
- const isLabelInFloor = shownFloor === null || item.floorIndex === shownFloor;
350
- const visible = isLabelInFloor ? item.visible : false;
351
- return Object.assign(Object.assign({}, item), { visible });
352
- }));
348
+ // rendererSize 和 shownFloor 变化时,触发 reRender
349
+ $$invalidate(0, roomLabels = getFormatedRoomLabels({ rendererSize, shownFloor }));
353
350
  }
354
351
  }
355
352
  };
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var five = require('@realsee/five');
5
6
  var THREE = require('three');
6
7
 
7
8
  function _interopNamespace(e) {
@@ -28,12 +29,21 @@ var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
28
29
  * Five 模型插件
29
30
  * @template ExportType 导出方法
30
31
  */
31
- const ModelViewPlugin = (five) => {
32
+ const ModelViewPlugin = (five$1, params) => {
32
33
  let needsRender = true;
33
34
  let renderer = null;
35
+ const defaultConfig = {
36
+ lookAtCurrentCamera: false,
37
+ lockedPanoIndex: null,
38
+ lockedLatitude: null,
39
+ lockedLongitude: null,
40
+ };
41
+ const config = Object.assign(Object.assign({}, defaultConfig), params === null || params === void 0 ? void 0 : params.config);
34
42
  const scene = new THREE__namespace.Scene();
35
- const camera = new THREE__namespace.PerspectiveCamera(60, 1, 0.1, 1000);
43
+ const camera = new five.Camera(60);
36
44
  let model = new THREE__namespace.Object3D();
45
+ let distance;
46
+ let offset;
37
47
  {
38
48
  const light = new THREE__namespace.DirectionalLight(0xffffff, 0.5);
39
49
  light.position.copy(new THREE__namespace.Vector3(1, 1, 1));
@@ -49,11 +59,11 @@ const ModelViewPlugin = (five) => {
49
59
  }
50
60
  scene.add(model);
51
61
  const initRendererIfNeeds = () => {
52
- if (!five.renderer)
62
+ if (!five$1.renderer)
53
63
  return;
54
64
  if (!renderer) {
55
65
  renderer = new THREE__namespace.WebGLRenderer({ antialias: false, alpha: true });
56
- renderer.setPixelRatio(five.renderer.getPixelRatio());
66
+ renderer.setPixelRatio(five$1.renderer.getPixelRatio());
57
67
  renderer.outputEncoding = THREE__namespace.sRGBEncoding;
58
68
  renderer.setClearColor(0x181a1c, 0);
59
69
  renderer.autoClear = true;
@@ -73,6 +83,8 @@ const ModelViewPlugin = (five) => {
73
83
  update();
74
84
  };
75
85
  const handleModelLoaded = () => {
86
+ distance = getDistanceFromModel(five$1.model, camera.fov, camera.aspect);
87
+ offset = five$1.model.bounding.getCenter(new THREE__namespace.Vector3());
76
88
  function cloneMaterial(_material) {
77
89
  const material = _material.clone();
78
90
  material.uniforms.modelAlpha.value = 1;
@@ -101,7 +113,7 @@ const ModelViewPlugin = (five) => {
101
113
  }
102
114
  }
103
115
  scene.remove(model);
104
- model = cloneModel(five.model);
116
+ model = cloneModel(five$1.model);
105
117
  scene.add(model);
106
118
  update();
107
119
  };
@@ -132,29 +144,36 @@ const ModelViewPlugin = (five) => {
132
144
  }
133
145
  update();
134
146
  };
135
- const cameraDistance = () => {
136
- const bounding = five.model.bounding;
137
- const { fov, aspect } = camera;
138
- const radius = Math.sqrt(Math.pow(bounding.max.x - bounding.min.x + 2, 2) +
139
- Math.pow(bounding.max.y - bounding.min.y + 2, 2) +
140
- Math.pow(bounding.max.z - bounding.min.z + 2, 2));
147
+ function getDistanceFromModel(model, fov, aspect) {
148
+ const bounding = model.bounding;
149
+ const radius = Math.pow(Math.pow(bounding.max.x - bounding.min.x + 1, 2) +
150
+ Math.pow(bounding.max.y - bounding.min.y + 1, 2) +
151
+ Math.pow(bounding.max.z - bounding.min.z + 1, 2), 1 / 2);
141
152
  // fit screen
142
153
  let distance = radius / 2 / Math.tan((Math.PI * fov) / 360);
143
154
  if (aspect < 1)
144
155
  distance = distance / aspect;
145
156
  return isNaN(distance) ? radius : distance;
146
- };
157
+ }
158
+ function getOffsetFromPanoIndex(panoIndex) {
159
+ return five$1.work.observers[panoIndex].standingPosition.clone();
160
+ }
147
161
  const update = () => {
148
- const { longitude, latitude } = five.getPose();
149
- const distance = cameraDistance();
150
- const lookAt = five.model.bounding.getCenter(new THREE__namespace.Vector3());
151
- const longitudeDistance = distance * Math.cos(latitude);
152
- const cameraPosition = new THREE__namespace.Vector3();
153
- cameraPosition.x = Math.sin(longitude) * longitudeDistance + lookAt.x;
154
- cameraPosition.z = Math.cos(longitude) * longitudeDistance + lookAt.z;
155
- cameraPosition.y = Math.sin(latitude) * distance + lookAt.y;
156
- camera.position.copy(cameraPosition);
157
- camera.lookAt(lookAt);
162
+ if (!distance || !offset)
163
+ return;
164
+ const pose = five$1.getPose();
165
+ pose.fov = camera.fov;
166
+ pose.offset = offset;
167
+ pose.distance = distance;
168
+ if (typeof config.lockedLatitude === 'number')
169
+ pose.latitude = config.lockedLatitude;
170
+ if (typeof config.lockedLongitude === 'number')
171
+ pose.longitude = config.lockedLongitude;
172
+ if (typeof config.lockedPanoIndex === 'number')
173
+ pose.offset = getOffsetFromPanoIndex(config.lockedPanoIndex);
174
+ if (config.lookAtCurrentCamera)
175
+ pose.offset = five$1.camera.position.clone().setY(five$1.camera.position.y + 1);
176
+ camera.setFromPose(pose);
158
177
  needsRender = true;
159
178
  };
160
179
  const render = () => {
@@ -175,12 +194,18 @@ const ModelViewPlugin = (five) => {
175
194
  renderer.dispose();
176
195
  renderer = null;
177
196
  };
178
- five.on('modelLoaded', handleModelLoaded);
179
- five.on('modelWillLoad', handleModelWillLoad);
180
- five.on('cameraDirectionUpdate', update);
181
- five.on('dispose', dispose);
182
- five.on('renderFrame', render);
183
- return { appendTo, refresh };
197
+ const changeConfigs = (userConfig) => {
198
+ Object.assign(config, userConfig);
199
+ update();
200
+ };
201
+ Object.assign(window, { camera });
202
+ five$1.on('modelLoaded', handleModelLoaded);
203
+ five$1.on('modelWillLoad', handleModelWillLoad);
204
+ five$1.on('cameraDirectionUpdate', update);
205
+ five$1.on('dispose', dispose);
206
+ five$1.on('renderFrame', render);
207
+ five$1.on('cameraPositionUpdate', update);
208
+ return { appendTo, refresh, changeConfigs };
184
209
  };
185
210
 
186
211
  exports.ModelViewPlugin = ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;
@@ -1,4 +1,11 @@
1
- import type { FivePlugin } from '@realsee/five';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import { FivePlugin } from '@realsee/five';
3
+ export interface Config {
4
+ lookAtCurrentCamera: boolean;
5
+ lockedPanoIndex: number | null;
6
+ lockedLatitude: number | null;
7
+ lockedLongitude: number | null;
8
+ }
2
9
  export interface ModelViewPluginExportType {
3
10
  appendTo: (element: HTMLElement, size?: {
4
11
  width?: number;
@@ -8,10 +15,14 @@ export interface ModelViewPluginExportType {
8
15
  width?: number;
9
16
  height?: number;
10
17
  }) => void;
18
+ changeConfigs: (config: Partial<Config>) => void;
19
+ }
20
+ export interface ModelViewPluginParameterType {
21
+ config: Config;
11
22
  }
12
23
  /**
13
24
  * Five 模型插件
14
25
  * @template ExportType 导出方法
15
26
  */
16
- export declare const ModelViewPlugin: FivePlugin<void, ModelViewPluginExportType>;
27
+ export declare const ModelViewPlugin: FivePlugin<PartialDeep<ModelViewPluginParameterType> | undefined, ModelViewPluginExportType>;
17
28
  export default ModelViewPlugin;