@realsee/dnalogel 2.1.0-alpha.16 → 2.1.0-alpha.17

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 (202) hide show
  1. package/dist/CSS3DRenderPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  2. package/dist/CameraMovementPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  3. package/dist/CruisePlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  4. package/dist/GuideLinePlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  5. package/dist/ItemLabelPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  6. package/dist/ModelChassisCompassPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  7. package/dist/ModelEntryDoorGuidePlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  8. package/dist/ModelItemLabelPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  9. package/dist/ModelRoomLabelPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  10. package/dist/ModelTVVideoPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  11. package/dist/ModelViewPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  12. package/dist/Object3DHelperPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  13. package/dist/PanoCompassPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  14. package/dist/PanoCursorRaycasterPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  15. package/dist/PanoDoorLabelPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  16. package/dist/PanoMeasurePlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  17. package/dist/PanoRulerPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  18. package/dist/PanoRulerProPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  19. package/dist/PanoSpatialTagPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  20. package/dist/PanoTagPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  21. package/dist/PanoTagPlugin/index.js +89 -84
  22. package/dist/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  23. package/dist/floorplan/MapviewFloorplanPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  24. package/dist/floorplan/ModelFloorplanPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  25. package/dist/floorplan/PanoFloorplanRadarPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  26. package/dist/floorplan/TopviewFloorplanPlugin/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  27. package/dist/index.es.js +89 -84
  28. package/dist/index.js +89 -84
  29. package/dist/index.umd.js +89 -84
  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/classes/Object3DHelperController.html +9 -9
  34. package/docs/classes/PanoTagPluginController.html +23 -23
  35. package/docs/enums/CameraMovementEffect.html +2 -2
  36. package/docs/enums/ContentType.html +7 -7
  37. package/docs/enums/DIRECTION.html +1 -1
  38. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  39. package/docs/enums/DimensionType.html +1 -1
  40. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  41. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  42. package/docs/enums/LinkType.html +1 -1
  43. package/docs/enums/PointType.html +1 -1
  44. package/docs/enums/Rotation.html +2 -2
  45. package/docs/index.html +1 -1
  46. package/docs/interfaces/CSS3DRenderPluginEventMap.html +2 -2
  47. package/docs/interfaces/CSS3DRenderPluginState.html +2 -2
  48. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  49. package/docs/interfaces/FloorplanBounding.html +4 -4
  50. package/docs/interfaces/FloorplanData.html +2 -2
  51. package/docs/interfaces/FloorplanEntrance.html +7 -7
  52. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  53. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  54. package/docs/interfaces/FloorplanFloorData.html +2 -2
  55. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  56. package/docs/interfaces/FloorplanObserver.html +2 -2
  57. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  58. package/docs/interfaces/FloorplanPosition.html +2 -2
  59. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  60. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  61. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  62. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  63. package/docs/interfaces/FloorplanServerData.html +2 -2
  64. package/docs/interfaces/FloorplanServerDoorItem.html +1 -1
  65. package/docs/interfaces/FloorplanServerDoorPosition.html +1 -1
  66. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  67. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  68. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  69. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  70. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  71. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  72. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  73. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  74. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  75. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  76. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  77. package/docs/interfaces/LineJson.html +1 -1
  78. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  79. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  80. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  81. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  82. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  83. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  84. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  85. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  86. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  87. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  88. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  89. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  90. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  91. package/docs/interfaces/Object3DHelperState.html +1 -1
  92. package/docs/interfaces/OpenParameter.html +2 -2
  93. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  94. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  95. package/docs/interfaces/PanoMeasureParameterType.html +2 -2
  96. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  97. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  98. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  99. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
  100. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
  101. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
  102. package/docs/interfaces/PanoRulerProPluginState.html +1 -1
  103. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  104. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  105. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  106. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  107. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  108. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  109. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  110. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  111. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  112. package/docs/interfaces/Point.html +1 -1
  113. package/docs/interfaces/PointJson.html +1 -1
  114. package/docs/interfaces/Room.html +1 -1
  115. package/docs/interfaces/RoomInfo.html +1 -1
  116. package/docs/interfaces/RoomLabel.html +7 -7
  117. package/docs/interfaces/RoomRules.html +1 -1
  118. package/docs/interfaces/Rooms.html +1 -1
  119. package/docs/interfaces/Scissor.html +5 -5
  120. package/docs/interfaces/TagConfig.html +3 -3
  121. package/docs/interfaces/Tags.html +3 -3
  122. package/docs/modules.html +21 -21
  123. package/libs/ItemLabelPlugin/Plugin.js +1 -1
  124. package/libs/ItemLabelPlugin/typings.d.ts +1 -1
  125. package/libs/ModelItemLabelPlugin/ModelItemLabelPlugin.js +1 -1
  126. package/libs/ModelItemLabelPlugin/typings.d.ts +1 -1
  127. package/libs/ModelRoomLabelPlugin/Controller.js +1 -1
  128. package/libs/PanoDoorLabelPlugin/Controller.js +1 -1
  129. package/libs/PanoRulerProPlugin/Controller.js +1 -1
  130. package/libs/PanoSpatialTagPlugin/Plugin.js +2 -2
  131. package/libs/PanoTagPlugin/Components/Common/MediaItem.js +6 -5
  132. package/libs/PanoTagPlugin/Components/Common/Point/PointSwitch.js +15 -13
  133. package/libs/PanoTagPlugin/Components/Tag/AudioTag.js +6 -5
  134. package/libs/PanoTagPlugin/Components/Tag/ImageTextTag.js +17 -15
  135. package/libs/PanoTagPlugin/Components/Tag/LinkTag.js +9 -9
  136. package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +17 -15
  137. package/libs/PanoTagPlugin/Components/Tag/MediaPlane.js +12 -18
  138. package/libs/PanoTagPlugin/Components/Tag/TextTag.js +4 -3
  139. package/libs/PanoTagPlugin/controller/index.js +6 -6
  140. package/libs/PanoTagPlugin/typings/controller.d.ts +1 -1
  141. package/libs/PanoTagPlugin/utils/nullishCoalescing.d.ts +2 -0
  142. package/libs/PanoTagPlugin/utils/nullishCoalescing.js +9 -0
  143. package/libs/floorplan/MapviewFloorplanPlugin/Controller.js +1 -1
  144. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +1 -1
  145. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +1 -1
  146. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +1 -1
  147. package/package.json +1 -1
  148. package/libs/ItemLabelPlugin/ItemLabelComponent.svelte +0 -251
  149. package/libs/ItemLabelPlugin/ItemLabelItem.svelte +0 -183
  150. package/libs/ModelItemLabelPlugin/ItemLabelComponent.svelte +0 -155
  151. package/libs/ModelItemLabelPlugin/ItemLabelItem.svelte +0 -100
  152. package/libs/ModelRoomLabelPlugin/RoomLabelItem.svelte +0 -63
  153. package/libs/ModelRoomLabelPlugin/RoomLabelItems.svelte +0 -91
  154. package/libs/PanoDoorLabelPlugin/DoorLabelItem.svelte +0 -200
  155. package/libs/PanoRulerProPlugin/RulerItem.svelte +0 -166
  156. package/libs/PanoRulerProPlugin/RulerItems.svelte +0 -212
  157. package/libs/PanoSpatialTagPlugin/Components/origins.svelte +0 -58
  158. package/libs/PanoSpatialTagPlugin/Components/tag.svelte +0 -292
  159. package/libs/PanoTagPlugin/Components/Common/Arrow.svelte +0 -56
  160. package/libs/PanoTagPlugin/Components/Common/Audio.svelte +0 -82
  161. package/libs/PanoTagPlugin/Components/Common/Line/Polyline.svelte +0 -36
  162. package/libs/PanoTagPlugin/Components/Common/Line/Straight.svelte +0 -36
  163. package/libs/PanoTagPlugin/Components/Common/Media.svelte +0 -96
  164. package/libs/PanoTagPlugin/Components/Common/MediaItem.svelte +0 -49
  165. package/libs/PanoTagPlugin/Components/Common/MultiLineText.svelte +0 -56
  166. package/libs/PanoTagPlugin/Components/Common/Point/CustomPoint.svelte +0 -120
  167. package/libs/PanoTagPlugin/Components/Common/Point/DefaultPoint.svelte +0 -81
  168. package/libs/PanoTagPlugin/Components/Common/Point/PointSwitch.svelte +0 -30
  169. package/libs/PanoTagPlugin/Components/Common/Shadow.svelte +0 -46
  170. package/libs/PanoTagPlugin/Components/Common/Text.svelte +0 -91
  171. package/libs/PanoTagPlugin/Components/Common/TextItem.svelte +0 -42
  172. package/libs/PanoTagPlugin/Components/PointTag.svelte +0 -55
  173. package/libs/PanoTagPlugin/Components/Tag/AudioTag.svelte +0 -105
  174. package/libs/PanoTagPlugin/Components/Tag/CustomTag.svelte +0 -33
  175. package/libs/PanoTagPlugin/Components/Tag/ImageTextTag.svelte +0 -63
  176. package/libs/PanoTagPlugin/Components/Tag/LinkTag.svelte +0 -167
  177. package/libs/PanoTagPlugin/Components/Tag/MarketingTag.svelte +0 -235
  178. package/libs/PanoTagPlugin/Components/Tag/MediaPlane.svelte +0 -32
  179. package/libs/PanoTagPlugin/Components/Tag/TextTag.svelte +0 -63
  180. package/libs/PanoTagPlugin/Components/Tag/index.svelte +0 -154
  181. package/libs/PanoTagPlugin/Components/TagWrapper.svelte +0 -64
  182. package/libs/floorplan/Components/BaseImage.svelte +0 -26
  183. package/libs/floorplan/Components/Camera.svelte +0 -46
  184. package/libs/floorplan/Components/Compass.svelte +0 -51
  185. package/libs/floorplan/Components/CurrentFloor.svelte +0 -57
  186. package/libs/floorplan/Components/Main.svelte +0 -55
  187. package/libs/floorplan/Components/Normalmage.svelte +0 -11
  188. package/libs/floorplan/Components/RoomHighlight/Room.svelte +0 -27
  189. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.svelte +0 -29
  190. package/libs/floorplan/Components/RoomLabels/RoomLabel.svelte +0 -120
  191. package/libs/floorplan/Components/RoomLabels/RoomLabels.svelte +0 -45
  192. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.svelte +0 -42
  193. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_0.svelte +0 -7
  194. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.svelte +0 -24
  195. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.svelte +0 -33
  196. package/libs/floorplan/Components/RuleLabels/RuleItem.svelte +0 -175
  197. package/libs/floorplan/Components/RuleLabels/RuleLabels.svelte +0 -33
  198. package/libs/floorplan/Components/SvgImage.svelte +0 -28
  199. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.svelte +0 -85
  200. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.svelte +0 -18
  201. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.svelte +0 -40
  202. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.svelte +0 -64
@@ -2,14 +2,14 @@ import { Subscribe } from '@realsee/five';
2
2
  import { Quaternion } from 'three';
3
3
  import objectAssignDeep from 'object-assign-deep';
4
4
  import { writable } from 'svelte/store';
5
- import PointTagSvelte from '../Components/PointTag.svelte';
6
- import TagContentSvelte from '../Components/Tag/index.svelte';
5
+ import PointTagSvelte from '../Components/PointTag';
6
+ import TagContentSvelte from '../Components/Tag/index';
7
7
  import { addDebugPoints, arrayPositionToVector3, actionAfterFiveModelLoad, debounce, normalPositionToPositions, planeNormal, resizeObserver, throttle, } from '../utils';
8
8
  import { TagComputer } from './TagComputer';
9
9
  import { CSS3DRenderPlugin } from '../../CSS3DRenderPlugin';
10
10
  import { DimensionType, PointType } from '../typings';
11
11
  // declare const __APP_VERSION__: string
12
- const VERSION = '1.1.0';
12
+ const VERSION = '1.1.1';
13
13
  const PLUGIN_NAME = `DnalogelPlugin-PanoTagPlugin@${VERSION}`;
14
14
  // 初始是否展开
15
15
  const TAG_INITIAL_UNFOLDED = false;
@@ -219,7 +219,7 @@ class PanoTagPluginController extends TagComputer {
219
219
  var _a, _b, _c, _d, _e, _f;
220
220
  this.disposeAllCSS3DContainer();
221
221
  (_a = this.PointTagSvelte) === null || _a === void 0 ? void 0 : _a.$destroy();
222
- this.filter3DTag().forEach((tag) => { var _a; return (_a = tag.tag3DContentSvelte) === null || _a === void 0 ? void 0 : _a.svelteApp.$destroy(); });
222
+ this.filter3DTag().forEach((tag) => { var _a; return (_a = tag.tag3DContentSvelte) === null || _a === void 0 ? void 0 : _aApp.$destroy(); });
223
223
  this.tags = [];
224
224
  (_b = this.store.disposers) === null || _b === void 0 ? void 0 : _b.forEach((d) => d === null || d === void 0 ? void 0 : d());
225
225
  this.store.disposers = [];
@@ -349,7 +349,7 @@ class PanoTagPluginController extends TagComputer {
349
349
  (_a = this.PointTagSvelte) === null || _a === void 0 ? void 0 : _a.$set({ tags: [] });
350
350
  this.filter3DTag().forEach((tag) => {
351
351
  var _a;
352
- (_a = tag.tag3DContentSvelte) === null || _a === void 0 ? void 0 : _a.svelteApp.$destroy();
352
+ (_a = tag.tag3DContentSvelte) === null || _a === void 0 ? void 0 : _aApp.$destroy();
353
353
  tag.tag3DContentSvelte = undefined;
354
354
  });
355
355
  }
@@ -483,7 +483,7 @@ class PanoTagPluginController extends TagComputer {
483
483
  (_a = this.PointTagSvelte) === null || _a === void 0 ? void 0 : _a.$set({ state: this.state, temporaryState: this.temporaryState, withAnimation: this.store.visibleWithAnimation });
484
484
  this.filter3DTag().forEach((tag) => {
485
485
  var _a;
486
- (_a = tag.tag3DContentSvelte) === null || _a === void 0 ? void 0 : _a.svelteApp.$set({
486
+ (_a = tag.tag3DContentSvelte) === null || _a === void 0 ? void 0 : _aApp.$set({
487
487
  state: this.state,
488
488
  temporaryState: this.temporaryState,
489
489
  withAnimation: this.store.visibleWithAnimation,
@@ -1,7 +1,7 @@
1
1
  import type { PanoTagPluginController } from '../index';
2
2
  import type { ContentType, DimensionType, TagId, PointType, Tag } from '../typings';
3
3
  import type * as BasePlugin from '../../base/BasePlugin';
4
- import type TagContentSvelte from '../Components/Tag/index.svelte';
4
+ import type TagContentSvelte from '../Components/Tag/index';
5
5
  import type { Vector3 } from 'three';
6
6
  import type { Create3DDomContainerReturnType } from '../../CSS3DRenderPlugin';
7
7
  import type { Writable } from 'svelte/store';
@@ -0,0 +1,2 @@
1
+ export default function nullishCoalescing<T>(value?: T | undefined | null, defaultValue?: T): T;
2
+ export { nullishCoalescing as nc };
@@ -0,0 +1,9 @@
1
+ export default function nullishCoalescing(value, defaultValue) {
2
+ if (value === undefined || value === null) {
3
+ return defaultValue;
4
+ }
5
+ else {
6
+ return value;
7
+ }
8
+ }
9
+ export { nullishCoalescing as nc };
@@ -1,7 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  import to from '../../shared-utils/to';
3
3
  import equal from '../../shared-utils/equal';
4
- import Main from '../Components/Main.svelte';
4
+ import Main from '../Components/Main';
5
5
  import formatData from '../utils/formatData';
6
6
  import { CAMERA_IMAGE } from '../Assets/camera';
7
7
  import { omit } from '../../shared-utils/filter';
@@ -1,6 +1,6 @@
1
1
  import to from '../../shared-utils/to';
2
2
  import equal from '../../shared-utils/equal';
3
- import Main from '../Components/Main.svelte';
3
+ import Main from '../Components/Main';
4
4
  import formatData from '../utils/formatData';
5
5
  import { CAMERA_IMAGE } from '../Assets/camera';
6
6
  import { omit } from '../../shared-utils/filter';
@@ -1,4 +1,4 @@
1
- import Main from './Components/Main.svelte';
1
+ import Main from './Components/Main';
2
2
  import equal from '../../shared-utils/equal';
3
3
  import { CAMERA_IMAGE } from '../Assets/camera';
4
4
  import * as BasePlugin from '../../base/BasePluginWithData';
@@ -1,6 +1,6 @@
1
1
  import * as THREE from 'three';
2
2
  import equal from '../../shared-utils/equal';
3
- import Main from '../Components/Main.svelte';
3
+ import Main from '../Components/Main';
4
4
  import formatData from '../utils/formatData';
5
5
  import { CAMERA_IMAGE } from '../Assets/camera';
6
6
  import { omit } from '../../shared-utils/filter';
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.1.0-alpha.16",
11
+ "version": "2.1.0-alpha.17",
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",
@@ -1,251 +0,0 @@
1
- <script>import { Five } from '@realsee/five';
2
- import "./typings";
3
- import { beforeUpdate, onDestroy, onMount } from "svelte";
4
- import * as THREE from 'three';
5
- import ItemLabelItem from './ItemLabelItem.svelte';
6
- import "./events.type";
7
- import debounce from '../shared-utils/debounce';
8
- import { isImpacted } from "./utils/isImpacted";
9
- import { getStrokeLength } from "./utils/getStrokeLength";
10
- import { getLabelTransform } from './utils/getLabelTransform';
11
- import { transform2RenderData } from "./utils/transform2RenderData";
12
- const { Raycaster, Vector3 } = THREE;
13
- export let five;
14
- export let modelOcclusionEnable;
15
- export let onlyVisibleInPanorama;
16
- export let itemLabels;
17
- export let hooks;
18
- export let displayStrategyType;
19
- export let maxVisibleDistance;
20
- let curItemLabels = null;
21
- let renderItemLabels = null;
22
- let anchorEnabled = (five === null || five === void 0 ? void 0 : five.currentMode) === Five.Mode.Panorama;
23
- let containerWidth;
24
- let containerHeight;
25
- // 计算重叠
26
- let cssOffsetLists = [];
27
- let cssHeight = 26;
28
- let basicWidth = 11;
29
- // 动画过程中 itemsVisible 为 false
30
- let itemsVisible = true;
31
- /**
32
- * 可见性策略:
33
- * 1、当前楼层(假设先不考虑多楼层)
34
- * 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
35
- * */
36
- const judgeImpacted = (five, itemLabel) => {
37
- // 虚拟 VR 仅有一层,不考虑楼层信息
38
- const cameraPosition = five.camera.position.clone();
39
- const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
40
- // 计算点到相机的位置
41
- const vectorDistance = modelPosition.distanceTo(cameraPosition);
42
- // 判断距离,大于最大可见距离直接不可见 TODO 把距离计算和碰撞拆分开
43
- if (maxVisibleDistance !== undefined && five.state.mode === Five.Mode.Panorama) {
44
- if (vectorDistance > maxVisibleDistance) {
45
- return false;
46
- }
47
- }
48
- return isImpacted(five, modelPosition.clone().sub(cameraPosition).normalize(), cameraPosition, vectorDistance);
49
- };
50
- const judgeInViewport = (modelPoint) => {
51
- const { camera, model } = five;
52
- const { x: offsetXFromCenter, y: offsetYFromCenter, z: offsetZFromCenter, } = modelPoint.clone().project(camera);
53
- const ratioFromLeft = (offsetXFromCenter + 1) / 2;
54
- const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
55
- const isFront = Math.abs(offsetZFromCenter) < 1;
56
- const cssOffset = [ratioFromLeft, ratioFromTop];
57
- // 只计算在前面就行
58
- const isInViewport = isFront && cssOffset.every((ratio) => ratio < 1 && ratio >= 0);
59
- return Boolean(isInViewport);
60
- };
61
- // cssOffset 获取
62
- const getLabelCssOffset = (five, itemLabel) => {
63
- const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
64
- const cssPosition = five.project2d(modelPosition);
65
- const xOffset = cssPosition === null || cssPosition === void 0 ? void 0 : cssPosition.x;
66
- const yOffset = cssPosition === null || cssPosition === void 0 ? void 0 : cssPosition.y;
67
- return [xOffset, yOffset];
68
- };
69
- // 重叠计算
70
- const isOverlap = (cssOffset, widthOffset) => {
71
- if (cssOffsetLists.length === 0) {
72
- return false;
73
- }
74
- const hasOverlapPoint = cssOffsetLists.find(item => ((cssOffset[0] >= item[0] - widthOffset && cssOffset[0] <= item[0] + widthOffset)
75
- || (cssOffset[1] >= item[1] - cssHeight && cssOffset[1] <= item[1] + cssHeight)));
76
- return !!hasOverlapPoint;
77
- };
78
- const getFormatedItemLabels = (five, labels) => {
79
- // 计算位置 & 可见性
80
- const newLabels = labels.map(label => {
81
- // 不在绑定点位则直接不可见
82
- if (five.state.panoIndex !== label.panoIndex) {
83
- return Object.assign(Object.assign({}, label), { visible: false });
84
- }
85
- const cssOffset = getLabelCssOffset(five, label);
86
- const curLabelWidth = label.name.length * basicWidth;
87
- const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
88
- // 是否加入碰撞检测
89
- // 配置加入碰撞检测,则判断碰撞检测
90
- // 在可见范围内, 仅在 Panorama 模态计算
91
- const isInViewport = five.currentMode === Five.Mode.Panorama
92
- ? judgeInViewport(new Vector3(label.position[0], label.position[1], label.position[2]))
93
- : true;
94
- // 碰撞
95
- const isBlocked = modelOcclusionEnable
96
- ? judgeImpacted(five, label)
97
- : false;
98
- const visible = isInViewport && !isBlocked;
99
- // 关掉重叠计算
100
- // const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
101
- if (!visible)
102
- return Object.assign(Object.assign({}, label), { visible });
103
- cssOffsetLists.push(cssOffset);
104
- // position
105
- const transform = getLabelTransform(cssOffset);
106
- return Object.assign(Object.assign({}, label), { visible, transform, strokeLength });
107
- });
108
- const sortedItemLabelItems = newLabels
109
- .filter(({ visible }) => visible)
110
- .map(label => ({
111
- itemLabelItem: label,
112
- distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
113
- }))
114
- .sort((a, b) => a.distance - b.distance);
115
- return newLabels.map(label => {
116
- const sortIndex = sortedItemLabelItems.findIndex(item => item.itemLabelItem.id === label.id);
117
- if (sortIndex !== undefined)
118
- return Object.assign(Object.assign({}, label), { zIndex: sortIndex * 10 });
119
- return label;
120
- });
121
- };
122
- const onItemLabelUpdate = () => {
123
- cssOffsetLists = [];
124
- renderItemLabels = getFormatedItemLabels(five, renderItemLabels);
125
- };
126
- const handleCameraUpdateCallback = () => {
127
- itemsVisible = false;
128
- handleCameraUpdate();
129
- };
130
- const onFiveModeChange = (mode) => {
131
- itemsVisible = false;
132
- five.once('initAnimationEnded', (panoIndex, pose, userAction) => {
133
- anchorEnabled = mode === Five.Mode.Panorama;
134
- itemsVisible = true;
135
- if (!userAction)
136
- return;
137
- else
138
- onItemLabelUpdate();
139
- });
140
- };
141
- const handleCameraUpdate = debounce(() => {
142
- itemsVisible = true;
143
- onItemLabelUpdate();
144
- }, 300);
145
- const onResize = () => {
146
- five.once('renderFrame', onItemLabelUpdate);
147
- };
148
- const addResizeListener = () => {
149
- window.addEventListener('resize', onResize, false);
150
- };
151
- const addDataUpdateListener = () => {
152
- if (curItemLabels !== itemLabels) {
153
- renderItemLabels = transform2RenderData(itemLabels);
154
- curItemLabels = itemLabels;
155
- onItemLabelUpdate();
156
- }
157
- };
158
- const getNearObserverPano = (fromPositionVector, observers) => {
159
- let candidates = [];
160
- for (let i = 0; i < observers.length; i++) {
161
- const { position: obVector, panoIndex } = observers[i];
162
- const distance = fromPositionVector.distanceTo(obVector);
163
- if (maxVisibleDistance === undefined || distance <= maxVisibleDistance || five.state.mode !== Five.Mode.Panorama) {
164
- candidates.push({
165
- panoIndex,
166
- obVector,
167
- distance
168
- });
169
- }
170
- }
171
- candidates = candidates.sort((a, b) => a.distance - b.distance);
172
- let observerIndex;
173
- for (let i = 0; i < candidates.length; i++) {
174
- const { obVector, distance, panoIndex } = candidates[i];
175
- const isImpactedRes = isImpacted(five, fromPositionVector, obVector, distance);
176
- if (!isImpactedRes) {
177
- observerIndex = panoIndex;
178
- break;
179
- }
180
- }
181
- return typeof observerIndex === "number" ? observers[observerIndex] : undefined;
182
- };
183
- const onIconClick = (itemLabel) => {
184
- if (five.state.mode === Five.Mode.Panorama)
185
- return;
186
- const observers = five.work.observers;
187
- const fromPositionVector = new Vector3().fromArray(itemLabel.position);
188
- const observer = getNearObserverPano(fromPositionVector, observers);
189
- if (observer) {
190
- itemLabel.observerIndex = observer.panoIndex;
191
- }
192
- if (typeof itemLabel.observerIndex === "number") {
193
- const observer = observers[itemLabel.observerIndex];
194
- const direction = fromPositionVector.clone().sub(observer.position).normalize();
195
- const cameraCoord = {
196
- longitude: Math.PI + Math.atan2(direction.x, direction.z),
197
- latitude: Math.acos(direction.y / direction.length()) - Math.PI / 2,
198
- };
199
- five.setState(Object.assign(Object.assign({}, cameraCoord), { mode: Five.Mode.Panorama, panoIndex: itemLabel.observerIndex }));
200
- // 游走结束更新 render list
201
- five.once('initAnimationEnded', () => {
202
- renderItemLabels = renderItemLabels.map(item => {
203
- return Object.assign(Object.assign({}, item), { isFold: item.id !== itemLabel.id });
204
- });
205
- five.once('cameraUpdate', () => {
206
- renderItemLabels = renderItemLabels.map(item => {
207
- return Object.assign(Object.assign({}, item), { isFold: false });
208
- });
209
- });
210
- });
211
- }
212
- };
213
- beforeUpdate(() => {
214
- addDataUpdateListener();
215
- });
216
- onMount(() => {
217
- renderItemLabels = transform2RenderData(itemLabels);
218
- curItemLabels = itemLabels;
219
- onItemLabelUpdate();
220
- addResizeListener();
221
- five.on('cameraUpdate', handleCameraUpdateCallback);
222
- // five.on('modeChange', onFiveModeChange)
223
- });
224
- onDestroy(() => {
225
- five.off('cameraUpdate', handleCameraUpdateCallback);
226
- // five.off('modeChange', onFiveModeChange)
227
- window.removeEventListener('resize', onResize, false);
228
- });
229
- </script>
230
-
231
- <div class="item-labels-container" bind:clientWidth="{containerWidth}" bind:clientHeight="{containerHeight}"
232
- style:opacity="{itemsVisible ? 1 : 0}">
233
- {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
234
- {#if itemLabelItem.visible}
235
- <ItemLabelItem
236
- itemLabel="{itemLabelItem}"
237
- hooks="{hooks}"
238
- anchorEnabled="{anchorEnabled}"
239
- onIconClick="{onIconClick}"
240
- />
241
- {/if}
242
- {/each}
243
- </div>
244
-
245
- <style>
246
- .item-labels-container {
247
- width: 100%;
248
- height: 100%;
249
- position: relative;
250
- }
251
- </style>
@@ -1,183 +0,0 @@
1
- <script>import "./events.type";
2
- import classNames from 'classnames';
3
- export let itemLabel;
4
- export let hooks;
5
- export let anchorEnabled;
6
- export let onIconClick;
7
- // const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n'
8
- function onClick() {
9
- hooks.emit('onLabelClick', itemLabel);
10
- }
11
- let customElement;
12
- $: {
13
- if (typeof itemLabel.render === 'function' && customElement) {
14
- if (customElement.children.length === 0) {
15
- const child = itemLabel.render(itemLabel);
16
- if (child) {
17
- customElement.appendChild(child);
18
- }
19
- }
20
- }
21
- }
22
- </script>
23
-
24
- <div class={classNames("item-label-item", { fold: itemLabel.isFold })}
25
- style:z-index="{itemLabel.zIndex}"
26
- style:transform="{itemLabel.transform}"
27
- >
28
- <div class={classNames("item-label-item__text-wrap", { 'item-label-item__custom': Boolean(typeof itemLabel.render === 'function') })}
29
- style="bottom: {`${itemLabel.strokeLength}px`}"
30
- on:click="{onClick}"
31
- >
32
- {#if Boolean(typeof itemLabel.render === 'function')}
33
- <div bind:this={customElement}></div>
34
- {:else}
35
- {#if itemLabel.icon}
36
- <div class="icon-wrap"
37
- on:click="{(e) => onIconClick(itemLabel)}"
38
- >
39
- <div class="icon" style={`background-image: url(${itemLabel.icon})`} ></div>
40
- </div>
41
- {/if}
42
- <div class="item-label-text">
43
- <span class="item-model">{itemLabel.code || itemLabel.id}</span>
44
- <span class="item-name">{itemLabel.name}</span>
45
- </div>
46
- {/if}
47
-
48
- </div>
49
- <div class={classNames("item-label-item__bar", { anchor: anchorEnabled })}
50
- style="height: {`${itemLabel.strokeLength}px`}">
51
- </div>
52
- </div>
53
-
54
- <style>
55
- .item-label-item {
56
- position: absolute;
57
- z-index: 0;
58
- transform: none;
59
- cursor: pointer;
60
- pointer-events: none;
61
- user-select: none;
62
- animation: fadeIn .3s ease-in;
63
- }
64
-
65
- .item-label-item.fold >.item-label-item__text-wrap {
66
- visibility: hidden;
67
- }
68
-
69
- .item-label-item.fold >.item-label-item__bar.anchor {
70
- visibility: hidden;
71
- }
72
-
73
- .item-label-item.fold >.item-label-item__bar.anchor:after {
74
- visibility: visible;
75
- }
76
-
77
- .item-label-item__text-wrap {
78
- height: fit-content;
79
- padding: 12px 20px 12px 12px;
80
- position: absolute;
81
- width: max-content;
82
- max-width: 473px;
83
- min-height: 92px;
84
- background-image: linear-gradient(269deg, rgba(0, 0, 0, 0.50) 0%, rgba(0, 0, 0, 0.60) 49%, rgba(31, 38, 46, 0.70) 100%);
85
- border: 1.5px solid rgba(255, 255, 255, .65);
86
- border-radius: 3px;
87
- color: white;
88
- transform: translate(-50%, 0);
89
- display: flex;
90
- justify-content: flex-start;
91
- align-items: center;
92
- box-sizing: border-box;
93
- overflow: hidden;
94
- pointer-events: all;
95
- }
96
-
97
- .item-label-item__custom {
98
- padding: 0;
99
- max-width: unset;
100
- min-height: unset;
101
- background-image: unset;
102
- border: 0;
103
- border-radius: 0;
104
- }
105
-
106
- .icon-wrap {
107
- width: 68px;
108
- height: 100%;
109
- display: flex;
110
- justify-content: center;
111
- align-content: center;
112
- }
113
-
114
- .icon {
115
- width: 68px;
116
- height: 68px;
117
- background-repeat: no-repeat;
118
- background-size: contain;
119
- background-position: center;
120
- }
121
-
122
- .item-label-text {
123
- margin-left: 12px;
124
- padding-left: 12px;
125
- min-height: 68px;
126
- height: auto;
127
- display: flex;
128
- flex-flow: column;
129
- justify-content: space-around;
130
- align-content: flex-start;
131
- border-left: solid rgba(255, 255, 255, .2) 1px;
132
- border-top: solid rgba(255, 255, 255, .2) 0;
133
- border-right: solid rgba(255, 255, 255, .2) 0;
134
- border-bottom: solid rgba(255, 255, 255, .2) 0;
135
- pointer-events: auto;
136
- }
137
-
138
- .item-model {
139
- white-space: nowrap;
140
- font-size: 22px;
141
- font-weight: bold;
142
- line-height: 30px;
143
- }
144
-
145
- .item-name {
146
- height: auto;
147
- word-wrap: break-word;
148
- word-break: break-all;
149
- font-size: 20px;
150
- line-height: 28px;
151
- }
152
-
153
- .item-label-item__bar {
154
- position: absolute;
155
- bottom: 0;
156
- width: 3px;
157
- background-image: linear-gradient(to bottom, white, rgba(255, 255, 255, 0));
158
- box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.20);
159
- pointer-events: none;
160
- }
161
-
162
- .item-label-item__bar.anchor:after {
163
- content: '';
164
- position: absolute;
165
- bottom: 0;
166
- width: 24px;
167
- height: 24px;
168
- background-image: url("//vrlab-public.ljcdn.com/common/file/web/67e7a198-28c9-47dc-879b-507bd3ae600c.png ");
169
- background-position: center;
170
- background-size: contain;
171
- transform: translate(-10.5px, 50%);
172
- }
173
-
174
- @keyframes fadeIn {
175
- from {
176
- opacity: 0
177
- }
178
- to {
179
- opacity: 1
180
- }
181
- }
182
- </style>
183
-