kd-lane-chart-v3 0.1.16 → 0.1.17

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/esm/index.js CHANGED
@@ -6715,11 +6715,18 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
6715
6715
  let height = contentBoxSize ? contentBoxSize.blockSize : contentRect ? contentRect.height : rect.height;
6716
6716
  let windowWidth = window.innerWidth;
6717
6717
  let windowHeight = window.innerHeight;
6718
- console.log(windowWidth, windowHeight);
6719
- proxy.positionInfo.top = (windowHeight - height) / 2;
6720
- proxy.positionInfo.left = (windowWidth - width) / 2;
6721
- proxy.positionInfo.width = width;
6722
- proxy.positionInfo.height = height;
6718
+ const top = (windowHeight - height) / 2;
6719
+ const left = (windowWidth - width) / 2;
6720
+ const prev = proxy.positionInfo || {};
6721
+ if (prev.top === top && prev.left === left && prev.width === width && prev.height === height) {
6722
+ return;
6723
+ }
6724
+ proxy.positionInfo = {
6725
+ top,
6726
+ left,
6727
+ width,
6728
+ height
6729
+ };
6723
6730
  }
6724
6731
  });
6725
6732
  proxy.resizeObserverContainer.observe(container);
@@ -6733,6 +6740,7 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
6733
6740
  const container = proxy.$refs.targetDom;
6734
6741
  if (container) {
6735
6742
  proxy.resizeObserver = new ResizeObserver(() => {
6743
+ if (proxy._suppressLaneWidthSync) return;
6736
6744
  proxy.handleResize();
6737
6745
  });
6738
6746
  proxy.resizeObserver.observe(container);
@@ -6752,56 +6760,81 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
6752
6760
  return actualHeight;
6753
6761
  }
6754
6762
  function handleResize() {
6755
- if (proxy._isUnmounted || proxy.isLineDragging || proxy.isLaneDragging || proxy.isResizing) {
6763
+ if (proxy._isUnmounted || proxy._suppressLaneWidthSync || proxy.isLineDragging || proxy.isLaneDragging || proxy.isResizing) {
6756
6764
  return;
6757
6765
  }
6758
6766
  if (proxy.resizeTimer) {
6759
6767
  clearTimeout(proxy.resizeTimer);
6760
6768
  }
6761
6769
  proxy.resizeTimer = setTimeout(() => {
6762
- if (proxy._isUnmounted || !proxy.$el) return;
6770
+ if (proxy._isUnmounted || !proxy.$el || proxy._suppressLaneWidthSync) {
6771
+ return;
6772
+ }
6763
6773
  proxy.updateDomHeight();
6764
6774
  proxy.updateLaneWidthOverrides();
6765
6775
  }, 120);
6766
6776
  }
6767
6777
  function updateDomHeight() {
6768
6778
  const container = proxy.$refs.targetDom;
6769
- if (container) {
6770
- proxy.domHeight = container.clientHeight;
6771
- proxy.updateScrollbarHeight();
6779
+ if (!container) return;
6780
+ const next = container.clientHeight;
6781
+ if (proxy.domHeight !== next) {
6782
+ proxy.domHeight = next;
6772
6783
  }
6784
+ proxy.updateScrollbarHeight();
6773
6785
  }
6774
6786
  function updateScrollbarHeight() {
6775
6787
  var _a;
6776
6788
  const scrollContent = (_a = proxy.$el) == null ? void 0 : _a.querySelector(".kd-lane-chart-scroll-content");
6789
+ let next = 0;
6777
6790
  if (scrollContent) {
6778
6791
  const scrollbarHeight2 = scrollContent.offsetHeight - scrollContent.clientHeight;
6779
- proxy.scrollbarHeight = scrollbarHeight2 > 0 ? scrollbarHeight2 : 0;
6780
- } else {
6781
- proxy.scrollbarHeight = 0;
6792
+ next = scrollbarHeight2 > 0 ? scrollbarHeight2 : 0;
6793
+ }
6794
+ if (proxy.scrollbarHeight !== next) {
6795
+ proxy.scrollbarHeight = next;
6796
+ }
6797
+ }
6798
+ function beginLaneWidthSyncGuard() {
6799
+ proxy._suppressLaneWidthSync = true;
6800
+ if (proxy._laneWidthSyncGuardTimer) {
6801
+ clearTimeout(proxy._laneWidthSyncGuardTimer);
6782
6802
  }
6803
+ proxy._laneWidthSyncGuardTimer = setTimeout(() => {
6804
+ proxy._laneWidthSyncGuardTimer = 0;
6805
+ proxy._suppressLaneWidthSync = false;
6806
+ }, 200);
6783
6807
  }
6784
6808
  function updateLaneWidthOverrides() {
6785
- if (proxy.isLineDragging || proxy.isLaneDragging || proxy.isResizing) return;
6809
+ if (proxy._suppressLaneWidthSync || proxy.isLineDragging || proxy.isLaneDragging || proxy.isResizing) {
6810
+ return;
6811
+ }
6786
6812
  const { lanes = [] } = proxy.currentTemplate || {};
6813
+ if (!lanes.length) return;
6814
+ const nextOverrides = { ...proxy.laneWidthOverrides || {} };
6787
6815
  let hasChanged = false;
6788
6816
  lanes.forEach((lane) => {
6789
6817
  const headerEl = document.getElementById(`lane-header-${lane.laneId}`);
6790
- if (headerEl) {
6791
- const id = String(lane.laneId);
6792
- const flexWidth = headerEl.clientWidth;
6793
- const minWidth = lane.minWidth || 40;
6794
- const newWidth = Math.max(minWidth, flexWidth);
6795
- const oldWidth = proxy.laneWidthOverrides[id];
6796
- if (oldWidth == null || Math.abs(oldWidth - newWidth) >= 1) {
6797
- proxy.setLaneWidthOverride(lane.laneId, newWidth);
6798
- hasChanged = true;
6799
- }
6818
+ if (!headerEl) return;
6819
+ const id = String(lane.laneId);
6820
+ const minWidth = lane.minWidth || 40;
6821
+ const newWidth = Math.max(minWidth, Math.round(headerEl.clientWidth));
6822
+ const oldWidth = nextOverrides[id];
6823
+ const threshold = oldWidth == null ? 1 : 2;
6824
+ if (oldWidth == null || Math.abs(oldWidth - newWidth) >= threshold) {
6825
+ nextOverrides[id] = newWidth;
6826
+ hasChanged = true;
6800
6827
  }
6801
6828
  });
6802
- if (hasChanged) {
6803
- emit("lane-width-change", proxy.laneWidthOverrides);
6804
- }
6829
+ if (!hasChanged) return;
6830
+ const prev = proxy._lastEmittedLaneWidthMap || {};
6831
+ const nextKeys = Object.keys(nextOverrides);
6832
+ const sameAsEmitted = nextKeys.length === Object.keys(prev).length && nextKeys.every((k) => prev[k] === nextOverrides[k]);
6833
+ if (sameAsEmitted) return;
6834
+ beginLaneWidthSyncGuard();
6835
+ proxy.laneWidthOverrides = nextOverrides;
6836
+ proxy._lastEmittedLaneWidthMap = { ...nextOverrides };
6837
+ emit("lane-width-change", { ...nextOverrides });
6805
6838
  }
6806
6839
  function startResize(event, lane, direction) {
6807
6840
  event.preventDefault();
@@ -6836,7 +6869,10 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
6836
6869
  proxy.startX = 0;
6837
6870
  proxy.startWidth = 0;
6838
6871
  proxy.updateScrollbarHeight();
6839
- emit("lane-width-change", proxy.laneWidthOverrides);
6872
+ beginLaneWidthSyncGuard();
6873
+ const map = { ...proxy.laneWidthOverrides || {} };
6874
+ proxy._lastEmittedLaneWidthMap = map;
6875
+ emit("lane-width-change", map);
6840
6876
  }
6841
6877
  function getLaneElement(laneId) {
6842
6878
  if (!proxy.$refs.refLaneDiv) return null;
@@ -6866,7 +6902,7 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
6866
6902
  }
6867
6903
  function notifyTemplateChangeImmediately() {
6868
6904
  proxy.syncTreeTemplateFromCurrent();
6869
- emit("template-change", cloneDeep(proxy.currentTemplate));
6905
+ emit("template-change", proxy.currentTemplate);
6870
6906
  }
6871
6907
  function syncLinesLaneIdsFromCurrent() {
6872
6908
  (proxy.currentTemplate.lanes || []).forEach((lane) => {
@@ -6900,13 +6936,18 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
6900
6936
  proxy.notifyTemplateChangeImmediately();
6901
6937
  proxy.emitConfigChange("drag");
6902
6938
  const lines = proxy.collectAllLinesFromCurrent();
6939
+ const clearDragging = () => {
6940
+ nextTick(() => {
6941
+ proxy.isLineDragging = false;
6942
+ });
6943
+ };
6903
6944
  if (lines.length === 0) {
6904
- proxy.isLineDragging = false;
6945
+ clearDragging();
6905
6946
  return;
6906
6947
  }
6907
- Promise.all(lines.map((line) => proxy.dragUpdateLine(line))).finally(() => {
6908
- proxy.isLineDragging = false;
6909
- });
6948
+ Promise.all(lines.map((line) => proxy.dragUpdateLine(line))).finally(
6949
+ clearDragging
6950
+ );
6910
6951
  }
6911
6952
  function onLaneDragEnd() {
6912
6953
  const lanes = proxy.currentTemplate.lanes || [];
@@ -6916,14 +6957,19 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
6916
6957
  lane.sort = index2;
6917
6958
  });
6918
6959
  sortLanes(lanes);
6960
+ const clearDragging = () => {
6961
+ nextTick(() => {
6962
+ proxy.isLaneDragging = false;
6963
+ });
6964
+ };
6919
6965
  if (hasChanged) {
6920
6966
  proxy.notifyTemplateChangeImmediately();
6921
6967
  proxy.emitConfigChange("drag");
6922
- Promise.all(lanes.map((lane) => proxy.dragUpdateLane(lane))).finally(() => {
6923
- proxy.isLaneDragging = false;
6924
- });
6968
+ Promise.all(lanes.map((lane) => proxy.dragUpdateLane(lane))).finally(
6969
+ clearDragging
6970
+ );
6925
6971
  } else {
6926
- proxy.isLaneDragging = false;
6972
+ clearDragging();
6927
6973
  }
6928
6974
  proxy._laneOrderBeforeDrag = null;
6929
6975
  }
@@ -7048,7 +7094,8 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
7048
7094
  function setLaneWidthOverride(laneId, px) {
7049
7095
  const id = String(laneId);
7050
7096
  const minPx = 40;
7051
- const w = Math.max(minPx, px);
7097
+ const w = Math.max(minPx, Math.round(Number(px) || 0));
7098
+ if (proxy.laneWidthOverrides[id] === w) return;
7052
7099
  proxy.laneWidthOverrides[id] = w;
7053
7100
  }
7054
7101
  function laneContainerStyle(lane, type) {
@@ -7586,6 +7633,7 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
7586
7633
  }
7587
7634
  if (prevTemplateId != null && proxy.currentTemplate && proxy.currentTemplate.templateId !== prevTemplateId || type === "changeNumber") {
7588
7635
  proxy.laneWidthOverrides = {};
7636
+ proxy._lastEmittedLaneWidthMap = {};
7589
7637
  }
7590
7638
  sortLanes(proxy.currentTemplate.lanes);
7591
7639
  emit("template-change", proxy.currentTemplate);
@@ -7645,7 +7693,7 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
7645
7693
  function isSameIdSequence(a, b, idKey) {
7646
7694
  if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
7647
7695
  return a.every(
7648
- (item, i) => item === b[i] || item && b[i] && item[idKey] === b[i][idKey]
7696
+ (item, i) => item === b[i] || item && b[i] && item[idKey] == b[i][idKey]
7649
7697
  );
7650
7698
  }
7651
7699
  function reuseLaneListIfSame(prev, next) {
@@ -7656,32 +7704,59 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
7656
7704
  }
7657
7705
  let fixedLanesCache = [];
7658
7706
  let scrollableLanesCache = [];
7707
+ const laneLinesModelCache = /* @__PURE__ */ new WeakMap();
7708
+ let scrollableLanesModelCache = [];
7659
7709
  const fixedLanes = computed(() => {
7660
7710
  const { lanes = [] } = proxy.currentTemplate || {};
7661
7711
  const next = lanes.filter((lane) => lane.canScroll === false);
7662
- fixedLanesCache = reuseLaneListIfSame(fixedLanesCache, next);
7663
- return fixedLanesCache;
7712
+ return reuseLaneListIfSame(fixedLanesCache, next);
7664
7713
  });
7665
7714
  const scrollableLanes = computed(() => {
7666
7715
  const { lanes = [] } = proxy.currentTemplate || {};
7667
7716
  const next = lanes.filter((lane) => lane.canScroll !== false);
7668
- scrollableLanesCache = reuseLaneListIfSame(scrollableLanesCache, next);
7669
- return scrollableLanesCache;
7717
+ return reuseLaneListIfSame(scrollableLanesCache, next);
7718
+ });
7719
+ watch(fixedLanes, (val) => {
7720
+ fixedLanesCache = Array.isArray(val) ? val : [];
7721
+ });
7722
+ watch(scrollableLanes, (val) => {
7723
+ scrollableLanesCache = Array.isArray(val) ? val : [];
7670
7724
  });
7725
+ function getLaneLinesModel(lane) {
7726
+ if (!lane) return [];
7727
+ const lines = lane.lines || [];
7728
+ const prev = laneLinesModelCache.get(lane);
7729
+ if (prev && prev.length === lines.length && prev.every((line, i) => line === lines[i])) {
7730
+ return prev;
7731
+ }
7732
+ const copy = lines.slice();
7733
+ laneLinesModelCache.set(lane, copy);
7734
+ return copy;
7735
+ }
7736
+ function getScrollableLanesModel() {
7737
+ const lanes = scrollableLanes.value || [];
7738
+ if (scrollableLanesModelCache.length === lanes.length && scrollableLanesModelCache.every((lane, i) => lane === lanes[i])) {
7739
+ return scrollableLanesModelCache;
7740
+ }
7741
+ scrollableLanesModelCache = lanes.slice();
7742
+ return scrollableLanesModelCache;
7743
+ }
7671
7744
  function onScrollableLanesUpdate(newVal) {
7672
- if (!proxy.currentTemplate) return;
7745
+ if (!proxy.isLaneDragging || !proxy.currentTemplate) return;
7673
7746
  const lanes = proxy.currentTemplate.lanes || [];
7674
7747
  const fixed = lanes.filter((lane) => lane.canScroll === false);
7675
7748
  const scrollable = Array.isArray(newVal) ? newVal : [];
7676
7749
  const next = fixed.length ? fixed.concat(scrollable) : scrollable;
7677
7750
  if (isSameIdSequence(next, lanes, "laneId")) return;
7678
7751
  proxy.currentTemplate.lanes = next;
7752
+ scrollableLanesModelCache = scrollable.slice();
7679
7753
  }
7680
7754
  function onLaneLinesUpdate(lane, list) {
7681
- if (!lane) return;
7755
+ if (!lane || !proxy.isLineDragging) return;
7682
7756
  const next = Array.isArray(list) ? list : [];
7683
7757
  if (isSameIdSequence(next, lane.lines || [], "lineId")) return;
7684
7758
  lane.lines = next;
7759
+ laneLinesModelCache.set(lane, next.slice());
7685
7760
  }
7686
7761
  const lineCount = computed(() => {
7687
7762
  const { lanes = [] } = proxy.currentTemplate || {};
@@ -7947,6 +8022,7 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
7947
8022
  updateDomHeight,
7948
8023
  updateScrollbarHeight,
7949
8024
  updateLaneWidthOverrides,
8025
+ beginLaneWidthSyncGuard,
7950
8026
  startResize,
7951
8027
  resize,
7952
8028
  stopResize,
@@ -7962,6 +8038,8 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
7962
8038
  onLaneDragEnd,
7963
8039
  onScrollableLanesUpdate,
7964
8040
  onLaneLinesUpdate,
8041
+ getLaneLinesModel,
8042
+ getScrollableLanesModel,
7965
8043
  dragUpdateLine,
7966
8044
  dragUpdateLane,
7967
8045
  getGridSize,
@@ -8022,6 +8100,11 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
8022
8100
  clearTimeout(proxy.resizeTimer);
8023
8101
  proxy.resizeTimer = null;
8024
8102
  }
8103
+ if (proxy._laneWidthSyncGuardTimer) {
8104
+ clearTimeout(proxy._laneWidthSyncGuardTimer);
8105
+ proxy._laneWidthSyncGuardTimer = 0;
8106
+ }
8107
+ proxy._suppressLaneWidthSync = false;
8025
8108
  if (proxy._curveConfigCloseTimer) {
8026
8109
  clearTimeout(proxy._curveConfigCloseTimer);
8027
8110
  proxy._curveConfigCloseTimer = 0;
@@ -8060,6 +8143,8 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
8060
8143
  onLaneDragEnd,
8061
8144
  onScrollableLanesUpdate,
8062
8145
  onLaneLinesUpdate,
8146
+ getLaneLinesModel,
8147
+ getScrollableLanesModel,
8063
8148
  dragUpdateLine,
8064
8149
  dragUpdateLane,
8065
8150
  getGridSize,
@@ -8191,7 +8276,7 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
8191
8276
  onContextmenu: withModifiers(($event) => showContextMenu($event, lane), ["prevent"])
8192
8277
  }, [
8193
8278
  createVNode(unref(VueDraggable), {
8194
- "model-value": lane.lines,
8279
+ "model-value": getLaneLinesModel(lane),
8195
8280
  "onUpdate:modelValue": (list) => onLaneLinesUpdate(lane, list),
8196
8281
  animation: 200,
8197
8282
  fallbackOnBody: true,
@@ -8249,7 +8334,7 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
8249
8334
  class: "kd-lane-chart-scroll-content",
8250
8335
  onStart: onLaneDragStart,
8251
8336
  onEnd: onLaneDragEnd,
8252
- "model-value": scrollableLanes.value,
8337
+ "model-value": getScrollableLanesModel(),
8253
8338
  "onUpdate:modelValue": onScrollableLanesUpdate,
8254
8339
  animation: 200,
8255
8340
  fallbackOnBody: true,
@@ -8309,7 +8394,7 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
8309
8394
  onContextmenu: withModifiers(($event) => showContextMenu($event, lane), ["prevent"])
8310
8395
  }, [
8311
8396
  createVNode(unref(VueDraggable), {
8312
- "model-value": lane.lines,
8397
+ "model-value": getLaneLinesModel(lane),
8313
8398
  "onUpdate:modelValue": (list) => onLaneLinesUpdate(lane, list),
8314
8399
  animation: 200,
8315
8400
  fallbackOnBody: true,
@@ -8451,7 +8536,7 @@ const _sfc_main$6 = /* @__PURE__ */ Object.assign({
8451
8536
  };
8452
8537
  }
8453
8538
  });
8454
- const KdLaneContainerComponent = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-c55a3e28"]]);
8539
+ const KdLaneContainerComponent = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-1d7c6388"]]);
8455
8540
  const _hoisted_1$5 = { class: "header" };
8456
8541
  const _hoisted_2$4 = { class: "label-card" };
8457
8542
  const _hoisted_3$3 = { class: "label-row" };
@@ -11185,7 +11270,7 @@ const _sfc_main$4 = /* @__PURE__ */ Object.assign({ name: "ControlPanelDark" },
11185
11270
  };
11186
11271
  }
11187
11272
  });
11188
- const FunctionControlPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-db0bbf0b"]]);
11273
+ const FunctionControlPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-b21535ee"]]);
11189
11274
  const _hoisted_1$3 = { class: "echarts" };
11190
11275
  const _sfc_main$3 = /* @__PURE__ */ Object.assign({
11191
11276
  name: "resizeEcharts"
@@ -12178,10 +12263,15 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
12178
12263
  async function laneWidthChange(widthMap) {
12179
12264
  const next = widthMap || {};
12180
12265
  if (isSameLaneWidthMap(proxy.laneWidthMap, next)) return;
12181
- proxy.laneWidthMap = next;
12266
+ proxy.laneWidthMap = { ...next };
12182
12267
  await nextTick();
12183
12268
  if (proxy._isUnmounted) return;
12184
- proxy.resizeAllLaneCharts();
12269
+ if (proxy._laneWidthResizeTimer) clearTimeout(proxy._laneWidthResizeTimer);
12270
+ proxy._laneWidthResizeTimer = setTimeout(() => {
12271
+ proxy._laneWidthResizeTimer = 0;
12272
+ if (proxy._isUnmounted) return;
12273
+ proxy.resizeAllLaneCharts();
12274
+ }, 0);
12185
12275
  }
12186
12276
  function isSameLaneWidthMap(a, b) {
12187
12277
  const left = a || {};
@@ -12414,6 +12504,34 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
12414
12504
  }
12415
12505
  function handleLaneChartSizeChange(laneId) {
12416
12506
  if (proxy.trendLineManager) proxy.trendLineManager.onChartResized(laneId);
12507
+ if (proxy._lockDepthScale && proxy.formCache.axisType === "depth" && !proxy._syncingDepthScaleWindow && !proxy.isUpdatingChart && !proxy.isChartBusy()) {
12508
+ const cm = proxy.pxToCm();
12509
+ const target = proxy.getTargetDepthSpanMeters();
12510
+ const drawn = proxy.getWindowDepthSpanMeters(
12511
+ proxy.startIndex,
12512
+ proxy.windowSize
12513
+ );
12514
+ const spanOff = target > 0 && Math.abs(drawn - target) > Math.max(1, target * 0.04);
12515
+ const syncKey = `${Math.round(cm * 10)}:${proxy.formCache.scale}`;
12516
+ const cmOff = !(proxy._scaleCm > 0) || Math.abs(cm - proxy._scaleCm) >= 0.2;
12517
+ const needSpan = spanOff && proxy._spanSyncKey !== syncKey;
12518
+ if (cmOff || needSpan) {
12519
+ proxy._scaleCm = cm;
12520
+ proxy._spanSyncKey = syncKey;
12521
+ const scaled = proxy.computeDepthScaleWindow(proxy.startIndex);
12522
+ if (scaled.windowSize !== proxy.windowSize || scaled.start !== proxy.startIndex) {
12523
+ proxy._syncingDepthScaleWindow = true;
12524
+ proxy.startIndex = scaled.start;
12525
+ proxy.windowSize = scaled.windowSize;
12526
+ proxy.targetStartIndex = scaled.start;
12527
+ proxy.targetWindowSize = scaled.windowSize;
12528
+ proxy._syncingDepthScaleWindow = false;
12529
+ if (typeof proxy.scheduleChartRedraw === "function") {
12530
+ proxy.scheduleChartRedraw();
12531
+ }
12532
+ }
12533
+ }
12534
+ }
12417
12535
  proxy.scheduleDepthAxisLabelSync(laneId);
12418
12536
  }
12419
12537
  function setInsideDataZoomPanEnabled(enabled) {
@@ -13045,8 +13163,10 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13045
13163
  check(lo);
13046
13164
  check(lo - 1);
13047
13165
  if (best < 0) {
13048
- for (let i = lo - 2; i >= 0 && lo - i < 16; i--) check(i);
13049
- for (let i = lo + 1; i < n && i - lo < 16; i++) check(i);
13166
+ for (let i = 0; i < n; i++) {
13167
+ if (i === lo || i === lo - 1) continue;
13168
+ check(i);
13169
+ }
13050
13170
  }
13051
13171
  return best;
13052
13172
  }
@@ -13140,6 +13260,45 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13140
13260
  }
13141
13261
  return null;
13142
13262
  }
13263
+ function getLaneTooltipPosition(point, _params, _dom, _rect, size) {
13264
+ const content = size && size.contentSize || [120, 80];
13265
+ const view = size && size.viewSize || [200, 400];
13266
+ const tipW = content[0] || 120;
13267
+ const tipH = content[1] || 80;
13268
+ const viewW = view[0] || 200;
13269
+ const viewH = view[1] || 400;
13270
+ const cy = Array.isArray(point) && Number.isFinite(point[1]) ? point[1] : 0;
13271
+ let x = 4;
13272
+ let y = cy + 12;
13273
+ if (y + tipH > viewH - 4) y = Math.max(4, cy - tipH - 12);
13274
+ if (x + tipW > viewW - 4) x = Math.max(4, viewW - tipW - 4);
13275
+ return [x, y];
13276
+ }
13277
+ function getLaneTooltipExtraCss() {
13278
+ return "pointer-events: none !important; max-width: 92%; box-sizing: border-box; white-space: normal; word-break: break-all;";
13279
+ }
13280
+ function buildHelperTipRailData(helperX, groupMin, groupMax, steps = 48) {
13281
+ const lo = Number(groupMin);
13282
+ const hi = Number(groupMax);
13283
+ const x = Number(helperX);
13284
+ if (!Number.isFinite(x)) return [];
13285
+ if (!Number.isFinite(lo) || !Number.isFinite(hi)) {
13286
+ return [
13287
+ [x, lo],
13288
+ [x, hi]
13289
+ ];
13290
+ }
13291
+ const n = Math.max(2, steps | 0);
13292
+ const out = new Array(n);
13293
+ if (hi === lo) {
13294
+ for (let i = 0; i < n; i++) out[i] = [x, lo];
13295
+ return out;
13296
+ }
13297
+ for (let i = 0; i < n; i++) {
13298
+ out[i] = [x, lo + (hi - lo) * i / (n - 1)];
13299
+ }
13300
+ return out;
13301
+ }
13143
13302
  function onChartAreaMouseMove(event) {
13144
13303
  const charts = proxy.getConnectedCharts();
13145
13304
  for (let i = 0; i < charts.length; i++) {
@@ -13209,46 +13368,60 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13209
13368
  const x = pos && Number.isFinite(pos[0]) ? pos[0] : (meta.width || 80) / 2;
13210
13369
  const y = pos && Number.isFinite(pos[1]) ? pos[1] : fallbackY;
13211
13370
  const axisKey = `${targetGridIndex}:${y | 0}`;
13212
- const pinAxis = () => {
13213
- chart.dispatchAction({
13214
- type: "updateAxisPointer",
13215
- currTrigger: "mousemove",
13216
- x,
13217
- y,
13218
- axesInfo: [
13219
- {
13220
- axisDim: "y",
13221
- axisIndex: targetGridIndex,
13222
- value: yValue
13223
- }
13224
- ]
13225
- });
13226
- };
13227
- if (proxy._lastAxisPx.get(chart) !== axisKey) {
13228
- proxy._lastAxisPx.set(chart, axisKey);
13229
- pinAxis();
13230
- }
13371
+ chart.dispatchAction({
13372
+ type: "updateAxisPointer",
13373
+ currTrigger: "mousemove",
13374
+ x,
13375
+ y,
13376
+ axesInfo: [
13377
+ {
13378
+ axisDim: "y",
13379
+ axisIndex: targetGridIndex,
13380
+ value: yValue
13381
+ }
13382
+ ]
13383
+ });
13384
+ proxy._lastAxisPx.set(chart, axisKey);
13231
13385
  const canShowTip = needTip && proxy.shouldShowTooltipContent(laneId) && lane && lane.lines && lane.lines.length > 0 && proxy.laneHasAnyValidPlotPoint(chart, laneId);
13232
13386
  if (canShowTip) {
13233
13387
  const tipKey = `${axisKey}:${Number(yValue).toFixed(2)}`;
13234
- if (proxy._lastTipKey.get(chart) !== tipKey) {
13235
- const nearest = proxy.findHelperTooltipAnchor(chart, yValue, targetGridIndex) || proxy.findNearestTooltipPoint(chart, yValue, targetGridIndex);
13236
- if (nearest) {
13237
- proxy._lastTipKey.set(chart, tipKey);
13388
+ proxy._lastTipKey.set(chart, tipKey);
13389
+ const helperHit = proxy.findHelperTooltipAnchor(
13390
+ chart,
13391
+ yValue,
13392
+ targetGridIndex
13393
+ );
13394
+ if (helperHit) {
13395
+ chart.dispatchAction({
13396
+ type: "showTip",
13397
+ seriesIndex: helperHit.seriesIndex,
13398
+ dataIndex: helperHit.dataIndex,
13399
+ // 锚在十字线高度、道左侧,配合 position 回调统一落点
13400
+ x: 8,
13401
+ y
13402
+ });
13403
+ } else {
13404
+ const lineHit = proxy.findNearestTooltipPoint(
13405
+ chart,
13406
+ yValue,
13407
+ targetGridIndex
13408
+ );
13409
+ if (lineHit) {
13238
13410
  chart.dispatchAction({
13239
13411
  type: "showTip",
13240
- seriesIndex: nearest.seriesIndex,
13241
- dataIndex: nearest.dataIndex,
13242
- x,
13412
+ seriesIndex: lineHit.seriesIndex,
13413
+ dataIndex: lineHit.dataIndex,
13414
+ x: 8,
13243
13415
  y
13244
13416
  });
13417
+ } else {
13418
+ chart.dispatchAction({ type: "showTip", x: 8, y });
13245
13419
  }
13246
13420
  }
13247
13421
  } else if (proxy._lastTipKey.get(chart) != null) {
13248
13422
  proxy._lastTipKey.delete(chart);
13249
13423
  chart.dispatchAction({ type: "hideTip" });
13250
13424
  }
13251
- pinAxis();
13252
13425
  }
13253
13426
  } finally {
13254
13427
  proxy._showingTips = false;
@@ -13420,15 +13593,16 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13420
13593
  });
13421
13594
  }
13422
13595
  function dispatchVisibleDataChange(val) {
13423
- if (!val || val.length === 0) return;
13596
+ const rows = val && val.length ? val : proxy.getVisibleData();
13597
+ if (!rows || !rows.length) return;
13424
13598
  const axisKey = proxy.currentToolBarConfig.axisTypeList && proxy.currentToolBarConfig.axisTypeList[proxy.formCache.axisType];
13425
- const first = val[0];
13426
- const last = val[val.length - 1];
13599
+ const first = rows[0];
13600
+ const last = rows[rows.length - 1];
13427
13601
  const firstValue = first && first[axisKey];
13428
13602
  const lastValue = last && last[axisKey];
13429
- const startIndex2 = proxy.startIndex;
13430
- const windowSize2 = proxy.windowSize;
13431
- const rawGroups = splitArrayByDepth(val, axisKey);
13603
+ const startIndex2 = Math.max(0, Math.floor(Number(proxy.startIndex) || 0));
13604
+ const windowSize2 = Math.max(1, Math.floor(Number(proxy.windowSize) || 1));
13605
+ const rawGroups = splitArrayByDepth(rows, axisKey);
13432
13606
  const layout = proxy.formCache.axisType === "depth" ? proxy.layoutScaledAxisGroups(rawGroups, axisKey) : null;
13433
13607
  const dataGroups = layout ? layout.groups : rawGroups;
13434
13608
  if (proxy.lastVisibleDataChangeParams && proxy.lastVisibleDataChangeParams.firstValue === firstValue && proxy.lastVisibleDataChangeParams.lastValue === lastValue && proxy.lastVisibleDataChangeParams.startIndex === startIndex2 && proxy.lastVisibleDataChangeParams.windowSize === windowSize2) {
@@ -13446,32 +13620,23 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13446
13620
  });
13447
13621
  }
13448
13622
  function scheduleVisibleDataChange(val) {
13449
- if (proxy._isZooming || proxy._isPanning) {
13450
- proxy._pendingVisibleData = val;
13451
- if (proxy._visibleDataEmitTimer) return;
13452
- proxy._visibleDataEmitTimer = setTimeout(() => {
13453
- proxy._visibleDataEmitTimer = 0;
13454
- const pending = proxy._pendingVisibleData;
13455
- proxy._pendingVisibleData = null;
13456
- if (pending) proxy.dispatchVisibleDataChange(pending);
13457
- }, 80);
13458
- return;
13459
- }
13460
- if (proxy._visibleDataEmitTimer) {
13461
- clearTimeout(proxy._visibleDataEmitTimer);
13623
+ proxy._pendingVisibleData = val;
13624
+ if (proxy._visibleDataEmitTimer) return;
13625
+ const delay = proxy._isZooming || proxy._isPanning || proxy._isWheelAnimating ? 80 : 32;
13626
+ proxy._visibleDataEmitTimer = setTimeout(() => {
13462
13627
  proxy._visibleDataEmitTimer = 0;
13463
- }
13464
- proxy._pendingVisibleData = null;
13465
- proxy.dispatchVisibleDataChange(val);
13628
+ const pending = proxy._pendingVisibleData;
13629
+ proxy._pendingVisibleData = null;
13630
+ if (pending) proxy.dispatchVisibleDataChange(pending);
13631
+ }, delay);
13466
13632
  }
13467
13633
  function flushVisibleDataChange() {
13468
13634
  if (proxy._visibleDataEmitTimer) {
13469
13635
  clearTimeout(proxy._visibleDataEmitTimer);
13470
13636
  proxy._visibleDataEmitTimer = 0;
13471
13637
  }
13472
- const pending = proxy._pendingVisibleData || proxy.visibleData;
13473
13638
  proxy._pendingVisibleData = null;
13474
- proxy.dispatchVisibleDataChange(pending);
13639
+ proxy.dispatchVisibleDataChange(proxy.getVisibleData());
13475
13640
  }
13476
13641
  function hideAllLaneTooltips(event) {
13477
13642
  if (proxy.isLeavingToTooltip(event)) return;
@@ -13599,6 +13764,9 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13599
13764
  });
13600
13765
  }
13601
13766
  async function templateChange(template) {
13767
+ if (template && template === proxy.currentTemplate) {
13768
+ return;
13769
+ }
13602
13770
  proxy.currentTemplate = template;
13603
13771
  proxy.getLatestLineDataByParamCode();
13604
13772
  let migratedLanes = null;
@@ -13735,30 +13903,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13735
13903
  }
13736
13904
  function pxToCm() {
13737
13905
  const PX_PER_CM = 96 / 2.54;
13738
- let px = 0;
13739
- const wrap = proxy.$refs.chartAreaWrap;
13740
- if (wrap && wrap.clientHeight > 40) px = wrap.clientHeight;
13741
- if (!(px > 40)) {
13742
- const charts = typeof proxy.getConnectedCharts === "function" ? proxy.getConnectedCharts() : [];
13743
- for (let i = 0; i < charts.length; i++) {
13744
- const chart = charts[i];
13745
- if (!chart || chart.isDisposed()) continue;
13746
- const h = chart.getHeight && chart.getHeight();
13747
- if (h > 40) {
13748
- px = h;
13749
- break;
13750
- }
13751
- }
13752
- }
13753
- if (!(px > 40)) {
13754
- const container = proxy.$refs.targetDom;
13755
- if (container) {
13756
- const rect = container.getBoundingClientRect();
13757
- const headerHeight = proxy.$refs.chartContainer && proxy.$refs.chartContainer.getLaneHeightPx() || 0;
13758
- px = Math.max(0, rect.height - headerHeight);
13759
- }
13760
- }
13761
- const cm = px / PX_PER_CM;
13906
+ const cm = proxy.getChartPlotHeightPx() / PX_PER_CM;
13762
13907
  return cm > 0 ? cm : 4;
13763
13908
  }
13764
13909
  function parseScaleMetersPerCm(scale) {
@@ -14017,8 +14162,17 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14017
14162
  const meters = Number(metersPerCm);
14018
14163
  if (!(meters > 0)) return 1;
14019
14164
  const list = proxy.getAllowedScaleValues();
14165
+ let best = null;
14166
+ let bestDiff = Infinity;
14020
14167
  for (let i = 0; i < list.length; i++) {
14021
- if (Math.abs(list[i] - meters) < 1e-6) return list[i];
14168
+ const d = Math.abs(list[i] - meters);
14169
+ if (d < bestDiff) {
14170
+ bestDiff = d;
14171
+ best = list[i];
14172
+ }
14173
+ }
14174
+ if (best != null && (bestDiff < 1e-6 || bestDiff <= 0.01 || bestDiff / meters < 5e-3)) {
14175
+ return best;
14022
14176
  }
14023
14177
  return `1:${Math.max(1, Math.round(meters * 100))}`;
14024
14178
  }
@@ -14038,14 +14192,14 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14038
14192
  function syncScaleSelection(nextScale) {
14039
14193
  var _a;
14040
14194
  const cur = (_a = proxy.formCache) == null ? void 0 : _a.scale;
14041
- if (cur === nextScale) return;
14195
+ const next = proxy.formatScaleSelection(proxy.parseScaleMetersPerCm(nextScale));
14196
+ if (cur === next) return;
14042
14197
  const curM = proxy.parseScaleMetersPerCm(cur);
14043
- const nextM = proxy.parseScaleMetersPerCm(nextScale);
14044
- if (Number.isFinite(curM) && Number.isFinite(nextM) && Math.abs(curM - nextM) < 1e-6 && // 自定义串与数字等价时,仍优先写成更规范的 nextScale(列表 value 或 1:N)
14045
- typeof cur === typeof nextScale) {
14198
+ const nextM = proxy.parseScaleMetersPerCm(next);
14199
+ if (Number.isFinite(curM) && Number.isFinite(nextM) && Math.abs(curM - nextM) < 1e-6) {
14046
14200
  return;
14047
14201
  }
14048
- proxy.$emit("updateScale", nextScale);
14202
+ proxy.$emit("updateScale", next);
14049
14203
  }
14050
14204
  function emitScaleFromWindowSize(windowSize2) {
14051
14205
  const cm = proxy.pxToCm();
@@ -14070,18 +14224,22 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14070
14224
  acc.push(Number(raw));
14071
14225
  return acc;
14072
14226
  }, []);
14073
- if (lineInfo && Object.prototype.hasOwnProperty.call(lineInfo, "min")) {
14227
+ const boundSet = (v) => v !== void 0 && v !== null && v !== "" && Number.isFinite(Number(v));
14228
+ if (lineInfo && boundSet(lineInfo.min)) {
14074
14229
  headerMin = Number(lineInfo.min);
14075
14230
  } else if (numericValues.length > 0) {
14076
14231
  headerMin = Math.floor(Math.min(...numericValues));
14077
14232
  }
14078
- if (lineInfo && Object.prototype.hasOwnProperty.call(lineInfo, "max")) {
14233
+ if (lineInfo && boundSet(lineInfo.max)) {
14079
14234
  headerMax = Number(lineInfo.max);
14080
14235
  } else if (numericValues.length > 0) {
14081
14236
  headerMax = Math.ceil(Math.max(...numericValues));
14082
14237
  }
14083
- const min = headerMin;
14084
- const max = headerMax;
14238
+ let min = headerMin;
14239
+ let max = headerMax;
14240
+ if (!Number.isFinite(min)) min = 0;
14241
+ if (!Number.isFinite(max)) max = 1;
14242
+ if (min === max) max = min + 1;
14085
14243
  const lineId = lineInfo && lineInfo.lineId;
14086
14244
  if (lineId == null) return { min, max };
14087
14245
  if (proxy._lineRangeDraft) {
@@ -14158,7 +14316,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14158
14316
  option: cachedOption
14159
14317
  });
14160
14318
  }
14161
- proxy._pointerMetaGen++;
14319
+ proxy.invalidatePointerMeta();
14162
14320
  proxy.flushLaneChartOption(lineId, cachedOption);
14163
14321
  }
14164
14322
  function flushLaneChartOption(lineId, option) {
@@ -14210,12 +14368,39 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14210
14368
  start = scaled.start;
14211
14369
  size = scaled.windowSize;
14212
14370
  if (!proxy.isUpdatingChart && (start !== proxy.startIndex || size !== proxy.windowSize)) {
14213
- proxy._syncingDepthScaleWindow = true;
14214
- proxy.startIndex = start;
14215
- proxy.windowSize = size;
14216
- proxy.targetStartIndex = start;
14217
- proxy.targetWindowSize = size;
14218
- proxy._syncingDepthScaleWindow = false;
14371
+ proxy._pendingDepthWindow = { start, size };
14372
+ if (!proxy._depthWindowSyncRaf) {
14373
+ const flush = () => {
14374
+ proxy._depthWindowSyncRaf = 0;
14375
+ const pending = proxy._pendingDepthWindow;
14376
+ if (!pending || proxy._isUnmounted) {
14377
+ proxy._pendingDepthWindow = null;
14378
+ return;
14379
+ }
14380
+ if (proxy.isUpdatingChart || proxy._syncingDepthScaleWindow) {
14381
+ proxy._depthWindowSyncTries = (proxy._depthWindowSyncTries || 0) + 1;
14382
+ if (proxy._depthWindowSyncTries > 45) {
14383
+ proxy._pendingDepthWindow = null;
14384
+ proxy._depthWindowSyncTries = 0;
14385
+ return;
14386
+ }
14387
+ proxy._depthWindowSyncRaf = requestAnimationFrame(flush);
14388
+ return;
14389
+ }
14390
+ proxy._depthWindowSyncTries = 0;
14391
+ proxy._pendingDepthWindow = null;
14392
+ if (pending.start === proxy.startIndex && pending.size === proxy.windowSize) {
14393
+ return;
14394
+ }
14395
+ proxy._syncingDepthScaleWindow = true;
14396
+ proxy.startIndex = pending.start;
14397
+ proxy.windowSize = pending.size;
14398
+ proxy.targetStartIndex = pending.start;
14399
+ proxy.targetWindowSize = pending.size;
14400
+ proxy._syncingDepthScaleWindow = false;
14401
+ };
14402
+ proxy._depthWindowSyncRaf = requestAnimationFrame(flush);
14403
+ }
14219
14404
  }
14220
14405
  }
14221
14406
  const end = start + size;
@@ -14270,7 +14455,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14270
14455
  function buildDepthTimeAxisLabel() {
14271
14456
  return { show: false };
14272
14457
  }
14273
- function collectAxisTickValues(min, max, interval) {
14458
+ function collectAxisTickValues(min, max, interval, includeEnds = true) {
14274
14459
  const lo = Number(min);
14275
14460
  const hi = Number(max);
14276
14461
  const step = Number(interval);
@@ -14283,8 +14468,10 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14283
14468
  seen.add(key);
14284
14469
  values.push(v);
14285
14470
  };
14286
- add(lo);
14287
- add(hi);
14471
+ if (includeEnds) {
14472
+ add(lo);
14473
+ add(hi);
14474
+ }
14288
14475
  if (step > 0 && hi > lo) {
14289
14476
  let v = Math.ceil((lo + step * 1e-6) / step) * step;
14290
14477
  for (; v < hi - step * 1e-6; v += step) add(v);
@@ -14396,13 +14583,24 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14396
14583
  const height = chart.getHeight();
14397
14584
  const ticks = [];
14398
14585
  const dataGroups = groups.map((g) => g.rows);
14399
- const minGapPx = proxy._isZooming || proxy._isPanning ? 22 : 16;
14586
+ const metersPerCm = proxy.getScaleMetersPerCm();
14587
+ const scalePx = metersPerCm > 0 ? interval / metersPerCm * (96 / 2.54) : 28;
14588
+ const minGapPx = proxy._isZooming || proxy._isPanning ? 22 : Math.min(16, Math.max(8, scalePx * 0.75));
14400
14589
  for (let groupIndex = 0; groupIndex < groups.length; groupIndex++) {
14401
14590
  const group2 = groups[groupIndex];
14402
14591
  if (!proxy.shouldShowDepthAxisLabel(group2.rows, axisKey)) continue;
14403
14592
  const groupMin = group2.min;
14404
14593
  const groupMax = group2.max;
14405
- const values = proxy.collectAxisTickValues(groupMin, groupMax, interval);
14594
+ const values = proxy.collectAxisTickValues(
14595
+ groupMin,
14596
+ groupMax,
14597
+ interval,
14598
+ isTimeLane
14599
+ );
14600
+ if (!isTimeLane && groupIndex > 0 && !values.some((v) => Math.abs(v - groupMin) < 1e-4)) {
14601
+ values.push(groupMin);
14602
+ values.sort((a, b) => a - b);
14603
+ }
14406
14604
  for (let i = 0; i < values.length; i++) {
14407
14605
  const value = values[i];
14408
14606
  const meta = proxy.getDepthTimeTickMeta(
@@ -14415,19 +14613,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14415
14613
  value
14416
14614
  );
14417
14615
  if (!meta || !meta.text) continue;
14418
- let y;
14419
- if (proxy.isGeomechanical) {
14420
- y = proxy.safeConvertToPixel(
14421
- chart,
14422
- { yAxisIndex: groupIndex },
14423
- value
14424
- );
14425
- if (!Number.isFinite(y)) {
14426
- y = proxy.depthTickPixelY(group2, value, height);
14427
- }
14428
- } else {
14429
- y = proxy.depthTickPixelY(group2, value, height);
14430
- }
14616
+ const y = proxy.depthTickPixelY(group2, value, height);
14431
14617
  if (!Number.isFinite(y) || y < -12 || y > height + 12) continue;
14432
14618
  ticks.push({
14433
14619
  y,
@@ -14472,8 +14658,15 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14472
14658
  const h = chart.getHeight && chart.getHeight();
14473
14659
  if (h > 40) return h;
14474
14660
  }
14661
+ const header = proxy.$refs.chartContainer && proxy.$refs.chartContainer.getLaneHeightPx && proxy.$refs.chartContainer.getLaneHeightPx() || 0;
14475
14662
  const wrap = proxy.$refs.chartAreaWrap;
14476
- if (wrap && wrap.clientHeight > 40) return wrap.clientHeight;
14663
+ if (wrap && wrap.clientHeight > 40) {
14664
+ return Math.max(40, wrap.clientHeight - header);
14665
+ }
14666
+ const container = proxy.$refs.targetDom;
14667
+ if (container) {
14668
+ return Math.max(40, container.getBoundingClientRect().height - header);
14669
+ }
14477
14670
  return 400;
14478
14671
  }
14479
14672
  function getTypicalCurveLaneWidthPx() {
@@ -14567,8 +14760,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14567
14760
  }
14568
14761
  function computeDepthTimeAxisInterval(groups, axisKey) {
14569
14762
  if (proxy.formCache.axisType === "time") {
14570
- let min2 = Infinity;
14571
- let max2 = -Infinity;
14763
+ let min = Infinity;
14764
+ let max = -Infinity;
14572
14765
  let minStep = Infinity;
14573
14766
  for (let g = 0; g < groups.length; g++) {
14574
14767
  const group2 = groups[g];
@@ -14576,8 +14769,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14576
14769
  for (let i = 0; i < group2.length; i++) {
14577
14770
  const v = Number(group2[i][axisKey]);
14578
14771
  if (!Number.isFinite(v)) continue;
14579
- if (v < min2) min2 = v;
14580
- if (v > max2) max2 = v;
14772
+ if (v < min) min = v;
14773
+ if (v > max) max = v;
14581
14774
  if (Number.isFinite(prev)) {
14582
14775
  const step = Math.abs(v - prev);
14583
14776
  if (step > 0 && step < minStep) minStep = step;
@@ -14585,7 +14778,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14585
14778
  prev = v;
14586
14779
  }
14587
14780
  }
14588
- const range = max2 - min2;
14781
+ const range = max - min;
14589
14782
  if (!Number.isFinite(range) || range <= 0) return 5;
14590
14783
  if (!Number.isFinite(minStep) || minStep <= 0) return range / 10;
14591
14784
  const intervalCount = Math.max(
@@ -14595,23 +14788,24 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14595
14788
  let unified = Math.ceil(range / Math.min(12, intervalCount));
14596
14789
  return Math.max(minStep, Math.ceil(unified / minStep) * minStep);
14597
14790
  }
14598
- const scaleStep = proxy.ceilDepthTickInterval(proxy.getScaleMetersPerCm());
14599
- let min = Infinity;
14600
- let max = -Infinity;
14601
- for (let g = 0; g < groups.length; g++) {
14602
- const group2 = groups[g];
14603
- for (let i = 0; i < group2.length; i++) {
14604
- const v = Number(group2[i][axisKey]);
14605
- if (!Number.isFinite(v)) continue;
14606
- if (v < min) min = v;
14607
- if (v > max) max = v;
14608
- }
14791
+ const metersPerCm = proxy.getScaleMetersPerCm();
14792
+ const scaleStep = proxy.ceilDepthTickInterval(metersPerCm);
14793
+ const PX_PER_CM = 96 / 2.54;
14794
+ const pxPerStep = metersPerCm > 0 ? scaleStep / metersPerCm * PX_PER_CM : 28;
14795
+ const minGap = 16;
14796
+ const mult = pxPerStep > 0 && pxPerStep < minGap ? Math.ceil(minGap / pxPerStep) : 1;
14797
+ return scaleStep * mult;
14798
+ }
14799
+ function applyDepthYAxisInterval(yAxis, min, max) {
14800
+ if (!yAxis) return;
14801
+ const step = computeDepthTimeAxisInterval([], proxy.getAxisDataKey());
14802
+ const span = Math.abs(Number(max) - Number(min));
14803
+ yAxis.interval = step;
14804
+ yAxis.minInterval = 0;
14805
+ yAxis.alignTicks = false;
14806
+ if (step > 0 && span > 0) {
14807
+ yAxis.splitNumber = Math.max(1, Math.round(span / step));
14609
14808
  }
14610
- const span = max - min;
14611
- if (!(span > 0)) return scaleStep;
14612
- const maxTicks = proxy.getDepthLabelSplitCount(proxy.getChartPlotHeightPx());
14613
- const densityStep = span / Math.max(1, maxTicks);
14614
- return proxy.ceilDepthTickInterval(Math.max(scaleStep, densityStep));
14615
14809
  }
14616
14810
  function getDataZoomMinSpanPercent() {
14617
14811
  if (!proxy.isGeomechanical) return null;
@@ -14815,7 +15009,11 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14815
15009
  if (name === "helper") {
14816
15010
  const data2 = opt.data;
14817
15011
  const x = data2 && data2[0] && data2[0][0];
14818
- return { data: [[x, group2.min], [x, group2.max]] };
15012
+ return {
15013
+ data: proxy.buildHelperTipRailData(x, group2.min, group2.max),
15014
+ large: false,
15015
+ silent: false
15016
+ };
14819
15017
  }
14820
15018
  const type = sm.subType || proxy.unwrapEchartsValue(opt.type);
14821
15019
  if (name === "log-grid" || name === "trend" || type !== "line") return {};
@@ -14850,10 +15048,18 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14850
15048
  } catch (e) {
14851
15049
  }
14852
15050
  });
15051
+ proxy.invalidatePointerMeta();
14853
15052
  proxy.syncDepthAxisLabelsWithGroups(groups);
14854
15053
  if (proxy.trendLineManager && !proxy._isZooming && !proxy._isWheelAnimating) {
14855
15054
  proxy.trendLineManager.scheduleRender();
14856
15055
  }
15056
+ if (proxy.pointerInChartArea && !proxy.isChartBusy() && !proxy._isWheelAnimating && proxy.showTooltip && Number.isFinite(proxy._lastTooltipY)) {
15057
+ proxy.showSyncedLaneTooltips(
15058
+ proxy._lastTooltipY,
15059
+ proxy._lastTooltipOffsetY || 0,
15060
+ proxy._lastTooltipGridIndex || 0
15061
+ );
15062
+ }
14857
15063
  }
14858
15064
  function syncDepthAxisLabelsWithGroups(groups) {
14859
15065
  if (proxy._isZooming || proxy._isPanning || proxy._isWheelAnimating) {
@@ -15032,6 +15238,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
15032
15238
  proxy._wheelIdleTimer = setTimeout(() => {
15033
15239
  proxy._wheelIdleTimer = 0;
15034
15240
  proxy._isWheelAnimating = false;
15241
+ if (!proxy.animationId) proxy.flushVisibleDataChange();
15035
15242
  }, 160);
15036
15243
  const animate = () => {
15037
15244
  proxy.animationId = 0;
@@ -15060,6 +15267,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
15060
15267
  proxy.patchVisibleSeries();
15061
15268
  proxy.scheduleAllDepthAxisLabelSync();
15062
15269
  }
15270
+ proxy.flushVisibleDataChange();
15063
15271
  return;
15064
15272
  }
15065
15273
  if (!proxy.isUpdatingChart) {
@@ -15463,7 +15671,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
15463
15671
  enterable: false,
15464
15672
  transitionDuration: 0,
15465
15673
  hideDelay: 0,
15466
- extraCssText: "pointer-events: none !important;",
15674
+ extraCssText: proxy.getLaneTooltipExtraCss(),
15675
+ position: proxy.getLaneTooltipPosition,
15467
15676
  axisPointer: {
15468
15677
  type: "line",
15469
15678
  axis: "y",
@@ -15690,7 +15899,13 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
15690
15899
  },
15691
15900
  axisPointer: { show: hasValidLineData }
15692
15901
  });
15693
- if (proxy.isGeomechanical && !isDepthLane && !isTimeLane) {
15902
+ if (proxy.formCache.axisType === "depth") {
15903
+ applyDepthYAxisInterval(
15904
+ option.yAxis[gridIndex],
15905
+ groupMin,
15906
+ groupMax
15907
+ );
15908
+ } else if (proxy.isGeomechanical && !isDepthLane && !isTimeLane) {
15694
15909
  option.yAxis[gridIndex].splitNumber = ySplitCount;
15695
15910
  option.yAxis[gridIndex].minInterval = 1;
15696
15911
  option.yAxis[gridIndex].alignTicks = true;
@@ -15758,6 +15973,9 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
15758
15973
  }
15759
15974
  const isLogScale = isLaneLogScale(lane);
15760
15975
  if (lane && lane.lines) {
15976
+ let tipAnchorXAxisIndex = -1;
15977
+ let tipAnchorMin = 0;
15978
+ let tipAnchorMax = 1;
15761
15979
  lane.lines.forEach((lineInfo, index2) => {
15762
15980
  var _a, _b, _c, _d;
15763
15981
  if (!seriesDataCache2[lineInfo.lineId]) {
@@ -15782,6 +16000,11 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
15782
16000
  allValidData
15783
16001
  );
15784
16002
  const xAxisIndex = option.xAxis.length;
16003
+ if (tipAnchorXAxisIndex < 0) {
16004
+ tipAnchorXAxisIndex = xAxisIndex;
16005
+ tipAnchorMin = min;
16006
+ tipAnchorMax = max;
16007
+ }
15785
16008
  const plotRange = isLogScale ? resolveLaneLogPlotRange(lane, proxy.getLineRangeStore()) : null;
15786
16009
  const splitColor = getCssVariable(
15787
16010
  "--kd-lane-container-item-line-color"
@@ -15978,43 +16201,46 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
15978
16201
  }
15979
16202
  }
15980
16203
  });
15981
- }
15982
- if (!isDepthLane && !isTimeLane && lane && lane.lines && lane.lines.length > 0) {
15983
- const rangeMins = lane.lines.map((item) => {
15984
- var _a;
15985
- return (_a = proxy.getLineRangeStore()[item.lineId]) == null ? void 0 : _a.min;
15986
- }).filter(
15987
- (v) => v !== void 0 && v !== null && !Number.isNaN(v)
15988
- );
15989
- let helperX = 0;
15990
- if (rangeMins.length > 0) {
15991
- helperX = isLogScale ? Math.log10(proxy.getLaneLogPlotRange(lane).min) : Math.max(...rangeMins);
15992
- } else if (isLogScale) {
15993
- helperX = Math.log10(proxy.getLaneLogPlotRange(lane).min);
15994
- }
15995
- if (!Number.isFinite(helperX)) helperX = 0;
15996
- option.series.unshift({
15997
- name: "helper",
15998
- type: "line",
15999
- xAxisIndex: option.xAxis.length - 1,
16000
- yAxisIndex: gridIndex,
16001
- data: [
16002
- [helperX, groupMin],
16003
- [helperX, groupMax]
16004
- ],
16005
- lineStyle: { opacity: 0 },
16006
- symbol: "none",
16007
- silent: true,
16008
- tooltip: { show: true }
16009
- });
16010
- if (isLogScale) {
16011
- option.series.unshift(
16012
- proxy.getLogPaperGridSeries(
16013
- lane,
16014
- option.xAxis.length - 1,
16015
- gridIndex
16016
- )
16017
- );
16204
+ if (!isDepthLane && !isTimeLane && lane.lines.length > 0) {
16205
+ let helperX = 0;
16206
+ if (isLogScale) {
16207
+ const plotRange = proxy.getLaneLogPlotRange(lane);
16208
+ const lo = Math.log10(plotRange.min);
16209
+ const hi = Math.log10(plotRange.max);
16210
+ helperX = Number.isFinite(lo) && Number.isFinite(hi) ? (lo + hi) / 2 : 0;
16211
+ } else {
16212
+ helperX = (Number(tipAnchorMin) + Number(tipAnchorMax)) / 2;
16213
+ }
16214
+ if (!Number.isFinite(helperX)) helperX = 0;
16215
+ const helperAxisIndex = tipAnchorXAxisIndex >= 0 ? tipAnchorXAxisIndex : Math.max(0, option.xAxis.length - 1);
16216
+ option.series.unshift({
16217
+ name: "helper",
16218
+ type: "line",
16219
+ xAxisIndex: helperAxisIndex,
16220
+ yAxisIndex: gridIndex,
16221
+ data: proxy.buildHelperTipRailData(
16222
+ helperX,
16223
+ groupMin,
16224
+ groupMax
16225
+ ),
16226
+ lineStyle: { opacity: 0, width: 0 },
16227
+ symbol: "none",
16228
+ // silent/large 都会让 showTip(seriesIndex) 失效
16229
+ silent: false,
16230
+ large: false,
16231
+ tooltip: { show: true },
16232
+ z: 0,
16233
+ animation: false
16234
+ });
16235
+ if (isLogScale) {
16236
+ option.series.unshift(
16237
+ proxy.getLogPaperGridSeries(
16238
+ lane,
16239
+ helperAxisIndex,
16240
+ gridIndex
16241
+ )
16242
+ );
16243
+ }
16018
16244
  }
16019
16245
  }
16020
16246
  }
@@ -16024,7 +16250,9 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16024
16250
  option.tooltip.showContent = proxy.shouldShowTooltipContent(laneId);
16025
16251
  option.tooltip.triggerOn = "none";
16026
16252
  option.tooltip.enterable = false;
16027
- option.tooltip.extraCssText = "pointer-events: none !important;";
16253
+ option.tooltip.confine = true;
16254
+ option.tooltip.position = proxy.getLaneTooltipPosition;
16255
+ option.tooltip.extraCssText = proxy.getLaneTooltipExtraCss();
16028
16256
  option.tooltip.formatter = () => proxy.renderLaneTooltipHtml(laneId);
16029
16257
  }
16030
16258
  if (proxy.trendLineManager) proxy.trendLineManager.appendSeriesToOption(option, lane);
@@ -16048,6 +16276,13 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16048
16276
  proxy.trendLineManager.scheduleRender();
16049
16277
  }
16050
16278
  }
16279
+ if (proxy.pointerInChartArea && !proxy.isChartBusy() && !proxy._isWheelAnimating && proxy.showTooltip && Number.isFinite(proxy._lastTooltipY)) {
16280
+ proxy.showSyncedLaneTooltips(
16281
+ proxy._lastTooltipY,
16282
+ proxy._lastTooltipOffsetY || 0,
16283
+ proxy._lastTooltipGridIndex || 0
16284
+ );
16285
+ }
16051
16286
  const lanesToRefresh = /* @__PURE__ */ new Set();
16052
16287
  if (laneFilter) {
16053
16288
  laneFilter.forEach((id) => lanesToRefresh.add(id));
@@ -16166,6 +16401,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16166
16401
  const items = [];
16167
16402
  for (let i = 0; i < lines.length; i++) {
16168
16403
  const lineInfo = lines[i];
16404
+ if (!lineInfo || lineInfo.isUsed !== "1") continue;
16169
16405
  const raw = proxy.readLineValueFromRow(row, lineInfo.paramId);
16170
16406
  items.push({
16171
16407
  seriesName: proxy.getTooltipLineName(lineInfo, false),
@@ -16174,7 +16410,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16174
16410
  paramId: lineInfo.paramId,
16175
16411
  lineId: lineInfo.lineId
16176
16412
  });
16177
- if (lineInfo.recommendParamId) {
16413
+ if (lineInfo.recommendParamId && (lineInfo.recommendIsUsed === "1" || lineInfo.recommendIsUsed == 1)) {
16178
16414
  const recRaw = proxy.readLineValueFromRow(
16179
16415
  row,
16180
16416
  lineInfo.recommendParamId
@@ -17742,7 +17978,9 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
17742
17978
  ySplitCount
17743
17979
  )
17744
17980
  };
17745
- if (proxy.isGeomechanical && !isDepthLane) {
17981
+ if (proxy.formCache.axisType === "depth") {
17982
+ applyDepthYAxisInterval(yAxisItem, groupMin, groupMax);
17983
+ } else if (proxy.isGeomechanical && !isDepthLane) {
17746
17984
  yAxisItem.splitNumber = ySplitCount;
17747
17985
  yAxisItem.minInterval = 1;
17748
17986
  yAxisItem.alignTicks = true;
@@ -17755,7 +17993,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
17755
17993
  yAxisItem.interval = unifiedInterval;
17756
17994
  }
17757
17995
  if (isDepthLane) {
17758
- yAxisItem.alignTicks = true;
17996
+ yAxisItem.alignTicks = proxy.formCache.axisType !== "depth";
17759
17997
  yAxisItem.axisLabel = proxy.buildDepthTimeAxisLabel(
17760
17998
  lane,
17761
17999
  group2,
@@ -17952,7 +18190,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
17952
18190
  }
17953
18191
  if (Object.keys(updates).length > 0) {
17954
18192
  chart.setOption(updates, { notMerge: false, lazyUpdate: true });
17955
- proxy._pointerMetaGen++;
18193
+ proxy.invalidatePointerMeta();
17956
18194
  }
17957
18195
  }
17958
18196
  } catch (error) {
@@ -18100,7 +18338,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
18100
18338
  proxy.windowSize = scaled.windowSize;
18101
18339
  proxy.startIndex = scaled.start;
18102
18340
  proxy._syncingDepthScaleWindow = false;
18103
- if (!options.silent) {
18341
+ if (!options.silent && !proxy.isUpdatingChart) {
18104
18342
  proxy.syncScaleSelection(effective);
18105
18343
  }
18106
18344
  return effective;
@@ -18191,6 +18429,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
18191
18429
  proxy._wheelScaleBoundKey = "";
18192
18430
  proxy._zoomIdleTimer = 0;
18193
18431
  proxy._interactPatchRaf = 0;
18432
+ proxy._depthWindowSyncRaf = 0;
18433
+ proxy._pendingDepthWindow = null;
18194
18434
  proxy._visibleDataEmitTimer = 0;
18195
18435
  proxy._pendingVisibleData = null;
18196
18436
  proxy._needFullChartAfterInteract = false;
@@ -18279,6 +18519,11 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
18279
18519
  cancelAnimationFrame(proxy._interactPatchRaf);
18280
18520
  proxy._interactPatchRaf = 0;
18281
18521
  }
18522
+ if (proxy._depthWindowSyncRaf) {
18523
+ cancelAnimationFrame(proxy._depthWindowSyncRaf);
18524
+ proxy._depthWindowSyncRaf = 0;
18525
+ proxy._pendingDepthWindow = null;
18526
+ }
18282
18527
  if (proxy._geoClickTimer) {
18283
18528
  clearTimeout(proxy._geoClickTimer);
18284
18529
  proxy._geoClickTimer = 0;
@@ -18404,6 +18649,9 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
18404
18649
  isMissingTooltipValue,
18405
18650
  laneHasAnyValidPlotPoint,
18406
18651
  findHelperTooltipAnchor,
18652
+ getLaneTooltipPosition,
18653
+ getLaneTooltipExtraCss,
18654
+ buildHelperTipRailData,
18407
18655
  onChartAreaMouseMove,
18408
18656
  updateCrosshairLine,
18409
18657
  schedulePointerSync,
@@ -18931,6 +19179,9 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
18931
19179
  isMissingTooltipValue,
18932
19180
  laneHasAnyValidPlotPoint,
18933
19181
  findHelperTooltipAnchor,
19182
+ getLaneTooltipPosition,
19183
+ getLaneTooltipExtraCss,
19184
+ buildHelperTipRailData,
18934
19185
  onChartAreaMouseMove,
18935
19186
  updateCrosshairLine,
18936
19187
  schedulePointerSync,
@@ -19345,7 +19596,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
19345
19596
  };
19346
19597
  }
19347
19598
  });
19348
- const LineChartContainer = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f3ff591a"]]);
19599
+ const LineChartContainer = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-40b0278e"]]);
19349
19600
  const _hoisted_1$1 = ["title"];
19350
19601
  const _hoisted_2$1 = ["title"];
19351
19602
  const _sfc_main$1 = /* @__PURE__ */ Object.assign({
@@ -20172,7 +20423,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({ name: "frameLayout" }, {
20172
20423
  "trend-change",
20173
20424
  "need-double-config",
20174
20425
  "updateSettings",
20175
- "config-change"
20426
+ "config-change",
20427
+ "visibleDataChange"
20176
20428
  ],
20177
20429
  setup(__props, { expose: __expose, emit: __emit }) {
20178
20430
  function holdCurveDatas(val) {
@@ -20456,11 +20708,15 @@ const _sfc_main = /* @__PURE__ */ Object.assign({ name: "frameLayout" }, {
20456
20708
  } else if (data.type === 3) ;
20457
20709
  }
20458
20710
  function visibleDataChange(data) {
20459
- if (proxy.$refs.functionControlPanel) {
20460
- proxy.$refs.functionControlPanel.handleToolBarDataChange(data);
20461
- }
20462
- if (proxy.$refs.depthTimeChart) {
20463
- proxy.$refs.depthTimeChart.visibleDataRangeChange(data);
20711
+ try {
20712
+ if (proxy.$refs.functionControlPanel) {
20713
+ proxy.$refs.functionControlPanel.handleToolBarDataChange(data);
20714
+ }
20715
+ if (proxy.$refs.depthTimeChart) {
20716
+ proxy.$refs.depthTimeChart.visibleDataRangeChange(data);
20717
+ }
20718
+ } finally {
20719
+ emit("visibleDataChange", data);
20464
20720
  }
20465
20721
  }
20466
20722
  function handleDepthTimeChange(data) {
@@ -20580,12 +20836,21 @@ const _sfc_main = /* @__PURE__ */ Object.assign({ name: "frameLayout" }, {
20580
20836
  }
20581
20837
  }
20582
20838
  function updateScale(newVal) {
20583
- if (proxy.formCache.scale === newVal) {
20839
+ const cur = proxy.formCache.scale;
20840
+ if (cur === newVal) {
20584
20841
  if (proxy.$refs.functionControlPanel && proxy.$refs.functionControlPanel.form.scale !== newVal) {
20585
20842
  proxy.$refs.functionControlPanel.form.scale = newVal;
20586
20843
  }
20587
20844
  return;
20588
20845
  }
20846
+ const curM = typeof cur === "string" && String(cur).indexOf(":") >= 0 ? Number(String(cur).split(":").pop()) / 100 : Number(cur);
20847
+ const nextM = typeof newVal === "string" && String(newVal).indexOf(":") >= 0 ? Number(String(newVal).split(":").pop()) / 100 : Number(newVal);
20848
+ if (Number.isFinite(curM) && Number.isFinite(nextM) && curM > 0 && nextM > 0 && Math.abs(curM - nextM) < 1e-6) {
20849
+ if (proxy.$refs.functionControlPanel && typeof newVal === "number" && proxy.$refs.functionControlPanel.form.scale !== newVal) {
20850
+ proxy.$refs.functionControlPanel.form.scale = newVal;
20851
+ }
20852
+ return;
20853
+ }
20589
20854
  proxy.formCache.scale = newVal;
20590
20855
  if (proxy.$refs.functionControlPanel) {
20591
20856
  proxy.$refs.functionControlPanel.form.scale = newVal;
@@ -21009,7 +21274,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({ name: "frameLayout" }, {
21009
21274
  };
21010
21275
  }
21011
21276
  });
21012
- const FrameLayoutComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6dbf2284"]]);
21277
+ const FrameLayoutComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-02e381b4"]]);
21013
21278
  function installComponents(app) {
21014
21279
  installKdI18n(app);
21015
21280
  app.component(KdLaneContainerComponent.name, KdLaneContainerComponent);