Merge pull request #551 from asz8621/main

zoom 導致圖表消失
This commit is contained in:
lihu 2024-06-05 23:29:58 +08:00 committed by GitHub
commit 5291419418
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run lint
# npm run lint

View File

@ -18,6 +18,7 @@ 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'
@ -274,7 +275,7 @@ export default class Event implements EventHandler {
const consumed = widget.dispatchEvent('pressedMouseMoveEvent', event)
if (!consumed) {
const xAxis = (pane as DrawPane<XAxis>).getAxisComponent()
if (xAxis?.getScrollZoomEnabled() ?? true) {
if ((xAxis?.getScrollZoomEnabled() ?? true) && isNumber( event.pageX)) {
const scale = this._xAxisStartScaleDistance / event.pageX
const zoomScale = (scale - this._xAxisScale) * 10
this._xAxisScale = scale