Remove DragAndScale rounding when using trackpad (#1009)

Fixes issue where pinch to zoom would jitter around scale 1 - D&S rounds
the value to exactly 1 when it is "close enough". Good for pointer, poor
UX for precision trackpad.
This commit is contained in:
filtered
2025-05-05 07:06:43 +10:00
committed by GitHub
parent 53f766af3d
commit 386f18a1e5
2 changed files with 10 additions and 8 deletions

View File

@@ -2974,18 +2974,20 @@ export class LGraphCanvas {
) {
if (e.ctrlKey && !Number.isInteger(e.deltaY)) {
scale *= 1 + e.deltaY * (1 - this.zoom_speed) * 0.18
this.ds.changeScale(scale, [e.clientX, e.clientY], false)
} else {
this.ds.offset[0] -= e.deltaX * 1.18 * (1 / scale)
this.ds.offset[1] -= e.deltaY * 1.18 * (1 / scale)
}
} else if (delta > 0) {
scale *= this.zoom_speed
} else if (delta < 0) {
scale *= 1 / (this.zoom_speed)
} else {
if (delta > 0) {
scale *= this.zoom_speed
} else if (delta < 0) {
scale *= 1 / (this.zoom_speed)
}
this.ds.changeScale(scale, [e.clientX, e.clientY])
}
this.ds.changeScale(scale, [e.clientX, e.clientY])
this.graph.change()
e.preventDefault()