sctj-components 1.0.69 → 1.0.70

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.
@@ -9610,7 +9610,7 @@ const _sfc_main$4 = {
9610
9610
  }
9611
9611
  };
9612
9612
  const SCTJBusinessMapDrawingDialog = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-d0bea808"]]);
9613
- const index_vue_vue_type_style_index_0_scoped_27971162_lang = "";
9613
+ const index_vue_vue_type_style_index_0_scoped_b0e83157_lang = "";
9614
9614
  const _hoisted_1$2 = { class: "controls" };
9615
9615
  const _sfc_main$3 = {
9616
9616
  __name: "index",
@@ -9653,7 +9653,8 @@ const _sfc_main$3 = {
9653
9653
  required: true
9654
9654
  }
9655
9655
  },
9656
- setup(__props) {
9656
+ emits: ["moving"],
9657
+ setup(__props, { emit }) {
9657
9658
  const props = __props;
9658
9659
  const mapContainerRef = ref$1(null);
9659
9660
  const map = shallowRef(null);
@@ -9662,7 +9663,23 @@ const _sfc_main$3 = {
9662
9663
  const startMarker = ref$1(null);
9663
9664
  const endMarker = ref$1(null);
9664
9665
  const isPlaying = ref$1(false);
9666
+ const SPEED_OPTIONS = [100, 50, 25, 12.5];
9665
9667
  const playSpeed = ref$1(12.5);
9668
+ function getDefaultPlaySpeed(pointCount) {
9669
+ if (!pointCount || pointCount <= 0)
9670
+ return SPEED_OPTIONS[SPEED_OPTIONS.length - 1];
9671
+ const LOW_THRESHOLD = 100;
9672
+ const HIGH_THRESHOLD = 1500;
9673
+ if (pointCount <= LOW_THRESHOLD)
9674
+ return 100;
9675
+ if (pointCount >= HIGH_THRESHOLD)
9676
+ return 12.5;
9677
+ const t = (pointCount - LOW_THRESHOLD) / (HIGH_THRESHOLD - LOW_THRESHOLD);
9678
+ const raw = 100 - t * (100 - 12.5);
9679
+ return SPEED_OPTIONS.reduce(
9680
+ (prev, curr) => Math.abs(curr - raw) < Math.abs(prev - raw) ? curr : prev
9681
+ );
9682
+ }
9666
9683
  const passedPolyline = ref$1(null);
9667
9684
  const isPlayed = ref$1(false);
9668
9685
  let AMapInstance = null;
@@ -9753,6 +9770,7 @@ const _sfc_main$3 = {
9753
9770
  map.value.add([polyline.value, startMarker.value, endMarker.value, moveMarker.value, passedPolyline.value]);
9754
9771
  map.value.setFitView();
9755
9772
  moveMarker.value.on("moving", (e) => {
9773
+ emit("moving", e);
9756
9774
  });
9757
9775
  };
9758
9776
  const startPlay = () => {
@@ -9805,17 +9823,19 @@ const _sfc_main$3 = {
9805
9823
  if (!map.value)
9806
9824
  return;
9807
9825
  if (newVal && newVal.length > 0) {
9808
- drawTrack();
9809
- if (props.autoPlay) {
9810
- startPlay();
9811
- }
9826
+ playSpeed.value = getDefaultPlaySpeed(newVal.length);
9812
9827
  }
9813
- },
9814
- { immediate: true }
9828
+ drawTrack();
9829
+ props.autoPlay && startPlay();
9830
+ }
9815
9831
  );
9816
9832
  onMounted$1(async () => {
9817
9833
  await initMap();
9834
+ if (props.pathPoints && props.pathPoints.length > 0) {
9835
+ playSpeed.value = getDefaultPlaySpeed(props.pathPoints.length);
9836
+ }
9818
9837
  drawTrack();
9838
+ props.autoPlay && startPlay();
9819
9839
  });
9820
9840
  onBeforeUnmount(() => {
9821
9841
  if (moveMarker.value) {
@@ -9906,7 +9926,7 @@ const _sfc_main$3 = {
9906
9926
  };
9907
9927
  }
9908
9928
  };
9909
- const SCTJTrackPlayback = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-27971162"]]);
9929
+ const SCTJTrackPlayback = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-b0e83157"]]);
9910
9930
  const BimViewer_vue_vue_type_style_index_0_scoped_89f55b38_lang = "";
9911
9931
  const _withScopeId$1 = (n) => (pushScopeId("data-v-89f55b38"), n = n(), popScopeId(), n);
9912
9932
  const _hoisted_1$1 = {