vesium 1.0.1-beta.47 → 1.0.1-beta.49

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useMutationObserver, tryOnScopeDispose, promiseTimeout, refThrottled, watchThrottled, computedAsync, useElementBounding, useElementSize, watchImmediate } from "@vueuse/core";
2
- import { Viewer, defined, Ellipsoid, Cartesian3, Math as Math$1, Cartographic, Material, CallbackProperty, ConstantProperty, Cartesian2, ScreenSpaceEventHandler, ScreenSpaceEventType, EllipsoidGeodesic } from "cesium";
2
+ import { Viewer, Ellipsoid, Cartesian3, Math as Math$1, Cartographic, defined, Material, CallbackProperty, ConstantProperty, Cartesian2, ScreenSpaceEventHandler, ScreenSpaceEventType, EllipsoidGeodesic } from "cesium";
3
3
  import { shallowRef, shallowReadonly, provide, getCurrentScope, computed, watchEffect, toRaw, toValue, markRaw, toRef, inject, watch, ref, readonly, shallowReactive, nextTick } from "vue";
4
4
  const CREATE_VIEWER_INJECTION_KEY = Symbol("CREATE_VIEWER_INJECTION_KEY");
5
5
  const CREATE_VIEWER_COLLECTION = /* @__PURE__ */ new WeakMap();
@@ -48,6 +48,37 @@ function createViewer(...args) {
48
48
  return ((_a = viewer.value) == null ? void 0 : _a.isDestroyed()) ? void 0 : viewer.value;
49
49
  });
50
50
  }
51
+ function arrayDiff(list, oldList) {
52
+ const oldListSet = new Set(oldList);
53
+ const added = list.filter((obj) => !oldListSet.has(obj));
54
+ const newListSet = new Set(list);
55
+ const removed = (oldList == null ? void 0 : oldList.filter((obj) => !newListSet.has(obj))) ?? [];
56
+ return { added, removed };
57
+ }
58
+ function canvasCoordToCartesian(canvasCoord, scene, mode = "auto") {
59
+ if (mode === "pickPosition") {
60
+ return scene.pickPosition(canvasCoord);
61
+ } else if (mode === "globePick") {
62
+ const ray = scene.camera.getPickRay(canvasCoord);
63
+ return ray && scene.globe.pick(ray, scene);
64
+ } else {
65
+ if (scene.globe.depthTestAgainstTerrain) {
66
+ return scene.pickPosition(canvasCoord);
67
+ }
68
+ const position1 = scene.pickPosition(canvasCoord);
69
+ const ray = scene.camera.getPickRay(canvasCoord);
70
+ const position2 = ray && scene.globe.pick(ray, scene);
71
+ if (!position1) {
72
+ return position2;
73
+ }
74
+ const height1 = (position1 && Ellipsoid.WGS84.cartesianToCartographic(position1).height) ?? 0;
75
+ const height2 = (position2 && Ellipsoid.WGS84.cartesianToCartographic(position2).height) ?? 0;
76
+ return height1 < height2 ? position1 : position2;
77
+ }
78
+ }
79
+ function cartesianToCanvasCoord(position, scene) {
80
+ return scene.cartesianToCanvasCoordinates(position);
81
+ }
51
82
  const toString = Object.prototype.toString;
52
83
  function isDef(val) {
53
84
  return typeof val !== "undefined";
@@ -89,33 +120,6 @@ function assertError(condition, error) {
89
120
  function cesiumEquals(left, right) {
90
121
  return left === right || isFunction(left == null ? void 0 : left.equals) && left.equals(right) || isFunction(right == null ? void 0 : right.equals) && right.equals(left);
91
122
  }
92
- function isCesiumConstant(value) {
93
- return !defined(value) || !!value.isConstant;
94
- }
95
- function canvasCoordToCartesian(canvasCoord, scene, mode = "auto") {
96
- if (mode === "pickPosition") {
97
- return scene.pickPosition(canvasCoord);
98
- } else if (mode === "globePick") {
99
- const ray = scene.camera.getPickRay(canvasCoord);
100
- return ray && scene.globe.pick(ray, scene);
101
- } else {
102
- if (scene.globe.depthTestAgainstTerrain) {
103
- return scene.pickPosition(canvasCoord);
104
- }
105
- const position1 = scene.pickPosition(canvasCoord);
106
- const ray = scene.camera.getPickRay(canvasCoord);
107
- const position2 = ray && scene.globe.pick(ray, scene);
108
- if (!position1) {
109
- return position2;
110
- }
111
- const height1 = (position1 && Ellipsoid.WGS84.cartesianToCartographic(position1).height) ?? 0;
112
- const height2 = (position2 && Ellipsoid.WGS84.cartesianToCartographic(position2).height) ?? 0;
113
- return height1 < height2 ? position1 : position2;
114
- }
115
- }
116
- function cartesianToCanvasCoord(position, scene) {
117
- return scene.cartesianToCanvasCoordinates(position);
118
- }
119
123
  function toCoord(position, options = {}) {
120
124
  if (!position) {
121
125
  return void 0;
@@ -202,6 +206,9 @@ function dmsToDegrees(dms) {
202
206
  const latitude = dmsDecode(y);
203
207
  return [longitude, latitude, Number(height) || 0];
204
208
  }
209
+ function isCesiumConstant(value) {
210
+ return !defined(value) || !!value.isConstant;
211
+ }
205
212
  class CesiumMaterial extends Material {
206
213
  constructor(options) {
207
214
  super(options);
@@ -405,13 +412,6 @@ function tryRun(fn) {
405
412
  }
406
413
  };
407
414
  }
408
- function arrayDiff(list, oldList) {
409
- const oldListSet = new Set(oldList);
410
- const added = list.filter((obj) => !oldListSet.has(obj));
411
- const newListSet = new Set(list);
412
- const removed = (oldList == null ? void 0 : oldList.filter((obj) => !newListSet.has(obj))) ?? [];
413
- return { added, removed };
414
- }
415
415
  async function toPromiseValue(source, options = {}) {
416
416
  try {
417
417
  const { raw = true } = options;