@realsee/dnalogel 2.0.0-alpha.37 → 2.0.0-alpha.38

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 (108) hide show
  1. package/dist/ModelViewPlugin/Plugin.d.ts +4 -4
  2. package/dist/ModelViewPlugin/index.js +2 -3
  3. package/dist/PanoRulerProPlugin/Controller.d.ts +15 -0
  4. package/dist/PanoRulerProPlugin/index.d.ts +8 -0
  5. package/dist/PanoRulerProPlugin/index.js +1006 -0
  6. package/dist/PanoRulerProPlugin/typings.d.ts +46 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.es.js +942 -182
  9. package/dist/index.js +942 -181
  10. package/dist/index.umd.js +942 -181
  11. package/dist/shared-utils/logger.d.ts +16 -0
  12. package/docs/assets/search.js +1 -1
  13. package/docs/classes/Magnifier.html +4 -4
  14. package/docs/classes/ModelRoomLabelController.html +4 -4
  15. package/docs/enums/CameraMovementEffect.html +2 -2
  16. package/docs/enums/DIRECTION.html +1 -1
  17. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  18. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  19. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  20. package/docs/enums/Rotation.html +2 -2
  21. package/docs/index.html +2 -2
  22. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  23. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  24. package/docs/interfaces/FloorplanBounding.html +4 -4
  25. package/docs/interfaces/FloorplanData.html +2 -2
  26. package/docs/interfaces/FloorplanEntrance.html +7 -7
  27. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  28. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  29. package/docs/interfaces/FloorplanFloorData.html +2 -2
  30. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  31. package/docs/interfaces/FloorplanObserver.html +2 -2
  32. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  33. package/docs/interfaces/FloorplanPosition.html +2 -2
  34. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  35. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  36. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  37. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  38. package/docs/interfaces/FloorplanServerData.html +2 -2
  39. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  40. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  41. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  42. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  43. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  44. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  45. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  46. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  47. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  48. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  49. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  50. package/docs/interfaces/LineJson.html +1 -1
  51. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  52. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  53. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  54. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  55. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  56. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  57. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  58. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  59. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  60. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  61. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  62. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  63. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  64. package/docs/interfaces/OpenParameter.html +2 -2
  65. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  66. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  67. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  68. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  69. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  70. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  71. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  72. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  73. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -0
  74. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -0
  75. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -0
  76. package/docs/interfaces/PanoRulerProPluginState.html +1 -0
  77. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  78. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  79. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  80. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  81. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  82. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  83. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  84. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  85. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  86. package/docs/interfaces/Point.html +1 -1
  87. package/docs/interfaces/PointJson.html +1 -1
  88. package/docs/interfaces/Room.html +1 -1
  89. package/docs/interfaces/RoomInfo.html +1 -1
  90. package/docs/interfaces/RoomLabel.html +7 -7
  91. package/docs/interfaces/RoomRules.html +1 -1
  92. package/docs/interfaces/Rooms.html +1 -1
  93. package/docs/modules.html +19 -17
  94. package/libs/ModelViewPlugin/Plugin.d.ts +4 -4
  95. package/libs/ModelViewPlugin/Plugin.js +2 -3
  96. package/libs/PanoRulerProPlugin/Controller.d.ts +15 -0
  97. package/libs/PanoRulerProPlugin/Controller.js +110 -0
  98. package/libs/PanoRulerProPlugin/RulerItem.js +314 -0
  99. package/libs/PanoRulerProPlugin/RulerItems.js +377 -0
  100. package/libs/PanoRulerProPlugin/index.d.ts +8 -0
  101. package/libs/PanoRulerProPlugin/index.js +8 -0
  102. package/libs/PanoRulerProPlugin/typings.d.ts +46 -0
  103. package/libs/PanoRulerProPlugin/typings.js +1 -0
  104. package/libs/index.d.ts +1 -0
  105. package/libs/index.js +2 -0
  106. package/libs/shared-utils/logger.d.ts +16 -0
  107. package/libs/shared-utils/logger.js +47 -0
  108. package/package.json +1 -1
@@ -0,0 +1,377 @@
1
+ /* generated by Svelte v3.47.0 */
2
+ import {
3
+ SvelteComponent,
4
+ check_outros,
5
+ create_component,
6
+ destroy_component,
7
+ destroy_each,
8
+ detach,
9
+ element,
10
+ group_outros,
11
+ init,
12
+ insert,
13
+ mount_component,
14
+ safe_not_equal,
15
+ transition_in,
16
+ transition_out
17
+ } from "svelte/internal";
18
+
19
+ import { Five } from '@realsee/five';
20
+ import { nextFrame } from '../shared-utils/animationFrame';
21
+ import equal from '../shared-utils/equal';
22
+ import { intersectionOfLine } from '../shared-utils/math/planimetry';
23
+ import throttle from '../shared-utils/throttle';
24
+ import { onDestroy, onMount } from 'svelte';
25
+ import { Vector3 } from 'three';
26
+ import RulerItem from './RulerItem';
27
+
28
+ function get_each_context(ctx, list, i) {
29
+ const child_ctx = ctx.slice();
30
+ child_ctx[16] = list[i];
31
+ return child_ctx;
32
+ }
33
+
34
+ // (206:2) {#each rulerItemProp as itemData}
35
+ function create_each_block(ctx) {
36
+ let ruleritem;
37
+ let current;
38
+
39
+ ruleritem = new RulerItem({
40
+ props: { rulerItemProp: /*itemData*/ ctx[16] }
41
+ });
42
+
43
+ return {
44
+ c() {
45
+ create_component(ruleritem.$$.fragment);
46
+ },
47
+ m(target, anchor) {
48
+ mount_component(ruleritem, target, anchor);
49
+ current = true;
50
+ },
51
+ p(ctx, dirty) {
52
+ const ruleritem_changes = {};
53
+ if (dirty & /*rulerItemProp*/ 1) ruleritem_changes.rulerItemProp = /*itemData*/ ctx[16];
54
+ ruleritem.$set(ruleritem_changes);
55
+ },
56
+ i(local) {
57
+ if (current) return;
58
+ transition_in(ruleritem.$$.fragment, local);
59
+ current = true;
60
+ },
61
+ o(local) {
62
+ transition_out(ruleritem.$$.fragment, local);
63
+ current = false;
64
+ },
65
+ d(detaching) {
66
+ destroy_component(ruleritem, detaching);
67
+ }
68
+ };
69
+ }
70
+
71
+ function create_fragment(ctx) {
72
+ let div;
73
+ let current;
74
+ let each_value = /*rulerItemProp*/ ctx[0];
75
+ let each_blocks = [];
76
+
77
+ for (let i = 0; i < each_value.length; i += 1) {
78
+ each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
79
+ }
80
+
81
+ const out = i => transition_out(each_blocks[i], 1, 1, () => {
82
+ each_blocks[i] = null;
83
+ });
84
+
85
+ return {
86
+ c() {
87
+ div = element("div");
88
+
89
+ for (let i = 0; i < each_blocks.length; i += 1) {
90
+ each_blocks[i].c();
91
+ }
92
+ },
93
+ m(target, anchor) {
94
+ insert(target, div, anchor);
95
+
96
+ for (let i = 0; i < each_blocks.length; i += 1) {
97
+ each_blocks[i].m(div, null);
98
+ }
99
+
100
+ current = true;
101
+ },
102
+ p(ctx, [dirty]) {
103
+ if (dirty & /*rulerItemProp*/ 1) {
104
+ each_value = /*rulerItemProp*/ ctx[0];
105
+ let i;
106
+
107
+ for (i = 0; i < each_value.length; i += 1) {
108
+ const child_ctx = get_each_context(ctx, each_value, i);
109
+
110
+ if (each_blocks[i]) {
111
+ each_blocks[i].p(child_ctx, dirty);
112
+ transition_in(each_blocks[i], 1);
113
+ } else {
114
+ each_blocks[i] = create_each_block(child_ctx);
115
+ each_blocks[i].c();
116
+ transition_in(each_blocks[i], 1);
117
+ each_blocks[i].m(div, null);
118
+ }
119
+ }
120
+
121
+ group_outros();
122
+
123
+ for (i = each_value.length; i < each_blocks.length; i += 1) {
124
+ out(i);
125
+ }
126
+
127
+ check_outros();
128
+ }
129
+ },
130
+ i(local) {
131
+ if (current) return;
132
+
133
+ for (let i = 0; i < each_value.length; i += 1) {
134
+ transition_in(each_blocks[i]);
135
+ }
136
+
137
+ current = true;
138
+ },
139
+ o(local) {
140
+ each_blocks = each_blocks.filter(Boolean);
141
+
142
+ for (let i = 0; i < each_blocks.length; i += 1) {
143
+ transition_out(each_blocks[i]);
144
+ }
145
+
146
+ current = false;
147
+ },
148
+ d(detaching) {
149
+ if (detaching) detach(div);
150
+ destroy_each(each_blocks, detaching);
151
+ }
152
+ };
153
+ }
154
+
155
+ function instance($$self, $$props, $$invalidate) {
156
+ var _a, _b, _c, _d;
157
+ let { five } = $$props;
158
+ let { rulerDatas } = $$props;
159
+ let { options } = $$props;
160
+ let rulerItemProp = [];
161
+
162
+ const canvasWidth = ((_b = (_a = five.getElement()) === null || _a === void 0
163
+ ? void 0
164
+ : _a.parentElement) === null || _b === void 0
165
+ ? void 0
166
+ : _b.clientWidth) || 0;
167
+
168
+ const canvasHeight = ((_d = (_c = five.getElement()) === null || _c === void 0
169
+ ? void 0
170
+ : _c.parentElement) === null || _d === void 0
171
+ ? void 0
172
+ : _d.clientHeight) || 0;
173
+
174
+ const getRuleScreenIntr = (startPoint, endPoint) => {
175
+ const screenLines = [
176
+ [{ x: 0, y: 0 }, { x: canvasWidth, y: 0 }],
177
+ [{ x: 0, y: 0 }, { x: 0, y: canvasHeight }],
178
+ [{ x: canvasWidth, y: 0 }, { x: canvasWidth, y: canvasHeight }],
179
+ [{ x: 0, y: canvasHeight }, { x: canvasWidth, y: canvasHeight }]
180
+ ];
181
+
182
+ const intr = [];
183
+
184
+ for (let i = 0; i < screenLines.length; i++) {
185
+ const result = intersectionOfLine([startPoint, endPoint], [screenLines[i][0], screenLines[i][1]], true);
186
+ if (result) intr.push(result);
187
+ }
188
+
189
+ if (intr.length === 0) return false; else {
190
+ return intr;
191
+ }
192
+ };
193
+
194
+ const getPosition = (start, end) => {
195
+ const startPoint = start.clone().project(five.camera);
196
+ const startLeft = (startPoint.x + 1) / 2 * canvasWidth;
197
+ const startTop = (-startPoint.y + 1) / 2 * canvasHeight;
198
+ const endPoint = end.clone().project(five.camera);
199
+ const endLeft = (endPoint.x + 1) / 2 * canvasWidth;
200
+ const endTop = (-endPoint.y + 1) / 2 * canvasHeight;
201
+ const distance = Math.sqrt(Math.pow(endLeft - startLeft, 2) + Math.pow(endTop - startTop, 2));
202
+
203
+ return {
204
+ startLeft,
205
+ startTop,
206
+ endLeft,
207
+ endTop,
208
+ distance
209
+ };
210
+ };
211
+
212
+ const getPositionAndVisible = (start, end, visibleOrigin) => {
213
+ const cameraPosition = five.camera.position;
214
+ const cameraDirection = five.camera.getWorldDirection(new Vector3());
215
+ const startAngle = start.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
216
+ const endAngle = end.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
217
+ const ruleLength = start.distanceTo(end);
218
+ const midPoint = end.clone().sub(end.clone().sub(start).divide(new Vector3(2, 2, 2)));
219
+ const disFromCameraToMid = midPoint.distanceTo(cameraPosition);
220
+ const { startLeft, startTop, endLeft, endTop, distance } = getPosition(start, end);
221
+ const rad = Math.PI / 2 - Math.atan2(endLeft - startLeft, startTop - endTop);
222
+ const deg = -(rad / Math.PI) * 180;
223
+ let visible = true;
224
+ if (!visibleOrigin) visible = false;
225
+
226
+ // 只显示拐点相连的线
227
+ if (!equal(start, visibleOrigin) && !equal(end, visibleOrigin)) {
228
+ visible = false;
229
+ }
230
+
231
+ // 线小于0.3m隐藏
232
+ if (ruleLength < 0.3) {
233
+ visible = false;
234
+ }
235
+
236
+ if (startAngle > Math.PI / 2) {
237
+ visible = false;
238
+ }
239
+
240
+ if (endAngle > Math.PI / 2) {
241
+ visible = false;
242
+ }
243
+
244
+ if (disFromCameraToMid / ruleLength > 8) {
245
+ visible = false;
246
+ }
247
+
248
+ let labelOffset = 50;
249
+ let visibleLength = distance;
250
+ const intr = getRuleScreenIntr({ x: ~~startLeft, y: ~~startTop }, { x: ~~endLeft, y: ~~endTop });
251
+
252
+ if (intr && intr.length === 1) {
253
+ if (equal(start, visibleOrigin)) {
254
+ visibleLength = Math.sqrt(Math.pow(intr[0].x - startLeft, 2) + Math.pow(intr[0].y - startTop, 2));
255
+ labelOffset = visibleLength / distance * 50;
256
+ } else if (equal(end, visibleOrigin)) {
257
+ visibleLength = Math.sqrt(Math.pow(intr[0].x - endLeft, 2) + Math.pow(intr[0].y - endTop, 2));
258
+ labelOffset = 100 - visibleLength / distance * 50;
259
+ }
260
+ }
261
+
262
+ if (intr && intr.length === 2) {
263
+ const middlePoint = {
264
+ x: (intr[0].x + intr[1].x) / 2,
265
+ y: (intr[0].y + intr[1].y) / 2
266
+ };
267
+
268
+ const distanceFromStart = Math.sqrt(Math.pow(middlePoint.x - startLeft, 2) + Math.pow(middlePoint.y - startTop, 2));
269
+ labelOffset = distanceFromStart / distance * 100;
270
+ }
271
+
272
+ return {
273
+ startLeft,
274
+ startTop,
275
+ distance,
276
+ deg,
277
+ visible,
278
+ labelOffset,
279
+ ruleLength
280
+ };
281
+ };
282
+
283
+ const updatePanoRulerData = () => {
284
+ const panoIndex = five.panoIndex;
285
+ const rulerData = rulerDatas.find(data => data.panoIndex === panoIndex);
286
+ if (!rulerData) return $$invalidate(0, rulerItemProp = []);
287
+
288
+ // 非全景模式下隐藏所有标尺
289
+ if (five.currentMode !== Five.Mode.Panorama) return $$invalidate(0, rulerItemProp = []);
290
+
291
+ const cameraPosition = five.camera.position;
292
+ const cameraDirection = five.camera.getWorldDirection(new Vector3());
293
+ const startPoints = rulerData.lines.map(v => new Vector3(v.start[0], -v.start[1], -v.start[2]));
294
+ const endPoints = rulerData.lines.map(v => new Vector3(v.end[0], -v.end[1], -v.end[2]));
295
+
296
+ // 可以看到的角度最小的拐点
297
+ const [visibleOrigin] = startPoints.concat(endPoints).sort((pointA, pointB) => {
298
+ const angleA = pointA.clone().setY(0).sub(cameraPosition).normalize().angleTo(cameraDirection.clone().setY(0));
299
+ const angleB = pointB.clone().setY(0).sub(cameraPosition).normalize().angleTo(cameraDirection.clone().setY(0));
300
+ return angleA - angleB;
301
+ });
302
+
303
+ const data = rulerData.lines.map(line => {
304
+ var _a, _b;
305
+ const start = line.start;
306
+ const end = line.end;
307
+ const { startLeft, startTop, distance, deg, visible, labelOffset, ruleLength } = getPositionAndVisible(new Vector3(start[0], -start[1], -start[2]), new Vector3(end[0], -end[1], -end[2]), visibleOrigin);
308
+ const children = [];
309
+
310
+ if (line.children && ((_a = line.children) === null || _a === void 0
311
+ ? void 0
312
+ : _a.length) > 0) {
313
+ (_b = line.children) === null || _b === void 0
314
+ ? void 0
315
+ : _b.forEach(l => {
316
+ const start = l.start;
317
+ const end = l.end;
318
+ const { distance } = getPosition(new Vector3(start[0], -start[1], -start[2]), new Vector3(end[0], -end[1], -end[2]));
319
+ children.push({ width: distance, state: l.state });
320
+ });
321
+ }
322
+
323
+ return {
324
+ width: distance,
325
+ left: startLeft,
326
+ top: startTop,
327
+ rotateDeg: deg,
328
+ state: line.state,
329
+ children,
330
+ labelOffset,
331
+ visible,
332
+ labelElement: options.distanceText(ruleLength)
333
+ };
334
+ });
335
+
336
+ $$invalidate(0, rulerItemProp = data);
337
+ };
338
+
339
+ const nextFrameFreshRule = () => nextFrame(updatePanoRulerData);
340
+ const throttleFreshRule = throttle(updatePanoRulerData, 80);
341
+
342
+ onMount(() => {
343
+ updatePanoRulerData();
344
+ five.on('panoArrived', updatePanoRulerData);
345
+ five.on('modeChange', updatePanoRulerData);
346
+ five.on('cameraDirectionUpdate', nextFrameFreshRule);
347
+ five.on('movingToPano', nextFrameFreshRule);
348
+ five.on('mouseWheel', () => throttleFreshRule());
349
+ five.on('pinchGesture', () => throttleFreshRule());
350
+ });
351
+
352
+ onDestroy(() => {
353
+ five.off('panoArrived', updatePanoRulerData);
354
+ five.off('modeChange', updatePanoRulerData);
355
+ five.off('cameraDirectionUpdate', nextFrameFreshRule);
356
+ five.off('movingToPano', nextFrameFreshRule);
357
+ five.off('mouseWheel', () => throttleFreshRule());
358
+ five.off('pinchGesture', () => throttleFreshRule());
359
+ });
360
+
361
+ $$self.$$set = $$props => {
362
+ if ('five' in $$props) $$invalidate(1, five = $$props.five);
363
+ if ('rulerDatas' in $$props) $$invalidate(2, rulerDatas = $$props.rulerDatas);
364
+ if ('options' in $$props) $$invalidate(3, options = $$props.options);
365
+ };
366
+
367
+ return [rulerItemProp, five, rulerDatas, options];
368
+ }
369
+
370
+ class Component extends SvelteComponent {
371
+ constructor(options) {
372
+ super();
373
+ init(this, options, instance, create_fragment, safe_not_equal, { five: 1, rulerDatas: 2, options: 3 });
374
+ }
375
+ }
376
+
377
+ export default Component;
@@ -0,0 +1,8 @@
1
+ import type { FivePlugin } from '@realsee/five';
2
+ import type { PanoRulerProPluginParameterType, PanoRulerProPluginExportType } from './typings';
3
+ /**
4
+ * 全景标尺插件
5
+ */
6
+ export declare const PanoRulerProPlugin: FivePlugin<PanoRulerProPluginParameterType, PanoRulerProPluginExportType>;
7
+ export default PanoRulerProPlugin;
8
+ export type { PanoRulerProPluginParameterType, PanoRulerProPluginExportType, PanoRulerProPluginOptions, PanoRulerProPluginState, } from './typings';
@@ -0,0 +1,8 @@
1
+ import Controller from './Controller';
2
+ /**
3
+ * 全景标尺插件
4
+ */
5
+ export const PanoRulerProPlugin = (five, params) => {
6
+ return new Controller(five, params);
7
+ };
8
+ export default PanoRulerProPlugin;
@@ -0,0 +1,46 @@
1
+ export declare type PanoRulerProPluginDatas = {
2
+ data: PanoRulerProPluginData[];
3
+ version: number;
4
+ };
5
+ export interface PanoRulerProPluginData {
6
+ panoIndex: number;
7
+ roomName: string;
8
+ lines: Line[];
9
+ }
10
+ interface Line {
11
+ start: number[];
12
+ end: number[];
13
+ state: boolean;
14
+ children?: Line[];
15
+ }
16
+ export interface PanoRulerProPluginOptions {
17
+ distanceText?: (distance: number) => string;
18
+ className?: string;
19
+ }
20
+ export interface PanoRulerProPluginState {
21
+ enabled: boolean;
22
+ loaded: boolean;
23
+ options: PanoRulerProPluginOptions;
24
+ }
25
+ export interface PanoRulerProPluginParameterType {
26
+ data?: PanoRulerProPluginDatas;
27
+ options?: PanoRulerProPluginOptions;
28
+ }
29
+ export interface PanoRulerProPluginExportType {
30
+ enable: () => void;
31
+ disable: () => void;
32
+ load: (serverData: PanoRulerProPluginDatas) => void;
33
+ state: PanoRulerProPluginState;
34
+ }
35
+ export interface RulerItemProp {
36
+ width: number;
37
+ left: number;
38
+ top: number;
39
+ rotateDeg: number;
40
+ state: boolean;
41
+ children: any[];
42
+ labelOffset: number;
43
+ labelElement: string;
44
+ visible: boolean;
45
+ }
46
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/libs/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from './ModelChassisCompassPlugin';
7
7
  export * from './ModelEntryDoorGuidePlugin';
8
8
  export * from './CameraMovementPlugin';
9
9
  export * from './PanoRulerPlugin';
10
+ export * from './PanoRulerProPlugin';
10
11
  export * from './PanoCompassPlugin';
11
12
  export * from './PanoMeasurePlugin';
12
13
  export * from './PanoSpatialTagPlugin';
package/libs/index.js CHANGED
@@ -12,6 +12,8 @@ export * from './ModelEntryDoorGuidePlugin';
12
12
  export * from './CameraMovementPlugin';
13
13
  // 全景标尺
14
14
  export * from './PanoRulerPlugin';
15
+ // 全景标尺Pro版
16
+ export * from './PanoRulerProPlugin';
15
17
  // 全景指南针
16
18
  export * from './PanoCompassPlugin';
17
19
  // pc 全景测量工具
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 输出格式化日志
3
+ */
4
+ export declare enum LOG_LEVEL {
5
+ info = "INFO",
6
+ log = "LOG",
7
+ error = "ERROR",
8
+ warn = "WARN"
9
+ }
10
+ export declare const logger: {
11
+ log: (...args: any[]) => void;
12
+ info: (...args: any[]) => void;
13
+ error: (...args: any[]) => void;
14
+ warn: (...args: any[]) => void;
15
+ };
16
+ export default logger;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * 输出格式化日志
3
+ */
4
+ // 获取当前时间
5
+ const getTime = () => {
6
+ const date = new Date();
7
+ const year = date.getFullYear();
8
+ const month = (date.getMonth() + 1).toString().padStart(2, '0'); //月份是从0开始的
9
+ const day = date.getDate().toString().padStart(2, '0');
10
+ const hour = date.getHours().toString().padStart(2, '0');
11
+ const min = date.getMinutes().toString().padStart(2, '0');
12
+ const sec = date.getSeconds().toString().padStart(2, '0');
13
+ const ms = date.getMilliseconds();
14
+ return `[${year}-${month}-${day} ${hour}:${min}:${sec}.${ms}]`;
15
+ };
16
+ export var LOG_LEVEL;
17
+ (function (LOG_LEVEL) {
18
+ LOG_LEVEL["info"] = "INFO";
19
+ LOG_LEVEL["log"] = "LOG";
20
+ LOG_LEVEL["error"] = "ERROR";
21
+ LOG_LEVEL["warn"] = "WARN";
22
+ })(LOG_LEVEL || (LOG_LEVEL = {}));
23
+ // 输出日志
24
+ const echo = (logLevel, args = []) => {
25
+ args.unshift(`@realsee/dnalogel ${getTime()} <${logLevel}> `);
26
+ switch (logLevel) {
27
+ case LOG_LEVEL.info:
28
+ return console.info(...args);
29
+ case LOG_LEVEL.error:
30
+ return console.error(...args);
31
+ case LOG_LEVEL.warn:
32
+ return console.warn(...args);
33
+ default:
34
+ return console.log(...args);
35
+ }
36
+ };
37
+ const log = (...args) => echo(LOG_LEVEL.log, args);
38
+ const info = (...args) => echo(LOG_LEVEL.info, args);
39
+ const error = (...args) => echo(LOG_LEVEL.error, args);
40
+ const warn = (...args) => echo(LOG_LEVEL.warn, args);
41
+ export const logger = {
42
+ log,
43
+ info,
44
+ error,
45
+ warn,
46
+ };
47
+ export default logger;
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.0.0-alpha.37",
11
+ "version": "2.0.0-alpha.38",
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",