@easyv/charts 1.10.31 → 1.10.33

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.
@@ -60,18 +60,28 @@ export default memo(
60
60
  x: translateTip.x + position + marginLeft,
61
61
  };
62
62
  if (!isVertical && translate3d.x + tooltipSize.width > width) {
63
- const newPositon =
63
+ translate3d.x =
64
64
  position + marginLeft - tooltipSize.width - translateTip.x;
65
- translate3d.x = newPositon >= 0 ? newPositon : 0;
65
+ translate3d.x = translate3d.x >= 0 ? translate3d.x : 0;
66
+ translate3d.x =
67
+ translate3d.x + tooltipSize.width > width
68
+ ? width - tooltipSize.width
69
+ : translate3d.x;
70
+ translate3d.x = translate3d.x >= 0 ? translate3d.x : 0;
66
71
  }
67
72
  if (isVertical && translate3d.y + tooltipSize.height > height) {
68
- const newPositon =
73
+ translate3d.y =
69
74
  position + marginTop - tooltipSize.height - translateTip.y;
75
+ translate3d.y = translate3d.y >= 0 ? translate3d.y : 0;
70
76
  translate3d.y =
71
- newPositon <= 0 ? newPositon : height - tooltipSize.height;
77
+ translate3d.y + tooltipSize.height > height
78
+ ? height - tooltipSize.height
79
+ : translate3d.y;
80
+ translate3d.y = translate3d.y >= 0 ? translate3d.y : 0;
72
81
  }
73
82
  return getTranslate3d(translate3d);
74
83
  }, [
84
+ isVertical,
75
85
  width,
76
86
  height,
77
87
  marginLeft,
@@ -82,10 +92,9 @@ export default memo(
82
92
  ]);
83
93
  useEffect(() => {
84
94
  if (tooltipRef.current && (manual || auto)) {
85
- const rect = tooltipRef.current.getBoundingClientRect();
86
95
  setTooltipSize({
87
- width: rect.width,
88
- height: rect.height,
96
+ width: tooltipRef.current.offsetWidth,
97
+ height: tooltipRef.current.offsetHeight,
89
98
  });
90
99
  }
91
100
  }, [manual, auto, formatter, data, series, x]);