vesium 1.0.1-beta.57 → 1.0.1-beta.61
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.
- package/README.md +1 -1
- package/dist/index.cjs +57 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.iife.js +56 -50
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +9 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
## Documentation
|
|
34
34
|
|
|
35
|
-
To view the documentation, visit <a href="https://vesium.
|
|
35
|
+
To view the documentation, visit <a href="https://vesium.js.org" target="__blank">vesium.js.org</a>
|
|
36
36
|
|
|
37
37
|
## Features
|
|
38
38
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
let
|
|
1
|
+
let _vueuse_core = require("@vueuse/core");
|
|
2
2
|
let cesium = require("cesium");
|
|
3
3
|
let vue = require("vue");
|
|
4
|
-
let
|
|
4
|
+
let _vesium_shared = require("@vesium/shared");
|
|
5
5
|
|
|
6
6
|
//#region createViewer/index.ts
|
|
7
7
|
/**
|
|
@@ -21,7 +21,7 @@ function createViewer(...args) {
|
|
|
21
21
|
const scope = (0, vue.getCurrentScope)();
|
|
22
22
|
if (scope) CREATE_VIEWER_COLLECTION.set(scope, readonlyViewer);
|
|
23
23
|
const canvas = (0, vue.computed)(() => viewer.value?.canvas);
|
|
24
|
-
(0,
|
|
24
|
+
(0, _vueuse_core.useMutationObserver)(document?.body, () => {
|
|
25
25
|
if (canvas.value && !document?.body.contains(canvas.value)) viewer.value = void 0;
|
|
26
26
|
}, {
|
|
27
27
|
childList: true,
|
|
@@ -36,7 +36,7 @@ function createViewer(...args) {
|
|
|
36
36
|
onCleanup(() => !viewer.value?.isDestroyed() && viewer.value?.destroy());
|
|
37
37
|
} else viewer.value = void 0;
|
|
38
38
|
});
|
|
39
|
-
(0,
|
|
39
|
+
(0, _vueuse_core.tryOnScopeDispose)(() => {
|
|
40
40
|
viewer.value = void 0;
|
|
41
41
|
});
|
|
42
42
|
return (0, vue.computed)(() => {
|
|
@@ -68,10 +68,10 @@ async function toPromiseValue(source, options = {}) {
|
|
|
68
68
|
try {
|
|
69
69
|
const { raw = true } = options;
|
|
70
70
|
let value;
|
|
71
|
-
if ((0,
|
|
71
|
+
if ((0, _vesium_shared.isFunction)(source)) value = await source();
|
|
72
72
|
else {
|
|
73
73
|
const result = (0, vue.toValue)(source);
|
|
74
|
-
value = (0,
|
|
74
|
+
value = (0, _vesium_shared.isPromise)(result) ? await result : result;
|
|
75
75
|
}
|
|
76
76
|
return raw ? (0, vue.toRaw)(value) : value;
|
|
77
77
|
} catch (error) {
|
|
@@ -107,7 +107,7 @@ function useCesiumEventListener(event, listener, options = {}) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
|
-
(0,
|
|
110
|
+
(0, _vueuse_core.tryOnScopeDispose)(cleanup.stop);
|
|
111
111
|
return cleanup.stop;
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -149,7 +149,7 @@ function useCameraState(options = {}) {
|
|
|
149
149
|
const eventField = (0, vue.toValue)(options.event) || "changed";
|
|
150
150
|
return camera.value?.[eventField];
|
|
151
151
|
});
|
|
152
|
-
const changedSymbol = (0,
|
|
152
|
+
const changedSymbol = (0, _vueuse_core.refThrottled)((0, vue.shallowRef)(Symbol("camera change")), options.delay ?? 8, true, false);
|
|
153
153
|
const setChangedSymbol = () => {
|
|
154
154
|
changedSymbol.value = Symbol("camera change");
|
|
155
155
|
};
|
|
@@ -197,7 +197,7 @@ function useCesiumFps(options = {}) {
|
|
|
197
197
|
const p = (0, vue.shallowRef)(performance.now());
|
|
198
198
|
useCesiumEventListener(() => viewer.value?.scene.postRender, () => p.value = performance.now());
|
|
199
199
|
const interval = (0, vue.ref)(0);
|
|
200
|
-
(0,
|
|
200
|
+
(0, _vueuse_core.watchThrottled)(p, (value, oldValue) => {
|
|
201
201
|
interval.value = value - oldValue;
|
|
202
202
|
}, { throttle: delay });
|
|
203
203
|
const fps = (0, vue.computed)(() => {
|
|
@@ -221,7 +221,7 @@ function useCollectionScope(options) {
|
|
|
221
221
|
const scope = (0, vue.shallowReactive)(/* @__PURE__ */ new Set());
|
|
222
222
|
const add = (instance, ...args) => {
|
|
223
223
|
const result = addEffect(instance, ...args);
|
|
224
|
-
if ((0,
|
|
224
|
+
if ((0, _vesium_shared.isPromise)(result)) return new Promise((resolve, reject) => {
|
|
225
225
|
result.then((i) => {
|
|
226
226
|
scope.add(i);
|
|
227
227
|
resolve(i);
|
|
@@ -246,7 +246,7 @@ function useCollectionScope(options) {
|
|
|
246
246
|
remove(instance, ...args);
|
|
247
247
|
});
|
|
248
248
|
};
|
|
249
|
-
(0,
|
|
249
|
+
(0, _vueuse_core.tryOnScopeDispose)(() => removeScope(...removeScopeArgs));
|
|
250
250
|
return {
|
|
251
251
|
scope: (0, vue.shallowReadonly)(scope),
|
|
252
252
|
add,
|
|
@@ -260,7 +260,7 @@ function useCollectionScope(options) {
|
|
|
260
260
|
//#region useDataSource/index.ts
|
|
261
261
|
function useDataSource(dataSources, options = {}) {
|
|
262
262
|
const { destroyOnRemove, collection, isActive = true, evaluating } = options;
|
|
263
|
-
const result = (0,
|
|
263
|
+
const result = (0, _vueuse_core.computedAsync)(() => toPromiseValue(dataSources), void 0, { evaluating });
|
|
264
264
|
const viewer = useViewer();
|
|
265
265
|
(0, vue.watchEffect)((onCleanup) => {
|
|
266
266
|
if ((0, vue.toValue)(isActive)) {
|
|
@@ -290,7 +290,7 @@ function useDataSourceScope(options = {}) {
|
|
|
290
290
|
return useCollectionScope({
|
|
291
291
|
addEffect(instance) {
|
|
292
292
|
if (!collection.value) throw new Error("collection is not defined");
|
|
293
|
-
if ((0,
|
|
293
|
+
if ((0, _vesium_shared.isPromise)(instance)) return new Promise((resolve, reject) => {
|
|
294
294
|
instance.then((i) => {
|
|
295
295
|
collection.value.add(i);
|
|
296
296
|
resolve(i);
|
|
@@ -320,11 +320,13 @@ function useElementOverlay(target, position, options = {}) {
|
|
|
320
320
|
} } = options;
|
|
321
321
|
const viewer = useViewer();
|
|
322
322
|
const cartesian3 = (0, vue.computed)(() => {
|
|
323
|
-
|
|
323
|
+
const positionValue = (0, vue.toValue)(position);
|
|
324
|
+
if (!positionValue) return;
|
|
325
|
+
else if (!(0, vue.toValue)(clampToGround)) return (0, _vesium_shared.toCartesian3)(positionValue);
|
|
324
326
|
else {
|
|
325
|
-
const cartographic = (0,
|
|
327
|
+
const cartographic = (0, _vesium_shared.toCartographic)((0, vue.toValue)(positionValue));
|
|
326
328
|
cartographic.height = +(viewer.value?.scene.globe.getHeight(cartographic) || 0).toFixed(2);
|
|
327
|
-
return (0,
|
|
329
|
+
return (0, _vesium_shared.toCartesian3)(cartographic);
|
|
328
330
|
}
|
|
329
331
|
});
|
|
330
332
|
const coord = (0, vue.shallowRef)();
|
|
@@ -332,12 +334,16 @@ function useElementOverlay(target, position, options = {}) {
|
|
|
332
334
|
if (!viewer.value?.scene) return;
|
|
333
335
|
if (!cartesian3.value) coord.value = void 0;
|
|
334
336
|
else {
|
|
335
|
-
const result = (0,
|
|
336
|
-
|
|
337
|
+
const result = (0, _vesium_shared.cartesianToCanvasCoord)(cartesian3.value, viewer.value.scene);
|
|
338
|
+
if (result) {
|
|
339
|
+
result.x = +result.x.toFixed(2);
|
|
340
|
+
result.y = +result.y.toFixed(2);
|
|
341
|
+
coord.value = !cesium.Cartesian2.equals(result, coord.value) ? result : coord.value;
|
|
342
|
+
}
|
|
337
343
|
}
|
|
338
344
|
});
|
|
339
|
-
const canvasBounding = (0,
|
|
340
|
-
const targetBounding = (0,
|
|
345
|
+
const canvasBounding = (0, _vueuse_core.useElementBounding)(() => viewer.value?.canvas.parentElement);
|
|
346
|
+
const targetBounding = (0, _vueuse_core.useElementBounding)(target);
|
|
341
347
|
const finalOffset = (0, vue.computed)(() => {
|
|
342
348
|
const _offset = (0, vue.toValue)(offset);
|
|
343
349
|
let x$1 = _offset?.x ?? 0;
|
|
@@ -391,7 +397,7 @@ function useElementOverlay(target, position, options = {}) {
|
|
|
391
397
|
//#region useEntity/index.ts
|
|
392
398
|
function useEntity(data, options = {}) {
|
|
393
399
|
const { collection, isActive = true, evaluating } = options;
|
|
394
|
-
const result = (0,
|
|
400
|
+
const result = (0, _vueuse_core.computedAsync)(() => toPromiseValue(data), [], { evaluating });
|
|
395
401
|
const viewer = useViewer();
|
|
396
402
|
(0, vue.watchEffect)((onCleanup) => {
|
|
397
403
|
if ((0, vue.toValue)(isActive)) {
|
|
@@ -421,7 +427,7 @@ function useEntityScope(options = {}) {
|
|
|
421
427
|
return useCollectionScope({
|
|
422
428
|
addEffect(instance) {
|
|
423
429
|
if (!collection.value) throw new Error("collection is not defined");
|
|
424
|
-
if ((0,
|
|
430
|
+
if ((0, _vesium_shared.isPromise)(instance)) return new Promise((resolve, reject) => {
|
|
425
431
|
instance.then((i) => {
|
|
426
432
|
collection.value.add(i);
|
|
427
433
|
resolve(i);
|
|
@@ -452,7 +458,7 @@ function useScenePick(windowPosition, options = {}) {
|
|
|
452
458
|
const { width = 3, height = 3, throttled = 8 } = options;
|
|
453
459
|
const isActive = (0, vue.toRef)(options.isActive ?? true);
|
|
454
460
|
const viewer = useViewer();
|
|
455
|
-
const position = (0,
|
|
461
|
+
const position = (0, _vueuse_core.refThrottled)((0, vue.computed)(() => (0, vue.toValue)(windowPosition)?.clone()), throttled, false, true);
|
|
456
462
|
const pick = (0, vue.shallowRef)();
|
|
457
463
|
(0, vue.watchEffect)(() => {
|
|
458
464
|
if (viewer.value && position.value && isActive.value) {
|
|
@@ -492,7 +498,7 @@ function useScreenSpaceEventHandler(type, inputAction, options = {}) {
|
|
|
492
498
|
const modifierValue = (0, vue.toValue)(modifier);
|
|
493
499
|
const handlerValue = (0, vue.toValue)(handler);
|
|
494
500
|
if (!handlerValue || !isActive.value || !inputAction) return;
|
|
495
|
-
if ((0,
|
|
501
|
+
if ((0, _vesium_shared.isDef)(typeValue)) {
|
|
496
502
|
handlerValue.setInputAction(inputAction, typeValue, modifierValue);
|
|
497
503
|
onCleanup(() => handlerValue.removeInputAction(typeValue, modifierValue));
|
|
498
504
|
}
|
|
@@ -501,7 +507,7 @@ function useScreenSpaceEventHandler(type, inputAction, options = {}) {
|
|
|
501
507
|
cleanup1();
|
|
502
508
|
cleanup2();
|
|
503
509
|
};
|
|
504
|
-
(0,
|
|
510
|
+
(0, _vueuse_core.tryOnScopeDispose)(stop);
|
|
505
511
|
return stop;
|
|
506
512
|
}
|
|
507
513
|
|
|
@@ -541,7 +547,7 @@ function useDrag(listener) {
|
|
|
541
547
|
dragging.value = true;
|
|
542
548
|
position.value = event.position.clone();
|
|
543
549
|
});
|
|
544
|
-
const stopMouseMoveWatch = useScreenSpaceEventHandler(cesium.ScreenSpaceEventType.MOUSE_MOVE, (0,
|
|
550
|
+
const stopMouseMoveWatch = useScreenSpaceEventHandler(cesium.ScreenSpaceEventType.MOUSE_MOVE, (0, _vesium_shared.throttle)(({ startPosition, endPosition }) => {
|
|
545
551
|
motionEvent.value = {
|
|
546
552
|
startPosition: motionEvent.value?.endPosition.clone() || startPosition.clone(),
|
|
547
553
|
endPosition: endPosition.clone()
|
|
@@ -564,7 +570,7 @@ function useDrag(listener) {
|
|
|
564
570
|
stopMouseMoveWatch();
|
|
565
571
|
stopLeftUpWatch();
|
|
566
572
|
};
|
|
567
|
-
(0,
|
|
573
|
+
(0, _vueuse_core.tryOnScopeDispose)(stop);
|
|
568
574
|
return stop;
|
|
569
575
|
}
|
|
570
576
|
|
|
@@ -679,15 +685,15 @@ function useGraphicEvent() {
|
|
|
679
685
|
eventTypeMap.get(type) ?? eventTypeMap.set(type, /* @__PURE__ */ new Set());
|
|
680
686
|
eventTypeMap.get(type).add(listener);
|
|
681
687
|
let { cursor = "pointer", dragCursor } = options;
|
|
682
|
-
if ((0,
|
|
683
|
-
const _cursor = (0,
|
|
688
|
+
if ((0, _vesium_shared.isDef)(cursor)) {
|
|
689
|
+
const _cursor = (0, _vesium_shared.isFunction)(cursor) ? cursor : () => cursor;
|
|
684
690
|
cursorCollection.get(_graphic) ?? cursorCollection.set(_graphic, /* @__PURE__ */ new Map());
|
|
685
691
|
cursorCollection.get(_graphic).get(type) ?? cursorCollection.get(_graphic).set(type, /* @__PURE__ */ new Map());
|
|
686
692
|
cursorCollection.get(_graphic).get(type).set(listener, _cursor);
|
|
687
693
|
}
|
|
688
694
|
if (type === "DRAG") dragCursor ??= ((event) => event?.dragging ? "crosshair" : void 0);
|
|
689
|
-
if ((0,
|
|
690
|
-
const _dragCursor = (0,
|
|
695
|
+
if ((0, _vesium_shared.isDef)(dragCursor)) {
|
|
696
|
+
const _dragCursor = (0, _vesium_shared.isFunction)(dragCursor) ? dragCursor : () => dragCursor;
|
|
691
697
|
dragCursorCollection.get(_graphic) ?? dragCursorCollection.set(_graphic, /* @__PURE__ */ new Map());
|
|
692
698
|
dragCursorCollection.get(_graphic).get(type) ?? dragCursorCollection.get(_graphic).set(type, /* @__PURE__ */ new Map());
|
|
693
699
|
dragCursorCollection.get(_graphic).get(type).set(listener, _dragCursor);
|
|
@@ -710,31 +716,31 @@ function useGraphicEvent() {
|
|
|
710
716
|
if (dragCursorCollection?.get(_graphic)?.size === 0) dragCursorCollection?.delete(_graphic);
|
|
711
717
|
};
|
|
712
718
|
for (const type of POSITIONED_EVENT_TYPES) usePositioned(type, (event) => {
|
|
713
|
-
(0,
|
|
714
|
-
collection.get(graphic)?.get(type)?.forEach((fn) => (0,
|
|
719
|
+
(0, _vesium_shared.resolvePick)(event.pick).concat(GLOBAL_GRAPHIC_SYMBOL).forEach((graphic) => {
|
|
720
|
+
collection.get(graphic)?.get(type)?.forEach((fn) => (0, _vesium_shared.tryRun)(fn)?.(event));
|
|
715
721
|
});
|
|
716
722
|
});
|
|
717
723
|
const dragging = (0, vue.ref)(false);
|
|
718
724
|
const viewer = useViewer();
|
|
719
725
|
useHover((event) => {
|
|
720
|
-
(0,
|
|
721
|
-
collection.get(graphic)?.get("HOVER")?.forEach((fn) => (0,
|
|
726
|
+
(0, _vesium_shared.resolvePick)(event.pick).concat(GLOBAL_GRAPHIC_SYMBOL).forEach((graphic) => {
|
|
727
|
+
collection.get(graphic)?.get("HOVER")?.forEach((fn) => (0, _vesium_shared.tryRun)(fn)?.(event));
|
|
722
728
|
if (!dragging.value) cursorCollection.get(graphic)?.forEach((map) => {
|
|
723
729
|
map.forEach((fn) => {
|
|
724
|
-
const cursor = event.hovering ? (0,
|
|
730
|
+
const cursor = event.hovering ? (0, _vesium_shared.tryRun)(fn)(event) : "";
|
|
725
731
|
viewer.value?.canvas.style?.setProperty("cursor", cursor);
|
|
726
732
|
});
|
|
727
733
|
});
|
|
728
734
|
});
|
|
729
735
|
});
|
|
730
736
|
useDrag((event) => {
|
|
731
|
-
const graphics = (0,
|
|
737
|
+
const graphics = (0, _vesium_shared.resolvePick)(event.pick).concat(GLOBAL_GRAPHIC_SYMBOL);
|
|
732
738
|
dragging.value = event.dragging;
|
|
733
739
|
graphics.forEach((graphic) => {
|
|
734
|
-
collection.get(graphic)?.get("DRAG")?.forEach((fn) => (0,
|
|
740
|
+
collection.get(graphic)?.get("DRAG")?.forEach((fn) => (0, _vesium_shared.tryRun)(fn)(event));
|
|
735
741
|
dragCursorCollection.get(graphic)?.forEach((map) => {
|
|
736
742
|
map.forEach((fn) => {
|
|
737
|
-
const cursor = event.dragging ? (0,
|
|
743
|
+
const cursor = event.dragging ? (0, _vesium_shared.tryRun)(fn)(event) : "";
|
|
738
744
|
viewer.value?.canvas.style?.setProperty("cursor", cursor);
|
|
739
745
|
});
|
|
740
746
|
});
|
|
@@ -751,7 +757,7 @@ function useGraphicEvent() {
|
|
|
751
757
|
//#region useImageryLayer/index.ts
|
|
752
758
|
function useImageryLayer(data, options = {}) {
|
|
753
759
|
const { destroyOnRemove, collection, isActive = true, evaluating } = options;
|
|
754
|
-
const result = (0,
|
|
760
|
+
const result = (0, _vueuse_core.computedAsync)(() => toPromiseValue(data), [], { evaluating });
|
|
755
761
|
const viewer = useViewer();
|
|
756
762
|
(0, vue.watchEffect)((onCleanup) => {
|
|
757
763
|
if ((0, vue.toValue)(isActive)) {
|
|
@@ -793,7 +799,7 @@ function useImageryLayerScope(options = {}) {
|
|
|
793
799
|
return useCollectionScope({
|
|
794
800
|
addEffect(instance, index) {
|
|
795
801
|
if (!collection.value) throw new Error("collection is not defined");
|
|
796
|
-
if ((0,
|
|
802
|
+
if ((0, _vesium_shared.isPromise)(instance)) return new Promise((resolve, reject) => {
|
|
797
803
|
instance.then((i) => {
|
|
798
804
|
collection.value.add(i, index);
|
|
799
805
|
resolve(i);
|
|
@@ -815,7 +821,7 @@ function useImageryLayerScope(options = {}) {
|
|
|
815
821
|
//#region usePostProcessStage/index.ts
|
|
816
822
|
function usePostProcessStage(data, options = {}) {
|
|
817
823
|
const { collection, isActive = true, evaluating } = options;
|
|
818
|
-
const result = (0,
|
|
824
|
+
const result = (0, _vueuse_core.computedAsync)(() => toPromiseValue(data), void 0, { evaluating });
|
|
819
825
|
const viewer = useViewer();
|
|
820
826
|
(0, vue.watchEffect)((onCleanup) => {
|
|
821
827
|
if (!viewer.value) return;
|
|
@@ -846,7 +852,7 @@ function usePostProcessStageScope(options = {}) {
|
|
|
846
852
|
return useCollectionScope({
|
|
847
853
|
addEffect(instance) {
|
|
848
854
|
if (!collection.value) throw new Error("collection is not defined");
|
|
849
|
-
if ((0,
|
|
855
|
+
if ((0, _vesium_shared.isPromise)(instance)) return new Promise((resolve, reject) => {
|
|
850
856
|
instance.then((instance$1) => {
|
|
851
857
|
collection.value.add(instance$1);
|
|
852
858
|
resolve(instance$1);
|
|
@@ -865,7 +871,7 @@ function usePostProcessStageScope(options = {}) {
|
|
|
865
871
|
//#region usePrimitive/index.ts
|
|
866
872
|
function usePrimitive(data, options = {}) {
|
|
867
873
|
const { collection, isActive = true, evaluating } = options;
|
|
868
|
-
const result = (0,
|
|
874
|
+
const result = (0, _vueuse_core.computedAsync)(() => toPromiseValue(data), void 0, { evaluating });
|
|
869
875
|
const viewer = useViewer();
|
|
870
876
|
(0, vue.watchEffect)((onCleanup) => {
|
|
871
877
|
if ((0, vue.toValue)(isActive)) {
|
|
@@ -896,7 +902,7 @@ function usePrimitiveScope(options = {}) {
|
|
|
896
902
|
const { scope, add, remove, removeWhere, removeScope } = useCollectionScope({
|
|
897
903
|
addEffect(instance, ...args) {
|
|
898
904
|
if (!collection.value) throw new Error("collection is not defined");
|
|
899
|
-
if ((0,
|
|
905
|
+
if ((0, _vesium_shared.isPromise)(instance)) return new Promise((resolve, reject) => {
|
|
900
906
|
instance.then((instance$1) => resolve(collection.value.add(instance$1, ...args))).catch((error) => reject(error));
|
|
901
907
|
});
|
|
902
908
|
else return collection.value.add(instance, ...args);
|
|
@@ -962,7 +968,7 @@ function useScaleBar(options = {}) {
|
|
|
962
968
|
const { maxPixel = 80, delay = 8 } = options;
|
|
963
969
|
const maxPixelRef = (0, vue.computed)(() => (0, vue.toValue)(maxPixel));
|
|
964
970
|
const viewer = useViewer();
|
|
965
|
-
const canvasSize = (0,
|
|
971
|
+
const canvasSize = (0, _vueuse_core.useElementSize)(() => viewer.value?.canvas);
|
|
966
972
|
const pixelDistance = (0, vue.ref)();
|
|
967
973
|
const setPixelDistance = async () => {
|
|
968
974
|
await (0, vue.nextTick)();
|
|
@@ -976,8 +982,8 @@ function useScaleBar(options = {}) {
|
|
|
976
982
|
if (!leftPosition || !rightPosition) return;
|
|
977
983
|
pixelDistance.value = new cesium.EllipsoidGeodesic(scene.globe.ellipsoid.cartesianToCartographic(leftPosition), scene.globe.ellipsoid.cartesianToCartographic(rightPosition)).surfaceDistance;
|
|
978
984
|
};
|
|
979
|
-
(0,
|
|
980
|
-
useCesiumEventListener(() => viewer.value?.camera.changed, (0,
|
|
985
|
+
(0, _vueuse_core.watchImmediate)(viewer, () => setPixelDistance());
|
|
986
|
+
useCesiumEventListener(() => viewer.value?.camera.changed, (0, _vesium_shared.throttle)(setPixelDistance, delay));
|
|
981
987
|
const distance = (0, vue.computed)(() => {
|
|
982
988
|
if (pixelDistance.value) return distances.find((item) => pixelDistance.value * maxPixelRef.value > item);
|
|
983
989
|
});
|
|
@@ -1007,7 +1013,7 @@ function useScaleBar(options = {}) {
|
|
|
1007
1013
|
function useSceneDrillPick(windowPosition, options = {}) {
|
|
1008
1014
|
const { width = 3, height = 3, limit, throttled = 8, isActive = true } = options;
|
|
1009
1015
|
const viewer = useViewer();
|
|
1010
|
-
const position = (0,
|
|
1016
|
+
const position = (0, _vueuse_core.refThrottled)((0, vue.computed)(() => (0, vue.toValue)(windowPosition)), throttled, false, true);
|
|
1011
1017
|
return (0, vue.computed)(() => {
|
|
1012
1018
|
if (position.value && (0, vue.toValue)(isActive)) return viewer.value?.scene.drillPick(position.value, (0, vue.toValue)(limit), (0, vue.toValue)(width), (0, vue.toValue)(height));
|
|
1013
1019
|
});
|
|
@@ -1039,10 +1045,10 @@ exports.useSceneDrillPick = useSceneDrillPick;
|
|
|
1039
1045
|
exports.useScenePick = useScenePick;
|
|
1040
1046
|
exports.useScreenSpaceEventHandler = useScreenSpaceEventHandler;
|
|
1041
1047
|
exports.useViewer = useViewer;
|
|
1042
|
-
Object.keys(
|
|
1048
|
+
Object.keys(_vesium_shared).forEach(function (k) {
|
|
1043
1049
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1044
1050
|
enumerable: true,
|
|
1045
|
-
get: function () { return
|
|
1051
|
+
get: function () { return _vesium_shared[k]; }
|
|
1046
1052
|
});
|
|
1047
1053
|
});
|
|
1048
1054
|
|