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