@realsee/dnalogel 2.0.0-alpha.10 → 2.0.0-alpha.13

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 (123) hide show
  1. package/dist/CSS3DRenderPlugin/index.js +17 -14
  2. package/dist/CameraMovementPlugin/index.js +40 -15
  3. package/dist/ModelChassisCompassPlugin/index.js +32 -6
  4. package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
  5. package/dist/ModelItemLabelPlugin/events.type.d.ts +9 -0
  6. package/dist/ModelItemLabelPlugin/index.d.ts +4 -0
  7. package/dist/ModelItemLabelPlugin/index.js +679 -0
  8. package/dist/ModelItemLabelPlugin/typings.d.ts +55 -0
  9. package/dist/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
  10. package/dist/ModelRoomLabelPlugin/index.js +71 -28
  11. package/dist/PanoCompassPlugin/index.js +311 -164
  12. package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
  13. package/dist/PanoMeasurePlugin/index.js +1337 -583
  14. package/dist/PanoRulerPlugin/index.js +32 -5
  15. package/dist/PanoSpatialTagPlugin/index.js +73 -38
  16. package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
  17. package/dist/floorplan/ModelFloorplanPlugin/index.js +678 -439
  18. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
  19. package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
  20. package/dist/floorplan/TopviewFloorplanPlugin/index.js +403 -230
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.es.js +3596 -1612
  23. package/dist/index.js +3602 -1616
  24. package/dist/index.umd.js +3605 -1620
  25. package/docs/assets/main.js +1 -1
  26. package/docs/assets/search.js +1 -1
  27. package/docs/classes/ModelRoomLabelController.html +6 -6
  28. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  29. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  30. package/docs/index.html +1 -1
  31. package/docs/interfaces/LineJson.html +1 -1
  32. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  33. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  34. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  35. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  36. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  37. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  38. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  39. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  40. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  41. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  42. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  43. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  44. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  45. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  46. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  47. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  48. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  49. package/docs/interfaces/PointJson.html +1 -1
  50. package/docs/interfaces/RoomLabel.html +7 -7
  51. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
  52. package/docs/modules.html +12 -12
  53. package/libs/CSS3DRenderPlugin/index.js +16 -13
  54. package/libs/CameraMovementPlugin/index.js +24 -15
  55. package/libs/ModelChassisCompassPlugin/index.js +14 -5
  56. package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
  57. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +422 -0
  58. package/libs/ModelItemLabelPlugin/ItemLabelItem.js +133 -0
  59. package/libs/ModelItemLabelPlugin/events.type.d.ts +9 -0
  60. package/libs/ModelItemLabelPlugin/events.type.js +1 -0
  61. package/libs/ModelItemLabelPlugin/index.d.ts +4 -0
  62. package/libs/ModelItemLabelPlugin/index.js +172 -0
  63. package/libs/ModelItemLabelPlugin/typings.d.ts +55 -0
  64. package/libs/ModelItemLabelPlugin/typings.js +6 -0
  65. package/libs/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
  66. package/libs/ModelItemLabelPlugin/utils/parseData.js +4 -0
  67. package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
  68. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +7 -5
  69. package/libs/PanoCompassPlugin/index.js +225 -128
  70. package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
  71. package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
  72. package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
  73. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
  74. package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
  75. package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
  76. package/libs/PanoMeasurePlugin/Model/index.js +30 -5
  77. package/libs/PanoMeasurePlugin/Model/line.js +60 -10
  78. package/libs/PanoMeasurePlugin/Model/point.js +24 -4
  79. package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
  80. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
  81. package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
  82. package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
  83. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
  84. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
  85. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
  86. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
  87. package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
  88. package/libs/PanoMeasurePlugin/utils/line.js +8 -7
  89. package/libs/PanoRulerPlugin/index.js +16 -5
  90. package/libs/PanoSpatialTagPlugin/Components/tag.js +9 -9
  91. package/libs/PanoSpatialTagPlugin/index.js +11 -9
  92. package/libs/floorplan/Components/BaseImage.js +10 -5
  93. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
  94. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
  95. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +24 -11
  96. package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +77 -69
  97. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
  98. package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
  99. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +457 -273
  100. package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
  101. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
  102. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
  103. package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
  104. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +232 -108
  105. package/libs/floorplan/utils/formatData.js +43 -28
  106. package/libs/floorplan/utils/formatPosition.js +1 -1
  107. package/libs/index.d.ts +1 -0
  108. package/libs/index.js +2 -0
  109. package/libs/shared-utils/Subscribe.js +8 -1
  110. package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
  111. package/libs/shared-utils/createCanvasTextTexture.js +6 -5
  112. package/libs/shared-utils/five/changeMode.js +23 -12
  113. package/libs/shared-utils/getPxmm.js +1 -1
  114. package/libs/shared-utils/math/evenNumber.js +1 -1
  115. package/libs/shared-utils/three/loadFbxObj.js +20 -9
  116. package/libs/shared-utils/three/loadTexture.js +17 -6
  117. package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
  118. package/libs/shared-utils/tinyEJSrender.js +36 -6
  119. package/libs/shared-utils/to.js +21 -10
  120. package/libs/shared-utils/useDebounce.js +1 -1
  121. package/libs/shared-utils/useThrottle.js +2 -1
  122. package/package.json +2 -2
  123. package/CHANGELOG.md +0 -34
@@ -0,0 +1,422 @@
1
+ /* generated by Svelte v3.47.0 */
2
+ import {
3
+ SvelteComponent,
4
+ add_render_callback,
5
+ add_resize_listener,
6
+ append_styles,
7
+ attr,
8
+ check_outros,
9
+ create_component,
10
+ destroy_component,
11
+ detach,
12
+ element,
13
+ empty,
14
+ group_outros,
15
+ init,
16
+ insert,
17
+ mount_component,
18
+ outro_and_destroy_block,
19
+ safe_not_equal,
20
+ transition_in,
21
+ transition_out,
22
+ update_keyed_each
23
+ } from "svelte/internal";
24
+
25
+ import { DISPLAY_STRATEGY_TYPE } from "./typings";
26
+ import { beforeUpdate, onDestroy, onMount } from "svelte";
27
+ import * as THREE from 'three';
28
+ import ItemLabelItem from './ItemLabelItem';
29
+ import "./events.type";
30
+
31
+ function add_css(target) {
32
+ append_styles(target, "svelte-rmdeb", ".item-labels-container.svelte-rmdeb{width:100%;height:100%;position:relative}");
33
+ }
34
+
35
+ function get_each_context(ctx, list, i) {
36
+ const child_ctx = ctx.slice();
37
+ child_ctx[26] = list[i];
38
+ return child_ctx;
39
+ }
40
+
41
+ // (179:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
42
+ function create_each_block(key_1, ctx) {
43
+ let first;
44
+ let itemlabelitem;
45
+ let current;
46
+
47
+ itemlabelitem = new ItemLabelItem({
48
+ props: {
49
+ itemLabel: /*itemLabelItem*/ ctx[26],
50
+ hooks: /*hooks*/ ctx[0]
51
+ }
52
+ });
53
+
54
+ return {
55
+ key: key_1,
56
+ first: null,
57
+ c() {
58
+ first = empty();
59
+ create_component(itemlabelitem.$$.fragment);
60
+ this.first = first;
61
+ },
62
+ m(target, anchor) {
63
+ insert(target, first, anchor);
64
+ mount_component(itemlabelitem, target, anchor);
65
+ current = true;
66
+ },
67
+ p(new_ctx, dirty) {
68
+ ctx = new_ctx;
69
+ const itemlabelitem_changes = {};
70
+ if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[26];
71
+ if (dirty & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
72
+ itemlabelitem.$set(itemlabelitem_changes);
73
+ },
74
+ i(local) {
75
+ if (current) return;
76
+ transition_in(itemlabelitem.$$.fragment, local);
77
+ current = true;
78
+ },
79
+ o(local) {
80
+ transition_out(itemlabelitem.$$.fragment, local);
81
+ current = false;
82
+ },
83
+ d(detaching) {
84
+ if (detaching) detach(first);
85
+ destroy_component(itemlabelitem, detaching);
86
+ }
87
+ };
88
+ }
89
+
90
+ function create_fragment(ctx) {
91
+ let div;
92
+ let each_blocks = [];
93
+ let each_1_lookup = new Map();
94
+ let div_resize_listener;
95
+ let current;
96
+ let each_value = /*renderItemLabels*/ ctx[1];
97
+ const get_key = ctx => /*itemLabelItem*/ ctx[26].id;
98
+
99
+ for (let i = 0; i < each_value.length; i += 1) {
100
+ let child_ctx = get_each_context(ctx, each_value, i);
101
+ let key = get_key(child_ctx);
102
+ each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx));
103
+ }
104
+
105
+ return {
106
+ c() {
107
+ div = element("div");
108
+
109
+ for (let i = 0; i < each_blocks.length; i += 1) {
110
+ each_blocks[i].c();
111
+ }
112
+
113
+ attr(div, "class", "item-labels-container svelte-rmdeb");
114
+ add_render_callback(() => /*div_elementresize_handler*/ ctx[9].call(div));
115
+ },
116
+ m(target, anchor) {
117
+ insert(target, div, anchor);
118
+
119
+ for (let i = 0; i < each_blocks.length; i += 1) {
120
+ each_blocks[i].m(div, null);
121
+ }
122
+
123
+ div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[9].bind(div));
124
+ current = true;
125
+ },
126
+ p(ctx, [dirty]) {
127
+ if (dirty & /*renderItemLabels, hooks*/ 3) {
128
+ each_value = /*renderItemLabels*/ ctx[1];
129
+ group_outros();
130
+ each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, outro_and_destroy_block, create_each_block, null, get_each_context);
131
+ check_outros();
132
+ }
133
+ },
134
+ i(local) {
135
+ if (current) return;
136
+
137
+ for (let i = 0; i < each_value.length; i += 1) {
138
+ transition_in(each_blocks[i]);
139
+ }
140
+
141
+ current = true;
142
+ },
143
+ o(local) {
144
+ for (let i = 0; i < each_blocks.length; i += 1) {
145
+ transition_out(each_blocks[i]);
146
+ }
147
+
148
+ current = false;
149
+ },
150
+ d(detaching) {
151
+ if (detaching) detach(div);
152
+
153
+ for (let i = 0; i < each_blocks.length; i += 1) {
154
+ each_blocks[i].d();
155
+ }
156
+
157
+ div_resize_listener();
158
+ }
159
+ };
160
+ }
161
+
162
+ let cssHeight = 26;
163
+ let basicWidth = 11;
164
+
165
+ function instance($$self, $$props, $$invalidate) {
166
+ const { Raycaster, Vector3 } = THREE;
167
+ let { five } = $$props;
168
+ let { modelOcclusionEnable } = $$props;
169
+ let { itemLabels } = $$props;
170
+ let { wrapper } = $$props;
171
+ let { hooks } = $$props;
172
+ let { displayStrategyType } = $$props;
173
+ let curItemLabels = null;
174
+ let renderItemLabels = null;
175
+ let wrapperSize = { width: 0, height: 0 };
176
+ let containerWidth;
177
+ let containerHeight;
178
+
179
+ // 计算重叠
180
+ let cssOffsetLists = [];
181
+
182
+ /**
183
+ * 可见性策略:
184
+ * 1、当前楼层(假设先不考虑多楼层)
185
+ * 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
186
+ * */
187
+ // 画辅助线
188
+ function addHelper(x, y, z, type, helper) {
189
+ let geometry, materials, mesh;
190
+
191
+ if (type === 'box') {
192
+ geometry = new THREE.BoxGeometry(0.6, 2.5, 1.010696);
193
+ let mats = [];
194
+
195
+ for (let i = 0; i < geometry.faces.length; i++) {
196
+ const material = new THREE.MeshBasicMaterial({
197
+ color: new THREE.Color(Math.random() * 0xffffff)
198
+ });
199
+
200
+ mats.push(material);
201
+ }
202
+
203
+ materials = mats;
204
+ } else if (type === 'ball') {
205
+ geometry = new THREE.SphereGeometry(0.02, 0.02, 64);
206
+ materials = new THREE.MeshBasicMaterial({ color: new THREE.Color(0xffffff) });
207
+ }
208
+
209
+ mesh = new THREE.Mesh(geometry, materials);
210
+
211
+ // y 轴需要加一半的高度,因为position是从地面开始的,或者我应该算偏移更合理
212
+ mesh.position.set(x, y, z);
213
+
214
+ if (helper) {
215
+ const helper = new THREE.AxesHelper(5);
216
+ mesh.add(helper);
217
+ }
218
+
219
+ five.scene.add(mesh);
220
+ }
221
+
222
+ const getLabelVisible = (five, itemLabel) => {
223
+ // 虚拟 VR 仅有一层,不考虑楼层信息
224
+ const raycaster = new Raycaster();
225
+
226
+ const cameraPosition = five.camera.position.clone();
227
+ const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
228
+
229
+ // 计算点到相机的位置
230
+ const vectorDistance = modelPosition.distanceTo(cameraPosition);
231
+
232
+ raycaster.set(cameraPosition.clone(), modelPosition.clone().sub(cameraPosition).normalize());
233
+ const [intersection] = five.model.intersectRaycaster(raycaster);
234
+ return !(intersection && intersection.distance + 1 < vectorDistance);
235
+ };
236
+
237
+ // cssOffset 获取
238
+ const getLabelCssOffset = (five, itemLabel) => {
239
+ const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
240
+ const cssPosition = five.project2d(modelPosition);
241
+
242
+ const xOffset = cssPosition === null || cssPosition === void 0
243
+ ? void 0
244
+ : cssPosition.x;
245
+
246
+ const yOffset = cssPosition === null || cssPosition === void 0
247
+ ? void 0
248
+ : cssPosition.y;
249
+
250
+ return [xOffset, yOffset];
251
+ };
252
+
253
+ const getLabelTransform = cssOffset => {
254
+ return `translate(${cssOffset[0]}px, ${cssOffset[1]}px)`;
255
+ };
256
+
257
+ // 重叠计算
258
+ const isOverlap = (cssOffset, widthOffset) => {
259
+ if (cssOffsetLists.length === 0) {
260
+ return false;
261
+ }
262
+
263
+ const hasOverlapPoint = cssOffsetLists.find(item => cssOffset[0] >= item[0] - widthOffset && cssOffset[0] <= item[0] + widthOffset || cssOffset[1] >= item[1] - cssHeight && cssOffset[1] <= item[1] + cssHeight);
264
+ return !!hasOverlapPoint;
265
+ };
266
+
267
+ function getStrokeLength(itemSpaceHeight, type) {
268
+ switch (type) {
269
+ case DISPLAY_STRATEGY_TYPE.SMALL:
270
+ return Math.ceil(-27.78 * itemSpaceHeight + 85);
271
+ case DISPLAY_STRATEGY_TYPE.MIDLLE:
272
+ return Math.ceil(-38.9 * itemSpaceHeight + 130);
273
+ case DISPLAY_STRATEGY_TYPE.LARGE:
274
+ return Math.ceil(-44.44 * itemSpaceHeight + 140);
275
+ }
276
+ }
277
+
278
+ const getFormatedItemLabels = (five, labels) => {
279
+ // 计算位置 & 可见性
280
+ const newLabels = labels.map(label => {
281
+ const cssOffset = getLabelCssOffset(five, label);
282
+ const curLabelWidth = label.name.length * basicWidth;
283
+ const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
284
+
285
+ // 是否加入碰撞检测
286
+ const naturalVisible = modelOcclusionEnable
287
+ ? getLabelVisible(five, label)
288
+ : true;
289
+
290
+ const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth);
291
+ if (!visible) return Object.assign(Object.assign({}, label), { visible });
292
+ cssOffsetLists.push(cssOffset);
293
+
294
+ // position
295
+ const transform = getLabelTransform(cssOffset);
296
+
297
+ return Object.assign(Object.assign({}, label), { visible, transform, strokeLength });
298
+ });
299
+
300
+ const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
301
+ itemLabelItem: label,
302
+ distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
303
+ })).sort((a, b) => a.distance - b.distance);
304
+
305
+ return newLabels.map(label => {
306
+ const sortIndex = sortedItemLabelItems.findIndex(item => item.itemLabelItem.id === label.id);
307
+ if (sortIndex !== undefined) return Object.assign(Object.assign({}, label), { zIndex: sortIndex * 10 });
308
+ return label;
309
+ });
310
+ };
311
+
312
+ const onItemLabelUpdate = () => {
313
+ cssOffsetLists = [];
314
+ $$invalidate(1, renderItemLabels = getFormatedItemLabels(five, renderItemLabels));
315
+ };
316
+
317
+ beforeUpdate(() => {
318
+ addDataUpdateListener();
319
+ });
320
+
321
+ onMount(() => {
322
+ $$invalidate(1, renderItemLabels = itemLabels);
323
+ curItemLabels = itemLabels;
324
+ onItemLabelUpdate();
325
+
326
+ // five.on('cameraUpdate', onItemLabelUpdate)
327
+ addResizeListener();
328
+ });
329
+
330
+ const addResizeListener = () => {
331
+ wrapperSize = {
332
+ width: wrapper.clientWidth,
333
+ height: wrapper.clientHeight
334
+ };
335
+
336
+ resizeObserver.observe(wrapper);
337
+ };
338
+
339
+ const addDataUpdateListener = () => {
340
+ if (curItemLabels !== itemLabels) {
341
+ $$invalidate(1, renderItemLabels = itemLabels);
342
+ curItemLabels = itemLabels;
343
+ console.log('--debug--update--');
344
+ onItemLabelUpdate();
345
+ }
346
+ };
347
+
348
+ const resizeObserver = new ResizeObserver(entries => {
349
+ const entry = entries[0];
350
+ const target = entry.target;
351
+ const curWidth = target.clientWidth;
352
+ const curHeight = target.clientHeight;
353
+
354
+ if (wrapperSize.width !== curWidth || wrapperSize.height !== curHeight) {
355
+ wrapperSize = { width: curWidth, height: curHeight };
356
+ onItemLabelUpdate();
357
+ }
358
+ });
359
+
360
+ onDestroy(() => {
361
+ // five.off('cameraUpdate', onItemLabelUpdate)
362
+ resizeObserver.unobserve(wrapper);
363
+
364
+ curItemLabels = null;
365
+ $$invalidate(1, renderItemLabels = null);
366
+ wrapperSize = { width: 0, height: 0 };
367
+ });
368
+
369
+ function div_elementresize_handler() {
370
+ containerWidth = this.clientWidth;
371
+ containerHeight = this.clientHeight;
372
+ $$invalidate(2, containerWidth);
373
+ $$invalidate(3, containerHeight);
374
+ }
375
+
376
+ $$self.$$set = $$props => {
377
+ if ('five' in $$props) $$invalidate(4, five = $$props.five);
378
+ if ('modelOcclusionEnable' in $$props) $$invalidate(5, modelOcclusionEnable = $$props.modelOcclusionEnable);
379
+ if ('itemLabels' in $$props) $$invalidate(6, itemLabels = $$props.itemLabels);
380
+ if ('wrapper' in $$props) $$invalidate(7, wrapper = $$props.wrapper);
381
+ if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
382
+ if ('displayStrategyType' in $$props) $$invalidate(8, displayStrategyType = $$props.displayStrategyType);
383
+ };
384
+
385
+ return [
386
+ hooks,
387
+ renderItemLabels,
388
+ containerWidth,
389
+ containerHeight,
390
+ five,
391
+ modelOcclusionEnable,
392
+ itemLabels,
393
+ wrapper,
394
+ displayStrategyType,
395
+ div_elementresize_handler
396
+ ];
397
+ }
398
+
399
+ class Component extends SvelteComponent {
400
+ constructor(options) {
401
+ super();
402
+
403
+ init(
404
+ this,
405
+ options,
406
+ instance,
407
+ create_fragment,
408
+ safe_not_equal,
409
+ {
410
+ five: 4,
411
+ modelOcclusionEnable: 5,
412
+ itemLabels: 6,
413
+ wrapper: 7,
414
+ hooks: 0,
415
+ displayStrategyType: 8
416
+ },
417
+ add_css
418
+ );
419
+ }
420
+ }
421
+
422
+ export default Component;
@@ -0,0 +1,133 @@
1
+ /* generated by Svelte v3.47.0 */
2
+ import {
3
+ SvelteComponent,
4
+ append,
5
+ append_styles,
6
+ attr,
7
+ detach,
8
+ element,
9
+ init,
10
+ insert,
11
+ listen,
12
+ noop,
13
+ null_to_empty,
14
+ safe_not_equal,
15
+ set_data,
16
+ set_style,
17
+ space,
18
+ text
19
+ } from "svelte/internal";
20
+
21
+ import "./events.type";
22
+ import classNames from 'classnames';
23
+
24
+ function add_css(target) {
25
+ append_styles(target, "svelte-1mttyji", ".item-label-item.svelte-1mttyji{position:absolute;z-index:0;transform:none;cursor:pointer;pointer-events:none;user-select:none;opacity:0}.item-label-item.visible.svelte-1mttyji{opacity:1;animation:svelte-1mttyji-fadeIn .3s ease-in}.item-label-item__text-wrap.svelte-1mttyji::before{content:'';position:absolute;width:100%;height:100%;background-color:rgba(0, 0, 0, .3);filter:blur(16px);z-index:-1}.item-label-item__text-wrap.svelte-1mttyji{padding:6px 6px 0;position:absolute;height:20px;pointer-events:all;background-size:100% 100%;background-repeat:no-repeat;white-space:nowrap;line-height:10px;font-size:11px;font-weight:bold;color:#FFEAC0;transform:translate(-50%, 0);display:flex;justify-content:center;align-items:center}.item-label-item__text.svelte-1mttyji{padding-bottom:4px;border-top:0 solid;border-left:0 solid;border-right:0 solid;border-bottom:1px solid;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}.item-label-item__bar.svelte-1mttyji{position:absolute;bottom:0;width:1px;background-image:linear-gradient(to bottom, rgba(234, 208, 154, 0), rgba(234, 208, 154, 1))}@keyframes svelte-1mttyji-fadeIn{from{opacity:0\n }to{opacity:1\n }}");
26
+ }
27
+
28
+ function create_fragment(ctx) {
29
+ let div2;
30
+ let div0;
31
+ let span;
32
+
33
+ let t0_value = (/*itemLabel*/ ctx[0].name.length > 6
34
+ ? `${/*itemLabel*/ ctx[0].name.slice(0, 6)}...`
35
+ : /*itemLabel*/ ctx[0].name) + "";
36
+
37
+ let t0;
38
+ let t1;
39
+ let div1;
40
+ let div2_class_value;
41
+ let mounted;
42
+ let dispose;
43
+
44
+ return {
45
+ c() {
46
+ div2 = element("div");
47
+ div0 = element("div");
48
+ span = element("span");
49
+ t0 = text(t0_value);
50
+ t1 = space();
51
+ div1 = element("div");
52
+ attr(span, "class", "item-label-item__text svelte-1mttyji");
53
+ attr(div0, "class", "item-label-item__text-wrap svelte-1mttyji");
54
+ set_style(div0, "top", `-${/*itemLabel*/ ctx[0].strokeLength + 26}px`);
55
+ attr(div1, "class", "item-label-item__bar svelte-1mttyji");
56
+ set_style(div1, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
57
+ attr(div2, "class", div2_class_value = "" + (null_to_empty(classNames("item-label-item", { visible: /*itemLabel*/ ctx[0].visible })) + " svelte-1mttyji"));
58
+ set_style(div2, "z-index", /*itemLabel*/ ctx[0].zIndex, false);
59
+ set_style(div2, "transform", /*itemLabel*/ ctx[0].transform, false);
60
+ },
61
+ m(target, anchor) {
62
+ insert(target, div2, anchor);
63
+ append(div2, div0);
64
+ append(div0, span);
65
+ append(span, t0);
66
+ append(div2, t1);
67
+ append(div2, div1);
68
+
69
+ if (!mounted) {
70
+ dispose = listen(span, "click", /*onClick*/ ctx[1]);
71
+ mounted = true;
72
+ }
73
+ },
74
+ p(ctx, [dirty]) {
75
+ if (dirty & /*itemLabel*/ 1 && t0_value !== (t0_value = (/*itemLabel*/ ctx[0].name.length > 6
76
+ ? `${/*itemLabel*/ ctx[0].name.slice(0, 6)}...`
77
+ : /*itemLabel*/ ctx[0].name) + "")) set_data(t0, t0_value);
78
+
79
+ if (dirty & /*itemLabel*/ 1) {
80
+ set_style(div0, "top", `-${/*itemLabel*/ ctx[0].strokeLength + 26}px`);
81
+ }
82
+
83
+ if (dirty & /*itemLabel*/ 1) {
84
+ set_style(div1, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
85
+ }
86
+
87
+ if (dirty & /*itemLabel*/ 1 && div2_class_value !== (div2_class_value = "" + (null_to_empty(classNames("item-label-item", { visible: /*itemLabel*/ ctx[0].visible })) + " svelte-1mttyji"))) {
88
+ attr(div2, "class", div2_class_value);
89
+ }
90
+
91
+ if (dirty & /*itemLabel*/ 1) {
92
+ set_style(div2, "z-index", /*itemLabel*/ ctx[0].zIndex, false);
93
+ }
94
+
95
+ if (dirty & /*itemLabel*/ 1) {
96
+ set_style(div2, "transform", /*itemLabel*/ ctx[0].transform, false);
97
+ }
98
+ },
99
+ i: noop,
100
+ o: noop,
101
+ d(detaching) {
102
+ if (detaching) detach(div2);
103
+ mounted = false;
104
+ dispose();
105
+ }
106
+ };
107
+ }
108
+
109
+ function instance($$self, $$props, $$invalidate) {
110
+ let { itemLabel } = $$props;
111
+ let { hooks } = $$props;
112
+
113
+ function onClick() {
114
+ console.log('__onclick___: ', itemLabel);
115
+ hooks.emit('onLabelClick', itemLabel);
116
+ }
117
+
118
+ $$self.$$set = $$props => {
119
+ if ('itemLabel' in $$props) $$invalidate(0, itemLabel = $$props.itemLabel);
120
+ if ('hooks' in $$props) $$invalidate(2, hooks = $$props.hooks);
121
+ };
122
+
123
+ return [itemLabel, onClick, hooks];
124
+ }
125
+
126
+ class Component extends SvelteComponent {
127
+ constructor(options) {
128
+ super();
129
+ init(this, options, instance, create_fragment, safe_not_equal, { itemLabel: 0, hooks: 2 }, add_css);
130
+ }
131
+ }
132
+
133
+ export default Component;
@@ -0,0 +1,9 @@
1
+ import { SubscribeEventMap } from '@realsee/five';
2
+ import { ItemLabel } from "./typings";
3
+ export interface ItemLabelEvent extends SubscribeEventMap {
4
+ /**
5
+ * 点击标签
6
+ */
7
+ onLabelClick: (itemLabel: ItemLabel) => void;
8
+ }
9
+ export declare type PluginEvent = ItemLabelEvent;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { FivePlugin } from "@realsee/five";
2
+ import { ModelItemLabelPluginExportReturnsType, ModelItemLabelPluginParametersType } from "./typings";
3
+ export declare const ModelItemLabelPlugin: FivePlugin<ModelItemLabelPluginParametersType, ModelItemLabelPluginExportReturnsType>;
4
+ export default ModelItemLabelPlugin;