diff --git a/src/Event.ts b/src/Event.ts index b34ea3d41..1cb025fae 100644 --- a/src/Event.ts +++ b/src/Event.ts @@ -18,7 +18,6 @@ import type Coordinate from './common/Coordinate' import { UpdateLevel } from './common/Updater' import type Crosshair from './common/Crosshair' import { requestAnimationFrame, cancelAnimationFrame } from './common/utils/compatible' -import { isNumber } from './common/utils/typeChecks' import { type AxisRange } from './component/Axis' import type YAxis from './component/YAxis' @@ -275,11 +274,13 @@ export default class Event implements EventHandler { const consumed = widget.dispatchEvent('pressedMouseMoveEvent', event) if (!consumed) { const xAxis = (pane as DrawPane).getAxisComponent() - if ((xAxis?.getScrollZoomEnabled() ?? true) && isNumber( event.pageX)) { + if ((xAxis?.getScrollZoomEnabled() ?? true)) { const scale = this._xAxisStartScaleDistance / event.pageX - const zoomScale = (scale - this._xAxisScale) * 10 - this._xAxisScale = scale - this._chart.getChartStore().getTimeScaleStore().zoom(zoomScale, this._xAxisStartScaleCoordinate ?? undefined) + if (Number.isFinite(scale)) { + const zoomScale = (scale - this._xAxisScale) * 10 + this._xAxisScale = scale + this._chart.getChartStore().getTimeScaleStore().zoom(zoomScale, this._xAxisStartScaleCoordinate ?? undefined) + } } } else { this._chart.updatePane(UpdateLevel.Overlay)