Skip to content

Commit 137d924

Browse files
authored
Remove unnecessary chart updates on drags (#913)
1 parent 77ed88c commit 137d924

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/handlers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function mouseMove(chart: Chart, event: MouseEvent) {
4545
if (state.dragStart) {
4646
state.dragging = true
4747
state.dragEnd = event
48-
chart.update('none')
48+
chart.draw()
4949
}
5050
}
5151

@@ -58,7 +58,7 @@ function keyDown(chart: Chart, event: KeyboardEvent) {
5858
removeHandler(chart, 'keydown')
5959
state.dragging = false
6060
state.dragStart = state.dragEnd = undefined
61-
chart.update('none')
61+
chart.draw()
6262
}
6363

6464
function getPointPosition(event: MouseEvent, chart: Chart) {
@@ -203,12 +203,12 @@ export function mouseUp(chart: Chart, event: MouseEvent) {
203203
const distanceY = directionEnabled(mode, 'y', chart) ? rect.height : 0
204204
const distance = Math.sqrt(distanceX * distanceX + distanceY * distanceY)
205205

206-
// Remove drag start and end before chart update to stop drawing selected area
206+
// Remove drag start and end before chart render to stop drawing selected area
207207
state.dragStart = state.dragEnd = undefined
208208

209209
if (distance <= threshold) {
210210
state.dragging = false
211-
chart.update('none')
211+
chart.draw()
212212
return
213213
}
214214

0 commit comments

Comments
 (0)