@gravity-ui/chartkit 8.10.0 → 8.10.1

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.
@@ -162,6 +162,19 @@ function initHighchartsLangOptions() {
162
162
  },
163
163
  });
164
164
  }
165
+ // Backport of the Highcharts 9 fix (we are pinned to v8): when any ancestor scrolls, refresh
166
+ // the cached `pointer.chartPosition`, otherwise the tooltip drifts by the scroll offset.
167
+ // Recalculated, not deleted: `onDocumentMouseMove` relies on its presence.
168
+ // `mouseover` is handled because the browser may fire it before `scroll`.
169
+ function updateChartPositions() {
170
+ Highcharts.charts.forEach((chart) => {
171
+ const pointer = chart && chart.pointer;
172
+ if (pointer && pointer.chartPosition) {
173
+ pointer.chartPosition = undefined;
174
+ pointer.getChartPosition();
175
+ }
176
+ });
177
+ }
165
178
  function initHighcharts({ isMobile }) {
166
179
  initHighchartsLangOptions();
167
180
  // https://github.com/highcharts/highcharts/issues/11494
@@ -176,6 +189,8 @@ function initHighcharts({ isMobile }) {
176
189
  return t;
177
190
  });
178
191
  })(Highcharts);
192
+ window.document.addEventListener('scroll', updateChartPositions, true);
193
+ window.document.addEventListener('mouseover', updateChartPositions, true);
179
194
  Highcharts.wrap(Highcharts.Chart.prototype, 'redraw', function (proceed, ...rest) {
180
195
  if (this.tooltip.fixed) {
181
196
  hideFixedTooltip(this.tooltip, isMobile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/chartkit",
3
- "version": "8.10.0",
3
+ "version": "8.10.1",
4
4
  "description": "React component used to render charts based on any sources you need",
5
5
  "license": "MIT",
6
6
  "repository": "git@github.com:gravity-ui/ChartKit.git",