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.
@@ -92,12 +92,19 @@ const UnitLinkGraph = ({
92
92
  const sliderActive = React.useMemo(() => {
93
93
  return barSecondaryConfiguration ? true : false;
94
94
  }, [barSecondaryConfiguration]);
95
+ const refMemoMaximumAni = React.useRef(maximum_ani);
95
96
  const svgReference = React.useRef(null);
96
97
  const [totalWidth, setTotalWidth] = React.useState(0);
97
98
  const [totalHeight, setTotalHeight] = React.useState(height);
98
99
  const [mainWidth, setMainWidth] = React.useState(0);
99
100
  const [mainStart, setMainStart] = React.useState(0);
100
101
  const [sliderValue, setSliderValue] = React.useState(initialSliderValue);
102
+ React.useEffect(() => {
103
+ if (refMemoMaximumAni.current !== maximum_ani) {
104
+ setSliderValue(0);
105
+ refMemoMaximumAni.current = maximum_ani;
106
+ }
107
+ }, [refMemoMaximumAni, maximum_ani]);
101
108
  const place_at_ani = React.useMemo(() => {
102
109
  if (barMainConfiguration.followSlider) {
103
110
  return sliderValue;
@@ -385,7 +392,14 @@ const UnitLinkGraph = ({
385
392
  }
386
393
  };
387
394
  },
388
- [mainWidth, mainStart, configurations, totalHeight, place_at_ani]
395
+ [
396
+ mainWidth,
397
+ mainStart,
398
+ configurations,
399
+ totalHeight,
400
+ place_at_ani,
401
+ maximum_ani
402
+ ]
389
403
  );
390
404
  const computeAction = React.useCallback(
391
405
  ({
@@ -787,6 +801,7 @@ const RenderSlider = ({
787
801
  }) => {
788
802
  const PADDING_Y = 13;
789
803
  const GAP_TIMELINE_ACTIONS = 10;
804
+ const refMemoMax = React.useRef(max);
790
805
  const [internalValue, setInternalValue] = React.useState(externalValue || min);
791
806
  const [isDragging, setIsDragging] = React.useState(false);
792
807
  const sliderRef = React.useRef(null);
@@ -867,7 +882,8 @@ const RenderSlider = ({
867
882
  const trackWidth = sliderPosition.w;
868
883
  const normalizeValue = (internalValue - min) / (max - min);
869
884
  const x = normalizeValue * trackWidth + sliderPosition.x;
870
- return x - thumbRenderProperties.w / 2 + 2;
885
+ const calculateX = x - thumbRenderProperties.w / 2 + 2;
886
+ return calculateX;
871
887
  }, [
872
888
  min,
873
889
  max,
@@ -890,6 +906,12 @@ const RenderSlider = ({
890
906
  window.removeEventListener("touchend", onTouchEnd);
891
907
  };
892
908
  }, [isDragging, onMouseMove, onMouseUp, onTouchMove, onTouchEnd]);
909
+ React.useEffect(() => {
910
+ if (refMemoMax.current !== max) {
911
+ setInternalValue(0);
912
+ refMemoMax.current = max;
913
+ }
914
+ }, [refMemoMax, max]);
893
915
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
894
916
  /* @__PURE__ */ jsxRuntime.jsx(
895
917
  "rect",
@@ -922,7 +944,7 @@ const RenderSlider = ({
922
944
  fill: utils.colors.info_600
923
945
  }
924
946
  ),
925
- internalValue !== min && internalValue !== max && /* @__PURE__ */ jsxRuntime.jsxs(
947
+ internalValue > min && internalValue < max && /* @__PURE__ */ jsxRuntime.jsxs(
926
948
  "text",
927
949
  {
928
950
  x: thumbRenderProperties.w / 2,