sctj-components 1.0.68 → 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_fb2ce5ee_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);
9665
- const playSpeed = ref$1(1.25);
9666
+ const SPEED_OPTIONS = [100, 50, 25, 12.5];
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 = () => {
@@ -9761,7 +9779,7 @@ const _sfc_main$3 = {
9761
9779
  isPlaying.value = true;
9762
9780
  const path = formatPath(props.pathPoints);
9763
9781
  moveMarker.value.moveAlong(path, {
9764
- duration: props.pathPoints.length * playSpeed.value,
9782
+ duration: playSpeed.value,
9765
9783
  autoRotation: true
9766
9784
  });
9767
9785
  };
@@ -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) {
@@ -9883,19 +9903,19 @@ const _sfc_main$3 = {
9883
9903
  }, {
9884
9904
  default: withCtx(() => [
9885
9905
  createVNode(_component_el_option, {
9886
- value: 10,
9906
+ value: 100,
9887
9907
  label: "1x"
9888
9908
  }),
9889
9909
  createVNode(_component_el_option, {
9890
- value: 5,
9910
+ value: 50,
9891
9911
  label: "2x"
9892
9912
  }),
9893
9913
  createVNode(_component_el_option, {
9894
- value: 2.5,
9914
+ value: 25,
9895
9915
  label: "4x"
9896
- }, null, 8, ["value"]),
9916
+ }),
9897
9917
  createVNode(_component_el_option, {
9898
- value: 1.25,
9918
+ value: 12.5,
9899
9919
  label: "8x"
9900
9920
  }, null, 8, ["value"])
9901
9921
  ]),
@@ -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-fb2ce5ee"]]);
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 = {