vesium 1.0.1-beta.57 → 1.0.1-beta.59
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 +52 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.iife.js +51 -49
- 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 +4 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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,12 @@ 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,
|
|
337
|
+
const result = (0, _vesium_shared.cartesianToCanvasCoord)(cartesian3.value, viewer.value.scene);
|
|
336
338
|
coord.value = !cesium.Cartesian2.equals(result, coord.value) ? result : coord.value;
|
|
337
339
|
}
|
|
338
340
|
});
|
|
339
|
-
const canvasBounding = (0,
|
|
340
|
-
const targetBounding = (0,
|
|
341
|
+
const canvasBounding = (0, _vueuse_core.useElementBounding)(() => viewer.value?.canvas.parentElement);
|
|
342
|
+
const targetBounding = (0, _vueuse_core.useElementBounding)(target);
|
|
341
343
|
const finalOffset = (0, vue.computed)(() => {
|
|
342
344
|
const _offset = (0, vue.toValue)(offset);
|
|
343
345
|
let x$1 = _offset?.x ?? 0;
|
|
@@ -391,7 +393,7 @@ function useElementOverlay(target, position, options = {}) {
|
|
|
391
393
|
//#region useEntity/index.ts
|
|
392
394
|
function useEntity(data, options = {}) {
|
|
393
395
|
const { collection, isActive = true, evaluating } = options;
|
|
394
|
-
const result = (0,
|
|
396
|
+
const result = (0, _vueuse_core.computedAsync)(() => toPromiseValue(data), [], { evaluating });
|
|
395
397
|
const viewer = useViewer();
|
|
396
398
|
(0, vue.watchEffect)((onCleanup) => {
|
|
397
399
|
if ((0, vue.toValue)(isActive)) {
|
|
@@ -421,7 +423,7 @@ function useEntityScope(options = {}) {
|
|
|
421
423
|
return useCollectionScope({
|
|
422
424
|
addEffect(instance) {
|
|
423
425
|
if (!collection.value) throw new Error("collection is not defined");
|
|
424
|
-
if ((0,
|
|
426
|
+
if ((0, _vesium_shared.isPromise)(instance)) return new Promise((resolve, reject) => {
|
|
425
427
|
instance.then((i) => {
|
|
426
428
|
collection.value.add(i);
|
|
427
429
|
resolve(i);
|
|
@@ -452,7 +454,7 @@ function useScenePick(windowPosition, options = {}) {
|
|
|
452
454
|
const { width = 3, height = 3, throttled = 8 } = options;
|
|
453
455
|
const isActive = (0, vue.toRef)(options.isActive ?? true);
|
|
454
456
|
const viewer = useViewer();
|
|
455
|
-
const position = (0,
|
|
457
|
+
const position = (0, _vueuse_core.refThrottled)((0, vue.computed)(() => (0, vue.toValue)(windowPosition)?.clone()), throttled, false, true);
|
|
456
458
|
const pick = (0, vue.shallowRef)();
|
|
457
459
|
(0, vue.watchEffect)(() => {
|
|
458
460
|
if (viewer.value && position.value && isActive.value) {
|
|
@@ -492,7 +494,7 @@ function useScreenSpaceEventHandler(type, inputAction, options = {}) {
|
|
|
492
494
|
const modifierValue = (0, vue.toValue)(modifier);
|
|
493
495
|
const handlerValue = (0, vue.toValue)(handler);
|
|
494
496
|
if (!handlerValue || !isActive.value || !inputAction) return;
|
|
495
|
-
if ((0,
|
|
497
|
+
if ((0, _vesium_shared.isDef)(typeValue)) {
|
|
496
498
|
handlerValue.setInputAction(inputAction, typeValue, modifierValue);
|
|
497
499
|
onCleanup(() => handlerValue.removeInputAction(typeValue, modifierValue));
|
|
498
500
|
}
|
|
@@ -501,7 +503,7 @@ function useScreenSpaceEventHandler(type, inputAction, options = {}) {
|
|
|
501
503
|
cleanup1();
|
|
502
504
|
cleanup2();
|
|
503
505
|
};
|
|
504
|
-
(0,
|
|
506
|
+
(0, _vueuse_core.tryOnScopeDispose)(stop);
|
|
505
507
|
return stop;
|
|
506
508
|
}
|
|
507
509
|
|
|
@@ -541,7 +543,7 @@ function useDrag(listener) {
|
|
|
541
543
|
dragging.value = true;
|
|
542
544
|
position.value = event.position.clone();
|
|
543
545
|
});
|
|
544
|
-
const stopMouseMoveWatch = useScreenSpaceEventHandler(cesium.ScreenSpaceEventType.MOUSE_MOVE, (0,
|
|
546
|
+
const stopMouseMoveWatch = useScreenSpaceEventHandler(cesium.ScreenSpaceEventType.MOUSE_MOVE, (0, _vesium_shared.throttle)(({ startPosition, endPosition }) => {
|
|
545
547
|
motionEvent.value = {
|
|
546
548
|
startPosition: motionEvent.value?.endPosition.clone() || startPosition.clone(),
|
|
547
549
|
endPosition: endPosition.clone()
|
|
@@ -564,7 +566,7 @@ function useDrag(listener) {
|
|
|
564
566
|
stopMouseMoveWatch();
|
|
565
567
|
stopLeftUpWatch();
|
|
566
568
|
};
|
|
567
|
-
(0,
|
|
569
|
+
(0, _vueuse_core.tryOnScopeDispose)(stop);
|
|
568
570
|
return stop;
|
|
569
571
|
}
|
|
570
572
|
|
|
@@ -679,15 +681,15 @@ function useGraphicEvent() {
|
|
|
679
681
|
eventTypeMap.get(type) ?? eventTypeMap.set(type, /* @__PURE__ */ new Set());
|
|
680
682
|
eventTypeMap.get(type).add(listener);
|
|
681
683
|
let { cursor = "pointer", dragCursor } = options;
|
|
682
|
-
if ((0,
|
|
683
|
-
const _cursor = (0,
|
|
684
|
+
if ((0, _vesium_shared.isDef)(cursor)) {
|
|
685
|
+
const _cursor = (0, _vesium_shared.isFunction)(cursor) ? cursor : () => cursor;
|
|
684
686
|
cursorCollection.get(_graphic) ?? cursorCollection.set(_graphic, /* @__PURE__ */ new Map());
|
|
685
687
|
cursorCollection.get(_graphic).get(type) ?? cursorCollection.get(_graphic).set(type, /* @__PURE__ */ new Map());
|
|
686
688
|
cursorCollection.get(_graphic).get(type).set(listener, _cursor);
|
|
687
689
|
}
|
|
688
690
|
if (type === "DRAG") dragCursor ??= ((event) => event?.dragging ? "crosshair" : void 0);
|
|
689
|
-
if ((0,
|
|
690
|
-
const _dragCursor = (0,
|
|
691
|
+
if ((0, _vesium_shared.isDef)(dragCursor)) {
|
|
692
|
+
const _dragCursor = (0, _vesium_shared.isFunction)(dragCursor) ? dragCursor : () => dragCursor;
|
|
691
693
|
dragCursorCollection.get(_graphic) ?? dragCursorCollection.set(_graphic, /* @__PURE__ */ new Map());
|
|
692
694
|
dragCursorCollection.get(_graphic).get(type) ?? dragCursorCollection.get(_graphic).set(type, /* @__PURE__ */ new Map());
|
|
693
695
|
dragCursorCollection.get(_graphic).get(type).set(listener, _dragCursor);
|
|
@@ -710,31 +712,31 @@ function useGraphicEvent() {
|
|
|
710
712
|
if (dragCursorCollection?.get(_graphic)?.size === 0) dragCursorCollection?.delete(_graphic);
|
|
711
713
|
};
|
|
712
714
|
for (const type of POSITIONED_EVENT_TYPES) usePositioned(type, (event) => {
|
|
713
|
-
(0,
|
|
714
|
-
collection.get(graphic)?.get(type)?.forEach((fn) => (0,
|
|
715
|
+
(0, _vesium_shared.resolvePick)(event.pick).concat(GLOBAL_GRAPHIC_SYMBOL).forEach((graphic) => {
|
|
716
|
+
collection.get(graphic)?.get(type)?.forEach((fn) => (0, _vesium_shared.tryRun)(fn)?.(event));
|
|
715
717
|
});
|
|
716
718
|
});
|
|
717
719
|
const dragging = (0, vue.ref)(false);
|
|
718
720
|
const viewer = useViewer();
|
|
719
721
|
useHover((event) => {
|
|
720
|
-
(0,
|
|
721
|
-
collection.get(graphic)?.get("HOVER")?.forEach((fn) => (0,
|
|
722
|
+
(0, _vesium_shared.resolvePick)(event.pick).concat(GLOBAL_GRAPHIC_SYMBOL).forEach((graphic) => {
|
|
723
|
+
collection.get(graphic)?.get("HOVER")?.forEach((fn) => (0, _vesium_shared.tryRun)(fn)?.(event));
|
|
722
724
|
if (!dragging.value) cursorCollection.get(graphic)?.forEach((map) => {
|
|
723
725
|
map.forEach((fn) => {
|
|
724
|
-
const cursor = event.hovering ? (0,
|
|
726
|
+
const cursor = event.hovering ? (0, _vesium_shared.tryRun)(fn)(event) : "";
|
|
725
727
|
viewer.value?.canvas.style?.setProperty("cursor", cursor);
|
|
726
728
|
});
|
|
727
729
|
});
|
|
728
730
|
});
|
|
729
731
|
});
|
|
730
732
|
useDrag((event) => {
|
|
731
|
-
const graphics = (0,
|
|
733
|
+
const graphics = (0, _vesium_shared.resolvePick)(event.pick).concat(GLOBAL_GRAPHIC_SYMBOL);
|
|
732
734
|
dragging.value = event.dragging;
|
|
733
735
|
graphics.forEach((graphic) => {
|
|
734
|
-
collection.get(graphic)?.get("DRAG")?.forEach((fn) => (0,
|
|
736
|
+
collection.get(graphic)?.get("DRAG")?.forEach((fn) => (0, _vesium_shared.tryRun)(fn)(event));
|
|
735
737
|
dragCursorCollection.get(graphic)?.forEach((map) => {
|
|
736
738
|
map.forEach((fn) => {
|
|
737
|
-
const cursor = event.dragging ? (0,
|
|
739
|
+
const cursor = event.dragging ? (0, _vesium_shared.tryRun)(fn)(event) : "";
|
|
738
740
|
viewer.value?.canvas.style?.setProperty("cursor", cursor);
|
|
739
741
|
});
|
|
740
742
|
});
|
|
@@ -751,7 +753,7 @@ function useGraphicEvent() {
|
|
|
751
753
|
//#region useImageryLayer/index.ts
|
|
752
754
|
function useImageryLayer(data, options = {}) {
|
|
753
755
|
const { destroyOnRemove, collection, isActive = true, evaluating } = options;
|
|
754
|
-
const result = (0,
|
|
756
|
+
const result = (0, _vueuse_core.computedAsync)(() => toPromiseValue(data), [], { evaluating });
|
|
755
757
|
const viewer = useViewer();
|
|
756
758
|
(0, vue.watchEffect)((onCleanup) => {
|
|
757
759
|
if ((0, vue.toValue)(isActive)) {
|
|
@@ -793,7 +795,7 @@ function useImageryLayerScope(options = {}) {
|
|
|
793
795
|
return useCollectionScope({
|
|
794
796
|
addEffect(instance, index) {
|
|
795
797
|
if (!collection.value) throw new Error("collection is not defined");
|
|
796
|
-
if ((0,
|
|
798
|
+
if ((0, _vesium_shared.isPromise)(instance)) return new Promise((resolve, reject) => {
|
|
797
799
|
instance.then((i) => {
|
|
798
800
|
collection.value.add(i, index);
|
|
799
801
|
resolve(i);
|
|
@@ -815,7 +817,7 @@ function useImageryLayerScope(options = {}) {
|
|
|
815
817
|
//#region usePostProcessStage/index.ts
|
|
816
818
|
function usePostProcessStage(data, options = {}) {
|
|
817
819
|
const { collection, isActive = true, evaluating } = options;
|
|
818
|
-
const result = (0,
|
|
820
|
+
const result = (0, _vueuse_core.computedAsync)(() => toPromiseValue(data), void 0, { evaluating });
|
|
819
821
|
const viewer = useViewer();
|
|
820
822
|
(0, vue.watchEffect)((onCleanup) => {
|
|
821
823
|
if (!viewer.value) return;
|
|
@@ -846,7 +848,7 @@ function usePostProcessStageScope(options = {}) {
|
|
|
846
848
|
return useCollectionScope({
|
|
847
849
|
addEffect(instance) {
|
|
848
850
|
if (!collection.value) throw new Error("collection is not defined");
|
|
849
|
-
if ((0,
|
|
851
|
+
if ((0, _vesium_shared.isPromise)(instance)) return new Promise((resolve, reject) => {
|
|
850
852
|
instance.then((instance$1) => {
|
|
851
853
|
collection.value.add(instance$1);
|
|
852
854
|
resolve(instance$1);
|
|
@@ -865,7 +867,7 @@ function usePostProcessStageScope(options = {}) {
|
|
|
865
867
|
//#region usePrimitive/index.ts
|
|
866
868
|
function usePrimitive(data, options = {}) {
|
|
867
869
|
const { collection, isActive = true, evaluating } = options;
|
|
868
|
-
const result = (0,
|
|
870
|
+
const result = (0, _vueuse_core.computedAsync)(() => toPromiseValue(data), void 0, { evaluating });
|
|
869
871
|
const viewer = useViewer();
|
|
870
872
|
(0, vue.watchEffect)((onCleanup) => {
|
|
871
873
|
if ((0, vue.toValue)(isActive)) {
|
|
@@ -896,7 +898,7 @@ function usePrimitiveScope(options = {}) {
|
|
|
896
898
|
const { scope, add, remove, removeWhere, removeScope } = useCollectionScope({
|
|
897
899
|
addEffect(instance, ...args) {
|
|
898
900
|
if (!collection.value) throw new Error("collection is not defined");
|
|
899
|
-
if ((0,
|
|
901
|
+
if ((0, _vesium_shared.isPromise)(instance)) return new Promise((resolve, reject) => {
|
|
900
902
|
instance.then((instance$1) => resolve(collection.value.add(instance$1, ...args))).catch((error) => reject(error));
|
|
901
903
|
});
|
|
902
904
|
else return collection.value.add(instance, ...args);
|
|
@@ -962,7 +964,7 @@ function useScaleBar(options = {}) {
|
|
|
962
964
|
const { maxPixel = 80, delay = 8 } = options;
|
|
963
965
|
const maxPixelRef = (0, vue.computed)(() => (0, vue.toValue)(maxPixel));
|
|
964
966
|
const viewer = useViewer();
|
|
965
|
-
const canvasSize = (0,
|
|
967
|
+
const canvasSize = (0, _vueuse_core.useElementSize)(() => viewer.value?.canvas);
|
|
966
968
|
const pixelDistance = (0, vue.ref)();
|
|
967
969
|
const setPixelDistance = async () => {
|
|
968
970
|
await (0, vue.nextTick)();
|
|
@@ -976,8 +978,8 @@ function useScaleBar(options = {}) {
|
|
|
976
978
|
if (!leftPosition || !rightPosition) return;
|
|
977
979
|
pixelDistance.value = new cesium.EllipsoidGeodesic(scene.globe.ellipsoid.cartesianToCartographic(leftPosition), scene.globe.ellipsoid.cartesianToCartographic(rightPosition)).surfaceDistance;
|
|
978
980
|
};
|
|
979
|
-
(0,
|
|
980
|
-
useCesiumEventListener(() => viewer.value?.camera.changed, (0,
|
|
981
|
+
(0, _vueuse_core.watchImmediate)(viewer, () => setPixelDistance());
|
|
982
|
+
useCesiumEventListener(() => viewer.value?.camera.changed, (0, _vesium_shared.throttle)(setPixelDistance, delay));
|
|
981
983
|
const distance = (0, vue.computed)(() => {
|
|
982
984
|
if (pixelDistance.value) return distances.find((item) => pixelDistance.value * maxPixelRef.value > item);
|
|
983
985
|
});
|
|
@@ -1007,7 +1009,7 @@ function useScaleBar(options = {}) {
|
|
|
1007
1009
|
function useSceneDrillPick(windowPosition, options = {}) {
|
|
1008
1010
|
const { width = 3, height = 3, limit, throttled = 8, isActive = true } = options;
|
|
1009
1011
|
const viewer = useViewer();
|
|
1010
|
-
const position = (0,
|
|
1012
|
+
const position = (0, _vueuse_core.refThrottled)((0, vue.computed)(() => (0, vue.toValue)(windowPosition)), throttled, false, true);
|
|
1011
1013
|
return (0, vue.computed)(() => {
|
|
1012
1014
|
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
1015
|
});
|
|
@@ -1039,10 +1041,10 @@ exports.useSceneDrillPick = useSceneDrillPick;
|
|
|
1039
1041
|
exports.useScenePick = useScenePick;
|
|
1040
1042
|
exports.useScreenSpaceEventHandler = useScreenSpaceEventHandler;
|
|
1041
1043
|
exports.useViewer = useViewer;
|
|
1042
|
-
Object.keys(
|
|
1044
|
+
Object.keys(_vesium_shared).forEach(function (k) {
|
|
1043
1045
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1044
1046
|
enumerable: true,
|
|
1045
|
-
get: function () { return
|
|
1047
|
+
get: function () { return _vesium_shared[k]; }
|
|
1046
1048
|
});
|
|
1047
1049
|
});
|
|
1048
1050
|
|