@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
@@ -1,155 +0,0 @@
1
- <script>import { DISPLAY_STRATEGY_TYPE } from "./typings";
2
- import { beforeUpdate, onDestroy, onMount } from "svelte";
3
- import * as THREE from 'three';
4
- import ItemLabelItem from './ItemLabelItem.svelte';
5
- import "./events.type";
6
- import debounce from '../shared-utils/debounce';
7
- const { Raycaster, Vector3 } = THREE;
8
- export let five;
9
- export let modelOcclusionEnable;
10
- export let itemLabels;
11
- export let hooks;
12
- export let displayStrategyType;
13
- let curItemLabels = null;
14
- let renderItemLabels = null;
15
- let containerWidth;
16
- let containerHeight;
17
- // 计算重叠
18
- let cssOffsetLists = [];
19
- let cssHeight = 26;
20
- let basicWidth = 11;
21
- // 动画过程中 itemsVisible 为 false
22
- let itemsVisible = true;
23
- /**
24
- * 可见性策略:
25
- * 1、当前楼层(假设先不考虑多楼层)
26
- * 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
27
- * */
28
- const getLabelVisible = (five, itemLabel) => {
29
- // 虚拟 VR 仅有一层,不考虑楼层信息
30
- const raycaster = new Raycaster();
31
- const cameraPosition = five.camera.position.clone();
32
- const modelPosition = new Vector3().fromArray(itemLabel.modelPosition);
33
- // 计算点到相机的位置
34
- const vectorDistance = modelPosition.distanceTo(cameraPosition);
35
- raycaster.set(cameraPosition.clone(), modelPosition.clone().sub(cameraPosition).normalize());
36
- const [intersection] = five.model.intersectRaycaster(raycaster);
37
- return !(intersection && intersection.distance + 1 < vectorDistance);
38
- };
39
- // cssOffset 获取
40
- const getLabelCssOffset = (five, itemLabel) => {
41
- const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
42
- const cssPosition = five.project2d(modelPosition);
43
- const xOffset = cssPosition === null || cssPosition === void 0 ? void 0 : cssPosition.x;
44
- const yOffset = cssPosition === null || cssPosition === void 0 ? void 0 : cssPosition.y;
45
- return [xOffset, yOffset];
46
- };
47
- const getLabelTransform = (cssOffset) => {
48
- return `translate(${cssOffset[0]}px, ${cssOffset[1]}px)`;
49
- };
50
- // 重叠计算
51
- const isOverlap = (cssOffset, widthOffset) => {
52
- if (cssOffsetLists.length === 0) {
53
- return false;
54
- }
55
- const hasOverlapPoint = cssOffsetLists.find(item => ((cssOffset[0] >= item[0] - widthOffset && cssOffset[0] <= item[0] + widthOffset)
56
- || (cssOffset[1] >= item[1] - cssHeight && cssOffset[1] <= item[1] + cssHeight)));
57
- return !!hasOverlapPoint;
58
- };
59
- function getStrokeLength(itemSpaceHeight, type) {
60
- switch (type) {
61
- case DISPLAY_STRATEGY_TYPE.SMALL:
62
- return Math.ceil(-27.78 * itemSpaceHeight + 85);
63
- case DISPLAY_STRATEGY_TYPE.MIDLLE:
64
- return Math.ceil(-38.9 * itemSpaceHeight + 130);
65
- case DISPLAY_STRATEGY_TYPE.LARGE:
66
- return Math.ceil(-44.44 * itemSpaceHeight + 140);
67
- case DISPLAY_STRATEGY_TYPE.EXTRA_LARGE:
68
- return Math.ceil(-92.59 * itemSpaceHeight + 300);
69
- }
70
- }
71
- const getFormatedItemLabels = (five, labels) => {
72
- // 计算位置 & 可见性
73
- const newLabels = labels.map(label => {
74
- const cssOffset = getLabelCssOffset(five, label);
75
- const curLabelWidth = label.name.length * basicWidth;
76
- const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
77
- // 是否加入碰撞检测
78
- const naturalVisible = modelOcclusionEnable ? getLabelVisible(five, label) : true;
79
- const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth);
80
- if (!visible)
81
- return Object.assign(Object.assign({}, label), { visible });
82
- cssOffsetLists.push(cssOffset);
83
- // position
84
- const transform = getLabelTransform(cssOffset);
85
- return Object.assign(Object.assign({}, label), { visible, transform, strokeLength });
86
- });
87
- const sortedItemLabelItems = newLabels
88
- .filter(({ visible }) => visible)
89
- .map(label => ({
90
- itemLabelItem: label,
91
- distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
92
- }))
93
- .sort((a, b) => a.distance - b.distance);
94
- return newLabels.map(label => {
95
- const sortIndex = sortedItemLabelItems.findIndex(item => item.itemLabelItem.id === label.id);
96
- if (sortIndex !== undefined)
97
- return Object.assign(Object.assign({}, label), { zIndex: sortIndex * 10 });
98
- return label;
99
- });
100
- };
101
- const onItemLabelUpdate = () => {
102
- cssOffsetLists = [];
103
- renderItemLabels = getFormatedItemLabels(five, renderItemLabels);
104
- };
105
- beforeUpdate(() => {
106
- addDataUpdateListener();
107
- });
108
- const handleCameraUpdateCallback = () => {
109
- itemsVisible = false;
110
- handleCameraUpdate();
111
- };
112
- onMount(() => {
113
- renderItemLabels = itemLabels;
114
- curItemLabels = itemLabels;
115
- onItemLabelUpdate();
116
- addResizeListener();
117
- five.on('cameraUpdate', handleCameraUpdateCallback);
118
- });
119
- const handleCameraUpdate = debounce(() => {
120
- itemsVisible = true;
121
- onItemLabelUpdate();
122
- }, 300);
123
- const addResizeListener = () => {
124
- window.addEventListener('resize', onResize, false);
125
- };
126
- const addDataUpdateListener = () => {
127
- if (curItemLabels !== itemLabels) {
128
- renderItemLabels = itemLabels;
129
- curItemLabels = itemLabels;
130
- onItemLabelUpdate();
131
- }
132
- };
133
- const onResize = () => {
134
- five.once('renderFrame', onItemLabelUpdate);
135
- };
136
- onDestroy(() => {
137
- five.off('cameraUpdate', handleCameraUpdateCallback);
138
- window.removeEventListener('resize', onResize, false);
139
- });
140
- </script>
141
-
142
- <div class="item-labels-container" bind:clientWidth="{containerWidth}" bind:clientHeight="{containerHeight}"
143
- style:opacity="{itemsVisible ? 1 : 0}">
144
- {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
145
- <ItemLabelItem itemLabel="{itemLabelItem}" hooks="{hooks}" />
146
- {/each}
147
- </div>
148
-
149
- <style>
150
- .item-labels-container {
151
- width: 100%;
152
- height: 100%;
153
- position: relative;
154
- }
155
- </style>
@@ -1,100 +0,0 @@
1
- <script>import "./events.type";
2
- import classNames from 'classnames';
3
- export let itemLabel;
4
- export let hooks;
5
- function onClick() {
6
- console.log('__onclick___: ', itemLabel);
7
- hooks.emit('onLabelClick', itemLabel);
8
- }
9
- </script>
10
-
11
- <div
12
- class={classNames("item-label-item", { visible: itemLabel.visible })}
13
- style:z-index="{itemLabel.zIndex}"
14
- style:transform="{itemLabel.transform}"
15
- >
16
- <div
17
- class="item-label-item__text-wrap"
18
- style="top: {`-${itemLabel.strokeLength + 26}px`}"
19
- >
20
- <span
21
- class="item-label-item__text"
22
- on:click="{onClick}"
23
- >{itemLabel.name.length > 6 ? `${itemLabel.name.slice(0, 6)}...` : itemLabel.name}</span>
24
- </div>
25
- <div
26
- class="item-label-item__bar"
27
- style="height: {`${itemLabel.strokeLength}px`}">
28
- </div>
29
- </div>
30
-
31
- <style>
32
- .item-label-item {
33
- position: absolute;
34
- z-index: 0;
35
- transform: none;
36
- cursor: pointer;
37
- pointer-events: none;
38
- user-select: none;
39
- opacity: 0;
40
- }
41
-
42
- .item-label-item.visible {
43
- opacity: 1;
44
- animation: fadeIn .3s ease-in;
45
- }
46
-
47
- .item-label-item__text-wrap::before {
48
- content: '';
49
- position: absolute;
50
- width: 100%;
51
- height: 100%;
52
- background-color: rgba(0, 0, 0, .3);
53
- filter: blur(16px);
54
- z-index: -1;
55
- }
56
-
57
- .item-label-item__text-wrap {
58
- padding: 6px 6px 0;
59
- position: absolute;
60
- height: 20px;
61
- pointer-events: all;
62
- background-size: 100% 100%;
63
- background-repeat: no-repeat;
64
- white-space: nowrap;
65
- line-height: 10px;
66
- font-size: 11px;
67
- font-weight: bold;
68
- color: #FFEAC0;
69
- transform: translate(-50%, 0);
70
- display: flex;
71
- justify-content: center;
72
- align-items: center;
73
- }
74
-
75
- .item-label-item__text {
76
- padding-bottom: 4px;
77
- border-top: 0 solid;
78
- border-left: 0 solid;
79
- border-right: 0 solid;
80
- border-bottom: 1px solid;
81
- border-image: linear-gradient(to right, rgba(234, 208, 154, 0), rgba(234, 208, 154, 100), rgba(234, 208, 154, 0)) 4.5 1 4.5;
82
- }
83
-
84
- .item-label-item__bar {
85
- position: absolute;
86
- bottom: 0;
87
- width: 1px;
88
- background-image: linear-gradient(to bottom, rgba(234, 208, 154, 0), rgba(234, 208, 154, 1));
89
- }
90
-
91
- @keyframes fadeIn {
92
- from {
93
- opacity: 0
94
- }
95
- to {
96
- opacity: 1
97
- }
98
- }
99
- </style>
100
-
@@ -1,63 +0,0 @@
1
- <script>import { ROOM_LABEL_BG } from './Assets/roomLabelBg';
2
- export let five;
3
- export let roomLabel;
4
- function onClick() {
5
- five.setState({ panoIndex: roomLabel.panoIndex, mode: 'Panorama', longitude: roomLabel.longitude });
6
- }
7
- </script>
8
-
9
- <div
10
- class="room-label-item"
11
- style:z-index="{roomLabel.zIndex}"
12
- style:transform="{roomLabel.transform}"
13
- style:opacity="{roomLabel.visible ? 1 : 0}"
14
- >
15
- <span
16
- class="room-label-item__text"
17
- class:wide="{roomLabel.name.length > 3}"
18
- style="background-image: url({ROOM_LABEL_BG})"
19
- on:click="{onClick}">{roomLabel.name}</span
20
- >
21
- <div class="room-label-item__bar"></div>
22
- </div>
23
-
24
- <style>
25
- .room-label-item {
26
- position: absolute;
27
- font-size: 8px;
28
- z-index: 0;
29
- transform: none;
30
- cursor: pointer;
31
- pointer-events: none;
32
- user-select: none;
33
- }
34
-
35
- .room-label-item__text {
36
- position: absolute;
37
- left: 0;
38
- top: -64px;
39
- transform: translate(-50%, 0);
40
- display: flex;
41
- justify-content: center;
42
- align-items: center;
43
- height: 20px;
44
- min-width: 32px;
45
- padding: 0 6px;
46
- pointer-events: all;
47
- background-size: 100% 100%;
48
- background-repeat: no-repeat;
49
- white-space: nowrap;
50
- }
51
-
52
- .room-label-item__bar {
53
- position: absolute;
54
- top: -44px;
55
- height: 48px;
56
- width: 1px;
57
- background-image: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
58
- }
59
-
60
- .wide {
61
- font-size: 10px;
62
- }
63
- </style>
@@ -1,91 +0,0 @@
1
- <script>var _a;
2
- import { onDestroy } from 'svelte';
3
- import { Raycaster, Vector3 } from 'three';
4
- import RoomLabelItem from './RoomLabelItem.svelte';
5
- export let five;
6
- export let roomLabels;
7
- let containerWidth;
8
- let containerHeight;
9
- let shownFloor = (_a = five.model.shownFloor) !== null && _a !== void 0 ? _a : null;
10
- $: rendererSize = { x: containerWidth, y: containerHeight };
11
- $: {
12
- // rendererSize 和 shownFloor 变化时,触发 reRender
13
- roomLabels = getFormatedRoomLabels({ rendererSize, shownFloor });
14
- }
15
- function getLabelVisible(item) {
16
- const isLabelInFloor = shownFloor === null || item.floorIndex === shownFloor;
17
- if (!isLabelInFloor)
18
- return false;
19
- const raycaster = new Raycaster();
20
- const cameraPosition = five.camera.position.clone();
21
- const position = new Vector3(item.position.x, item.position.y, item.position.z);
22
- const vectorDistance = position.distanceTo(cameraPosition);
23
- raycaster.set(cameraPosition.clone(), position.clone().sub(cameraPosition).normalize());
24
- const [intersection] = five.model.intersectRaycaster(raycaster);
25
- if (intersection && intersection.distance + 1 < vectorDistance)
26
- return false;
27
- return true;
28
- }
29
- function getLabelTransform(item, rendererSize) {
30
- const position = new Vector3(item.position.x, item.position.y, item.position.z);
31
- const mouse = position.clone().project(five.camera);
32
- const xOffset = Math.ceil(((mouse.x + 1) / 2) * rendererSize.x);
33
- const yOffset = Math.ceil(((-mouse.y + 1) / 2) * rendererSize.y);
34
- return `translate(${xOffset}px, ${yOffset}px)`;
35
- }
36
- function getFormatedRoomLabels(params) {
37
- const { rendererSize, shownFloor } = params;
38
- // 因为 item distance 需要重复计算,所以缓存一下
39
- const distanceMap = new Map();
40
- function getItemDistance(item) {
41
- const cacheDistance = distanceMap.get(item.id);
42
- if (cacheDistance)
43
- return cacheDistance;
44
- const { x, y, z } = item.position;
45
- const distance = new Vector3(x, y, z).clone().distanceTo(five.camera.position);
46
- distanceMap.set(item.id, distance);
47
- return distance;
48
- }
49
- const formatedItems = roomLabels.map((item) => {
50
- const visible = getLabelVisible(item);
51
- const transform = visible ? getLabelTransform(item, rendererSize) : item.transform;
52
- const itemDistance = getItemDistance(item);
53
- // visible === true 的 item 中,distance 比自己小的 item 个数
54
- const minItemLen = roomLabels.filter((item) => item.visible && getItemDistance(item) < itemDistance).length;
55
- const zIndex = minItemLen * 10;
56
- return Object.assign(Object.assign({}, item), { visible, transform, zIndex });
57
- });
58
- return formatedItems;
59
- }
60
- function onFiveCameraUpdate() {
61
- roomLabels = getFormatedRoomLabels({ rendererSize, shownFloor });
62
- }
63
- function onFiveModelShownFloorChange(floorIndex) {
64
- shownFloor = floorIndex;
65
- }
66
- five.on('cameraUpdate', onFiveCameraUpdate);
67
- five.on('modelShownFloorChange', onFiveModelShownFloorChange);
68
- onDestroy(() => {
69
- five.off('cameraUpdate', onFiveCameraUpdate);
70
- five.off('modelShownFloorChange', onFiveModelShownFloorChange);
71
- });
72
- </script>
73
-
74
- <div
75
- class="room-labels-container"
76
- bind:clientWidth="{containerWidth}"
77
- bind:clientHeight="{containerHeight}"
78
- >
79
- {#each roomLabels as roomLableItem (roomLableItem.id)}
80
- <RoomLabelItem roomLabel="{roomLableItem}" five="{five}" />
81
- {/each}
82
- </div>
83
-
84
- <style>
85
- .room-labels-container {
86
- width: 100%;
87
- height: 100%;
88
- position: relative;
89
- color: #fff;
90
- }
91
- </style>
@@ -1,200 +0,0 @@
1
- <script>import classnames from 'classnames';
2
- export let props;
3
- export let onClick;
4
- let divElement;
5
- let { left, top, inSight, transform, panoIndex, cameraToward, name } = props;
6
- let prevPanoIndexRef = 0;
7
- const initPanoIndex = () => {
8
- if (!left || !top || !inSight) {
9
- return;
10
- }
11
- if (!divElement)
12
- return;
13
- const _width = (divElement.current.clientWidth / window.innerWidth) * 100;
14
- const _height = (divElement.current.clientHeight / window.innerHeight) * 100;
15
- if (left <= _width / 2 || left >= 100 - _width / 2) {
16
- return;
17
- }
18
- if (top <= _height / 2 || top >= 100 - _height / 2) {
19
- return;
20
- }
21
- const prevPanoIndex = prevPanoIndexRef;
22
- if (panoIndex !== prevPanoIndex) {
23
- // 触发埋点
24
- console.log('panoDoorLabelPlugin', panoIndex, '触发埋点');
25
- // 这里触发曝光埋点
26
- prevPanoIndexRef = panoIndex;
27
- }
28
- };
29
- $: {
30
- initPanoIndex();
31
- }
32
- </script>
33
-
34
- <template>
35
- <div
36
- bind:this="{divElement}"
37
- style="{`left: ${left || 0}%;top: ${top || 0}%;opacity: ${inSight ? 1 : 0}`}"
38
- class="plugin-DoorLabelPlugin-item"
39
- >
40
- <div
41
- class="{classnames('plugin-DoorLabelPlugin-cnt', props.toward)}"
42
- style="{`transform: ${transform || 'initial'};pointer-events: ${
43
- inSight ? 'auto' : 'none'
44
- };opacity: ${inSight ? 1 : 0}`}"
45
- data-camera-toward="{cameraToward}"
46
- on:click="{(e) => {
47
- if (onClick) onClick()
48
- }}"
49
- >
50
- <span class="plugin-DoorLabelPlugin-txt">{name}</span>
51
- <i class="plugin-DoorLabelPlugin-icon"></i>
52
- </div>
53
- </div>
54
- </template>
55
-
56
- <style lang="scss">
57
- .plugin-DoorLabelPlugin-item {
58
- position: absolute;
59
- left: 0;
60
- top: 0;
61
- width: 0;
62
- height: 0;
63
- pointer-events: none;
64
- transition: opacity 0.3s ease;
65
- }
66
-
67
- .plugin-DoorLabelPlugin-cnt {
68
- position: absolute;
69
- top: 50%;
70
- left: 50%;
71
- border-radius: 2px;
72
- background: rgba(0, 0, 0, 0.35);
73
- line-height: 12px;
74
- padding: 6px;
75
- white-space: nowrap;
76
- font-size: 12px;
77
- font-style: normal;
78
- // pointer-events: auto;
79
- color: white;
80
- display: flex;
81
- align-items: center;
82
- justify-content: center;
83
- cursor: pointer;
84
- transition: transform ease 1s, background ease 0.3s, color ease 0.3s;
85
- &::after {
86
- content: '';
87
- display: block;
88
- position: absolute;
89
- top: -1px;
90
- left: -1px;
91
- bottom: -1px;
92
- right: -1px;
93
- border-radius: 2px;
94
- border: 1px solid rgba(0, 0, 0, 0);
95
- border-image: url('//vrlab-image4.ljcdn.com/release/web/highlightCarouseal-border-image.14b51834.png')
96
- 4;
97
- transition: opacity ease 0.3s;
98
- }
99
- &:active,
100
- &:focus {
101
- background: rgba(0, 0, 0, 0.5);
102
- color: rgba(255, 255, 255, 0.5);
103
- }
104
- }
105
-
106
- .plugin-DoorLabelPlugin-icon {
107
- background: url('//vrlab-image4.ljcdn.com/release/web/DoorLabel-icon.de1304ae.svg') no-repeat;
108
- background-size: 100%;
109
- display: inline-block;
110
- width: 10px;
111
- height: 10px;
112
- margin-left: 4px;
113
- transform-origin: center;
114
- }
115
-
116
- .plugin-DoorLabelPlugin-cnt[data-camera-toward='forward'] {
117
- &.left {
118
- .plugin-DoorLabelPlugin-icon {
119
- transform: rotate(90deg);
120
- }
121
- }
122
- &.right {
123
- .plugin-DoorLabelPlugin-txt {
124
- order: 1;
125
- }
126
- .plugin-DoorLabelPlugin-icon {
127
- transform: rotate(-90deg);
128
- margin-left: 0;
129
- margin-right: 4px;
130
- order: 0;
131
- }
132
- }
133
- }
134
- .plugin-DoorLabelPlugin-cnt[data-camera-toward='right'] {
135
- &.forward {
136
- .plugin-DoorLabelPlugin-icon {
137
- transform: rotate(90deg);
138
- }
139
- }
140
- &.back {
141
- .plugin-DoorLabelPlugin-txt {
142
- order: 1;
143
- }
144
- .plugin-DoorLabelPlugin-icon {
145
- transform: rotate(-90deg);
146
- margin-left: 0;
147
- margin-right: 4px;
148
- order: 0;
149
- }
150
- }
151
- }
152
- .plugin-DoorLabelPlugin-cnt[data-camera-toward='left'] {
153
- &.back {
154
- .plugin-DoorLabelPlugin-icon {
155
- transform: rotate(90deg);
156
- }
157
- }
158
- &.forward {
159
- .plugin-DoorLabelPlugin-txt {
160
- order: 1;
161
- }
162
- .plugin-DoorLabelPlugin-icon {
163
- transform: rotate(-90deg);
164
- margin-left: 0;
165
- margin-right: 4px;
166
- order: 0;
167
- }
168
- }
169
- }
170
- .plugin-DoorLabelPlugin-cnt[data-camera-toward='back'] {
171
- &.right {
172
- .plugin-DoorLabelPlugin-icon {
173
- transform: rotate(90deg);
174
- }
175
- }
176
- &.left {
177
- .plugin-DoorLabelPlugin-txt {
178
- order: 1;
179
- }
180
- .plugin-DoorLabelPlugin-icon {
181
- transform: rotate(-90deg);
182
- margin-left: 0;
183
- margin-right: 4px;
184
- order: 0;
185
- }
186
- }
187
- }
188
-
189
- .plugin-DoorLabelPlugin-cnt--customBrand {
190
- color: #f9eac1;
191
- .plugin-DoorLabelPlugin-icon {
192
- background: url('//vrlab-image4.ljcdn.com/release/web/arrow.6e8ec00e.svg') no-repeat;
193
- }
194
- &:active,
195
- &:focus {
196
- background: rgba(0, 0, 0, 0.5);
197
- color: rgba(249, 234, 193, 0.5);
198
- }
199
- }
200
- </style>