mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 04:31:58 +00:00
new design for left click and wheel (#5566)
* new design for left click and wheel * update snap * fix import * fix test * default value * fix test * Update test expectations [skip ci] --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -2348,7 +2348,7 @@ export class LGraphCanvas
|
||||
if (
|
||||
ctrlOrMeta &&
|
||||
!e.altKey &&
|
||||
LiteGraph.canvasNavigationMode === 'legacy'
|
||||
LiteGraph.leftMouseClickBehavior === 'panning'
|
||||
) {
|
||||
this.#setupNodeSelectionDrag(e, pointer, node)
|
||||
|
||||
@@ -2616,8 +2616,8 @@ export class LGraphCanvas
|
||||
!pointer.onDrag &&
|
||||
this.allow_dragcanvas
|
||||
) {
|
||||
// allow dragging canvas if canvas is not in standard, or read-only (pan mode in standard)
|
||||
if (LiteGraph.canvasNavigationMode !== 'standard' || this.read_only) {
|
||||
// allow dragging canvas based on leftMouseClickBehavior or read-only mode
|
||||
if (LiteGraph.leftMouseClickBehavior === 'panning' || this.read_only) {
|
||||
pointer.onClick = () => this.processSelect(null, e)
|
||||
pointer.finally = () => (this.dragging_canvas = false)
|
||||
this.dragging_canvas = true
|
||||
@@ -3629,8 +3629,8 @@ export class LGraphCanvas
|
||||
e.ctrlKey || (e.metaKey && navigator.platform.includes('Mac'))
|
||||
const isZoomModifier = isCtrlOrMacMeta && !e.altKey && !e.shiftKey
|
||||
|
||||
if (isZoomModifier || LiteGraph.canvasNavigationMode === 'legacy') {
|
||||
// Legacy mode or standard mode with ctrl - use wheel for zoom
|
||||
if (isZoomModifier || LiteGraph.mouseWheelScroll === 'zoom') {
|
||||
// Zoom mode or modifier key pressed - use wheel for zoom
|
||||
if (isTrackpad) {
|
||||
// Trackpad gesture - use smooth scaling
|
||||
scale *= 1 + e.deltaY * (1 - this.zoom_speed) * 0.18
|
||||
@@ -3645,7 +3645,6 @@ export class LGraphCanvas
|
||||
this.ds.changeScale(scale, [e.clientX, e.clientY])
|
||||
}
|
||||
} else {
|
||||
// Standard mode without ctrl - use wheel / gestures to pan
|
||||
// Trackpads and mice work on significantly different scales
|
||||
const factor = isTrackpad ? 0.18 : 0.008_333
|
||||
|
||||
|
||||
Reference in New Issue
Block a user