rbro-tat-uds 2.2.0 → 2.2.2

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.
@@ -88,12 +88,19 @@ const UnitLinkGraph = ({
88
88
  const sliderActive = useMemo(() => {
89
89
  return barSecondaryConfiguration ? true : false;
90
90
  }, [barSecondaryConfiguration]);
91
+ const refMemoMaximumAni = useRef(maximum_ani);
91
92
  const svgReference = useRef(null);
92
93
  const [totalWidth, setTotalWidth] = useState(0);
93
94
  const [totalHeight, setTotalHeight] = useState(height);
94
95
  const [mainWidth, setMainWidth] = useState(0);
95
96
  const [mainStart, setMainStart] = useState(0);
96
97
  const [sliderValue, setSliderValue] = useState(initialSliderValue);
98
+ useEffect(() => {
99
+ if (refMemoMaximumAni.current !== maximum_ani) {
100
+ setSliderValue(0);
101
+ refMemoMaximumAni.current = maximum_ani;
102
+ }
103
+ }, [refMemoMaximumAni, maximum_ani]);
97
104
  const place_at_ani = useMemo(() => {
98
105
  if (barMainConfiguration.followSlider) {
99
106
  return sliderValue;
@@ -381,7 +388,14 @@ const UnitLinkGraph = ({
381
388
  }
382
389
  };
383
390
  },
384
- [mainWidth, mainStart, configurations, totalHeight, place_at_ani]
391
+ [
392
+ mainWidth,
393
+ mainStart,
394
+ configurations,
395
+ totalHeight,
396
+ place_at_ani,
397
+ maximum_ani
398
+ ]
385
399
  );
386
400
  const computeAction = useCallback(
387
401
  ({
@@ -783,6 +797,7 @@ const RenderSlider = ({
783
797
  }) => {
784
798
  const PADDING_Y = 13;
785
799
  const GAP_TIMELINE_ACTIONS = 10;
800
+ const refMemoMax = useRef(max);
786
801
  const [internalValue, setInternalValue] = useState(externalValue || min);
787
802
  const [isDragging, setIsDragging] = useState(false);
788
803
  const sliderRef = useRef(null);
@@ -863,7 +878,8 @@ const RenderSlider = ({
863
878
  const trackWidth = sliderPosition.w;
864
879
  const normalizeValue = (internalValue - min) / (max - min);
865
880
  const x = normalizeValue * trackWidth + sliderPosition.x;
866
- return x - thumbRenderProperties.w / 2 + 2;
881
+ const calculateX = x - thumbRenderProperties.w / 2 + 2;
882
+ return calculateX;
867
883
  }, [
868
884
  min,
869
885
  max,
@@ -886,6 +902,12 @@ const RenderSlider = ({
886
902
  window.removeEventListener("touchend", onTouchEnd);
887
903
  };
888
904
  }, [isDragging, onMouseMove, onMouseUp, onTouchMove, onTouchEnd]);
905
+ useEffect(() => {
906
+ if (refMemoMax.current !== max) {
907
+ setInternalValue(0);
908
+ refMemoMax.current = max;
909
+ }
910
+ }, [refMemoMax, max]);
889
911
  return /* @__PURE__ */ jsxs("g", { children: [
890
912
  /* @__PURE__ */ jsx(
891
913
  "rect",
@@ -918,7 +940,7 @@ const RenderSlider = ({
918
940
  fill: colors.info_600
919
941
  }
920
942
  ),
921
- internalValue !== min && internalValue !== max && /* @__PURE__ */ jsxs(
943
+ internalValue > min && internalValue < max && /* @__PURE__ */ jsxs(
922
944
  "text",
923
945
  {
924
946
  x: thumbRenderProperties.w / 2,