mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-03 04:00:31 +00:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user