Skip to content

Commit

Permalink
Merge pull request klinecharts#551 from asz8621/main
Browse files Browse the repository at this point in the history
zoom 導致圖表消失
  • Loading branch information
liihuu authored Jun 5, 2024
2 parents 0919d2f + 21eed02 commit 5291419
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
# npm run lint
3 changes: 2 additions & 1 deletion src/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5291419

Please sign in to comment.