@vesium/plot 1.0.1-beta.38 → 1.0.1-beta.39

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
@@ -340,15 +340,12 @@ const EVENT_TYPE_RECORD = {
340
340
  };
341
341
  function usePositioned(type, listener) {
342
342
  const screenEvent = EVENT_TYPE_RECORD[type];
343
- const position = shallowRef();
344
- const pick = useScenePick(position);
343
+ const viewer = useViewer();
345
344
  useScreenSpaceEventHandler(screenEvent, (event) => {
346
- position.value = event.position.clone();
347
- });
348
- watch([position, pick], ([position2, pick2]) => {
349
- pick2 && position2 && listener({ event: { position: position2 }, pick: pick2 });
350
- }, {
351
- flush: "post"
345
+ var _a;
346
+ const position = event.position;
347
+ const pick = (_a = viewer.value) == null ? void 0 : _a.scene.pick(position);
348
+ pick && position && listener({ event: { position }, pick });
352
349
  });
353
350
  }
354
351
  const GLOBAL_GRAPHIC_SYMBOL = Symbol("GLOBAL_GRAPHIC_SYMBOL");
@@ -1231,7 +1228,7 @@ function useSkeleton(plots, current, getCurrentTime) {
1231
1228
  }
1232
1229
  return ((_a = activeEntity.value) == null ? void 0 : _a.id) === entity.id ? PlotAction.ACTIVE : ((_b = hoverEntity.value) == null ? void 0 : _b.id) === entity.id ? PlotAction.HOVER : PlotAction.IDLE;
1233
1230
  };
1234
- const update = throttle((plot, destroyed) => {
1231
+ const update = (plot, destroyed) => {
1235
1232
  const oldEntities = plot.skeletons;
1236
1233
  const entities = [];
1237
1234
  if (destroyed || plot.disabled) {
@@ -1278,7 +1275,7 @@ function useSkeleton(plots, current, getCurrentTime) {
1278
1275
  });
1279
1276
  }
1280
1277
  plot.skeletons = entities;
1281
- }, 1);
1278
+ };
1282
1279
  const { addGraphicEvent } = useGraphicEvent();
1283
1280
  watchEffect((onCleanup) => {
1284
1281
  const remove = addGraphicEvent("global", "DRAG", ({ event, pick, dragging, lockCamera }) => {
@@ -1381,16 +1378,18 @@ function useSkeleton(plots, current, getCurrentTime) {
1381
1378
  added.forEach((plot) => update(plot));
1382
1379
  removed.forEach((plot) => update(plot, true));
1383
1380
  });
1384
- useCesiumEventListener(() => plots.value.map((plot) => plot.definitionChanged), (plot, key, newValue, oldValue) => {
1385
- if (["disabled", "defining", "scheme", "sampled", "time"].includes(key)) {
1386
- update(plot);
1387
- }
1388
- if (key === "skeletons") {
1389
- const { added, removed } = arrayDiff(newValue, oldValue);
1390
- added.forEach((item) => entityScope.add(item));
1391
- removed.forEach((item) => entityScope.remove(item));
1381
+ useCesiumEventListener(
1382
+ () => plots.value.map((plot) => plot.definitionChanged),
1383
+ (plot, key, newValue, oldValue) => {
1384
+ if (["disabled", "defining", "scheme", "sampled", "time"].includes(key)) {
1385
+ nextTick(() => update(plot));
1386
+ } else if (key === "skeletons") {
1387
+ const { added, removed } = arrayDiff(newValue, oldValue);
1388
+ added.forEach((item) => entityScope.add(item));
1389
+ removed.forEach((item) => entityScope.remove(item));
1390
+ }
1392
1391
  }
1393
- });
1392
+ );
1394
1393
  watch(current, (plot, previous) => {
1395
1394
  plot && update(plot);
1396
1395
  previous && update(previous);