@vesium/plot 1.0.1-beta.68 → 1.0.1-beta.71

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
@@ -251,7 +251,7 @@ var SampledPlotProperty = class SampledPlotProperty {
251
251
  * @param value 样本数据对象,包含时间、位置和导数信息
252
252
  */
253
253
  setSample(value) {
254
- const time = value.time?.clone() ?? this._times[0].clone();
254
+ const time = value.time?.clone() ?? this._times[0]?.clone() ?? new JulianDate(0, 0);
255
255
  const positions = value.positions?.map((item) => item.clone()) ?? [];
256
256
  const derivative = value.derivative;
257
257
  const index = this._times.findIndex((t) => JulianDate.equals(time, t));
@@ -330,10 +330,11 @@ var PlotFeature = class {
330
330
  this._id = id || createGuid();
331
331
  this._scheme = PlotScheme.resolve(options.scheme);
332
332
  this._definitionChanged = new Event();
333
- this._defining = true;
334
333
  this._disabled = disabled;
335
334
  this._sampled = sampled instanceof SampledPlotProperty ? sampled : new SampledPlotProperty(sampled);
336
335
  this._sampled.definitionChanged.addEventListener((property) => this._definitionChanged.raiseEvent(this, "sampled", property, property), this);
336
+ const packable = this._sampled.getValue();
337
+ this._defining = !(packable.positions && packable.positions.length > 0);
337
338
  const init = this._scheme.initRender?.() ?? {};
338
339
  this._entities = [...init.entities ?? []];
339
340
  this._primitives = [...init.primitives ?? []];
@@ -391,7 +392,10 @@ var PlotFeature = class {
391
392
  return this._disabled;
392
393
  }
393
394
  set disabled(value) {
394
- this.disabled = value;
395
+ if (this._disabled !== value) {
396
+ this._definitionChanged.raiseEvent(this, "disabled", value, this._disabled);
397
+ this._disabled = value;
398
+ }
395
399
  }
396
400
  /**
397
401
  * @internal
@@ -682,17 +686,18 @@ function useSkeleton(plots, current, getCurrentTime) {
682
686
  onCleanup(graphicEvent.add("global", "DRAG", ({ event, pick, dragging, lockCamera }) => {
683
687
  if (pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(pick.id)) {
684
688
  const entity = pick.id;
685
- const plot = entity.plot;
686
- if (plot.defining) return;
689
+ const feature = entity.plot;
690
+ if (feature.defining) return;
687
691
  activeEntity.value = entity;
688
692
  const skeleton = entity.skeleton;
689
693
  const index = entity.index;
690
- const packable = plot.sampled.getValue(getCurrentTime());
694
+ const packable = feature.sampled.getValue(getCurrentTime());
691
695
  skeleton.onDrag?.({
692
696
  viewer: viewer.value,
693
- sampled: plot.sampled,
697
+ feature,
698
+ sampled: feature.sampled,
694
699
  packable,
695
- active: current.value === plot,
700
+ active: current.value === feature,
696
701
  index,
697
702
  event,
698
703
  dragging,
@@ -717,13 +722,14 @@ function useSkeleton(plots, current, getCurrentTime) {
717
722
  onKeyStroke((keyEvent) => {
718
723
  if (activeEntity.value) {
719
724
  const entity = activeEntity.value;
720
- const plot = entity.plot;
725
+ const feature = entity.plot;
721
726
  const skeleton = entity.skeleton;
722
727
  const index = entity.index;
723
- const packable = plot.sampled.getValue(getCurrentTime());
728
+ const packable = feature.sampled.getValue(getCurrentTime());
724
729
  skeleton.onKeyPressed?.({
725
730
  viewer: viewer.value,
726
- sampled: plot.sampled,
731
+ feature,
732
+ sampled: feature.sampled,
727
733
  packable,
728
734
  index,
729
735
  keyEvent
@@ -741,16 +747,17 @@ function useSkeleton(plots, current, getCurrentTime) {
741
747
  if (pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(pick.id)) {
742
748
  const entity = pick.id;
743
749
  activeEntity.value = entity;
744
- const plot = entity.plot;
750
+ const feature = entity.plot;
745
751
  const skeleton = entity.skeleton;
746
752
  const index = entity.index;
747
- const packable = plot.sampled.getValue(getCurrentTime());
753
+ const packable = feature.sampled.getValue(getCurrentTime());
748
754
  skeleton.onLeftClick?.({
749
755
  viewer: viewer.value,
750
- sampled: plot.sampled,
756
+ feature,
757
+ sampled: feature.sampled,
751
758
  packable,
752
- active: current.value === plot,
753
- defining: plot.defining,
759
+ active: current.value === feature,
760
+ defining: feature.defining,
754
761
  index,
755
762
  event
756
763
  });