vesium 1.0.1-beta.65 → 1.0.1-beta.68
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/dist/index.cjs +32 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +32 -31
- 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 +32 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -101,8 +101,8 @@ function useCesiumEventListener(event, listener, options = {}) {
|
|
|
101
101
|
const events = Array.isArray(_event) ? _event : [_event];
|
|
102
102
|
if (events) {
|
|
103
103
|
if (events.length && isActive.value) {
|
|
104
|
-
const stopFns = events.map((event
|
|
105
|
-
const e = toValue(event
|
|
104
|
+
const stopFns = events.map((event) => {
|
|
105
|
+
const e = toValue(event);
|
|
106
106
|
return e?.addEventListener(listener, e);
|
|
107
107
|
});
|
|
108
108
|
onCleanup(() => stopFns.forEach((stop) => stop?.()));
|
|
@@ -346,17 +346,17 @@ function useElementOverlay(target, position, options = {}) {
|
|
|
346
346
|
const targetSize = useElementSize(target, void 0, { box: "border-box" });
|
|
347
347
|
const finalOffset = computed(() => {
|
|
348
348
|
const _offset = toValue(offset);
|
|
349
|
-
let x
|
|
349
|
+
let x = _offset?.x ?? 0;
|
|
350
350
|
const _horizontal = toValue(horizontal);
|
|
351
|
-
if (_horizontal === "center") x
|
|
352
|
-
else if (_horizontal === "right") x
|
|
353
|
-
let y
|
|
351
|
+
if (_horizontal === "center") x -= targetSize.width.value / 2;
|
|
352
|
+
else if (_horizontal === "right") x -= targetSize.width.value;
|
|
353
|
+
let y = _offset?.y ?? 0;
|
|
354
354
|
const _vertical = toValue(vertical);
|
|
355
|
-
if (_vertical === "center") y
|
|
356
|
-
else if (_vertical === "bottom") y
|
|
355
|
+
if (_vertical === "center") y -= targetSize.height.value / 2;
|
|
356
|
+
else if (_vertical === "bottom") y -= targetSize.height.value;
|
|
357
357
|
return {
|
|
358
|
-
x
|
|
359
|
-
y
|
|
358
|
+
x,
|
|
359
|
+
y
|
|
360
360
|
};
|
|
361
361
|
});
|
|
362
362
|
const x = computed(() => {
|
|
@@ -516,19 +516,19 @@ function useDrag(listener) {
|
|
|
516
516
|
const dragging = ref(false);
|
|
517
517
|
const viewer = useViewer();
|
|
518
518
|
const cameraLocked = ref(false);
|
|
519
|
-
watch(cameraLocked, (cameraLocked
|
|
520
|
-
viewer.value && (viewer.value.scene.screenSpaceCameraController.enableRotate = !cameraLocked
|
|
519
|
+
watch(cameraLocked, (cameraLocked) => {
|
|
520
|
+
viewer.value && (viewer.value.scene.screenSpaceCameraController.enableRotate = !cameraLocked);
|
|
521
521
|
});
|
|
522
522
|
const lockCamera = () => {
|
|
523
523
|
cameraLocked.value = true;
|
|
524
524
|
};
|
|
525
|
-
const execute = (pick
|
|
525
|
+
const execute = (pick, startPosition, endPosition) => {
|
|
526
526
|
listener({
|
|
527
527
|
event: {
|
|
528
528
|
startPosition: startPosition.clone(),
|
|
529
529
|
endPosition: endPosition.clone()
|
|
530
530
|
},
|
|
531
|
-
pick
|
|
531
|
+
pick,
|
|
532
532
|
dragging: dragging.value,
|
|
533
533
|
lockCamera
|
|
534
534
|
});
|
|
@@ -546,10 +546,10 @@ function useDrag(listener) {
|
|
|
546
546
|
endPosition: endPosition.clone()
|
|
547
547
|
};
|
|
548
548
|
}, 8, false, true));
|
|
549
|
-
watch([pick, motionEvent], ([pick
|
|
550
|
-
if (pick
|
|
551
|
-
const { startPosition, endPosition } = motionEvent
|
|
552
|
-
dragging.value && execute(pick
|
|
549
|
+
watch([pick, motionEvent], ([pick, motionEvent]) => {
|
|
550
|
+
if (pick && motionEvent) {
|
|
551
|
+
const { startPosition, endPosition } = motionEvent;
|
|
552
|
+
dragging.value && execute(pick, startPosition, endPosition);
|
|
553
553
|
}
|
|
554
554
|
});
|
|
555
555
|
const stopLeftUpWatch = useScreenSpaceEventHandler(ScreenSpaceEventType.LEFT_UP, (event) => {
|
|
@@ -575,13 +575,13 @@ function useDrag(listener) {
|
|
|
575
575
|
function useHover(listener) {
|
|
576
576
|
const motionEvent = shallowRef();
|
|
577
577
|
const pick = useScenePick(() => motionEvent.value?.endPosition);
|
|
578
|
-
const execute = (pick
|
|
578
|
+
const execute = (pick, startPosition, endPosition, hovering) => {
|
|
579
579
|
listener({
|
|
580
580
|
event: {
|
|
581
581
|
startPosition: startPosition.clone(),
|
|
582
582
|
endPosition: endPosition.clone()
|
|
583
583
|
},
|
|
584
|
-
pick
|
|
584
|
+
pick,
|
|
585
585
|
hovering
|
|
586
586
|
});
|
|
587
587
|
};
|
|
@@ -591,13 +591,13 @@ function useHover(listener) {
|
|
|
591
591
|
endPosition: endPosition.clone()
|
|
592
592
|
};
|
|
593
593
|
});
|
|
594
|
-
watch([pick, motionEvent], ([pick
|
|
595
|
-
if (pick
|
|
596
|
-
const { startPosition, endPosition } = motionEvent
|
|
597
|
-
execute(pick
|
|
594
|
+
watch([pick, motionEvent], ([pick, motionEvent]) => {
|
|
595
|
+
if (pick && motionEvent) {
|
|
596
|
+
const { startPosition, endPosition } = motionEvent;
|
|
597
|
+
execute(pick, startPosition, endPosition, true);
|
|
598
598
|
}
|
|
599
599
|
});
|
|
600
|
-
watch(pick, (pick
|
|
600
|
+
watch(pick, (pick, prevPick) => {
|
|
601
601
|
if (prevPick && motionEvent.value) {
|
|
602
602
|
const { startPosition, endPosition } = motionEvent.value;
|
|
603
603
|
execute(prevPick, startPosition, endPosition, false);
|
|
@@ -749,13 +749,14 @@ function useGraphicEvent() {
|
|
|
749
749
|
//#endregion
|
|
750
750
|
//#region useImageryLayer/index.ts
|
|
751
751
|
function useImageryLayer(data, options = {}) {
|
|
752
|
-
const { destroyOnRemove, collection, isActive = true, evaluating } = options;
|
|
752
|
+
const { destroyOnRemove, collection, isActive = true, evaluating, index } = options;
|
|
753
753
|
const result = computedAsync(() => toPromiseValue(data), [], { evaluating });
|
|
754
754
|
const viewer = useViewer();
|
|
755
755
|
watchEffect((onCleanup) => {
|
|
756
756
|
if (toValue(isActive)) {
|
|
757
757
|
const list = Array.isArray(result.value) ? [...result.value] : [result.value];
|
|
758
758
|
const _collection = collection ?? viewer.value?.imageryLayers;
|
|
759
|
+
const _index = toValue(index);
|
|
759
760
|
if (collection?.isDestroyed()) return;
|
|
760
761
|
list.forEach((item) => {
|
|
761
762
|
if (!item) {
|
|
@@ -766,7 +767,7 @@ function useImageryLayer(data, options = {}) {
|
|
|
766
767
|
console.warn("ImageryLayer is destroyed");
|
|
767
768
|
return;
|
|
768
769
|
}
|
|
769
|
-
_collection?.add(item);
|
|
770
|
+
_collection?.add(item, _index);
|
|
770
771
|
});
|
|
771
772
|
onCleanup(() => {
|
|
772
773
|
const destroy = toValue(destroyOnRemove);
|
|
@@ -846,9 +847,9 @@ function usePostProcessStageScope(options = {}) {
|
|
|
846
847
|
addEffect(instance) {
|
|
847
848
|
if (!collection.value) throw new Error("collection is not defined");
|
|
848
849
|
if (isPromise(instance)) return new Promise((resolve, reject) => {
|
|
849
|
-
instance.then((instance
|
|
850
|
-
collection.value.add(instance
|
|
851
|
-
resolve(instance
|
|
850
|
+
instance.then((instance) => {
|
|
851
|
+
collection.value.add(instance);
|
|
852
|
+
resolve(instance);
|
|
852
853
|
}).catch((error) => reject(error));
|
|
853
854
|
});
|
|
854
855
|
else return collection.value.add(instance);
|
|
@@ -896,7 +897,7 @@ function usePrimitiveScope(options = {}) {
|
|
|
896
897
|
addEffect(instance, ...args) {
|
|
897
898
|
if (!collection.value) throw new Error("collection is not defined");
|
|
898
899
|
if (isPromise(instance)) return new Promise((resolve, reject) => {
|
|
899
|
-
instance.then((instance
|
|
900
|
+
instance.then((instance) => resolve(collection.value.add(instance, ...args))).catch((error) => reject(error));
|
|
900
901
|
});
|
|
901
902
|
else return collection.value.add(instance, ...args);
|
|
902
903
|
},
|