mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-21 23:09:39 +00:00
Update Litegraph: Canvas Pointer (#1556)
* Litegraph: canvas.pointer Clear @ts-expect-error Fix exception thrown on slot double-click Long-standing bug but has no real impact in prod - just logs an error. Required for new connecting_link features. Add settings: CanvasPointer options Update litegraph 0.8.28 Fix regression in snap to grid render Fix snap to grid marker always on Update snap to grid to use Positionable API Fix test clicks registering as double-click Improve test precision Current test proves it has changed to something smaller. New test proves it is exactly what was specified. Will need refinement when a limit is put on latent width. Fix test expects collapse node to select node Remove redundant code Resolved by CanvasPointer Fix flaky test - ContextMenu Fix settings group * Update litegraph * Remove snapToGrid extension * Update test expectations [skip ci] --------- Co-authored-by: huchenlei <huchenlei@proton.me> Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -15,7 +15,6 @@ import './rerouteNode'
|
||||
import './saveImageExtraOutput'
|
||||
import './simpleTouchSupport'
|
||||
import './slotDefaults'
|
||||
import './snapToGrid'
|
||||
import './uploadImage'
|
||||
import './webcamCapture'
|
||||
import './widgetInputs'
|
||||
|
||||
@@ -44,7 +44,7 @@ app.registerExtension({
|
||||
lastTouch = getMultiTouchCenter(e)
|
||||
|
||||
touchDist = getMultiTouchPos(e)
|
||||
app.canvas.pointer_is_down = false
|
||||
app.canvas.pointer.isDown = false
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -78,7 +78,7 @@ app.registerExtension({
|
||||
touchTime = null
|
||||
if (e.touches?.length === 2 && lastTouch && !e.ctrlKey && !e.shiftKey) {
|
||||
e.preventDefault() // Prevent browser from zooming when two textareas are touched
|
||||
app.canvas.pointer_is_down = false
|
||||
app.canvas.pointer.isDown = false
|
||||
touchZooming = true
|
||||
|
||||
LiteGraph.closeAllContextMenus(window)
|
||||
@@ -137,7 +137,7 @@ LGraphCanvas.prototype.processMouseDown = function (e) {
|
||||
if (touchZooming || touchCount) {
|
||||
return
|
||||
}
|
||||
app.canvas.pointer_is_down = false // Prevent context menu from opening on second tap
|
||||
app.canvas.pointer.isDown = false // Prevent context menu from opening on second tap
|
||||
return processMouseDown.apply(this, arguments)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
import { app } from '../../scripts/app'
|
||||
import { LiteGraph } from '@comfyorg/litegraph'
|
||||
|
||||
app.registerExtension({
|
||||
name: 'Comfy.SnapToGrid',
|
||||
init() {
|
||||
// Add setting to control grid size
|
||||
app.ui.settings.addSetting({
|
||||
id: 'Comfy.SnapToGrid.GridSize',
|
||||
category: ['LiteGraph', 'Canvas', 'GridSize'],
|
||||
name: 'Snap to grid size',
|
||||
type: 'slider',
|
||||
attrs: {
|
||||
min: 1,
|
||||
max: 500
|
||||
},
|
||||
tooltip:
|
||||
'When dragging and resizing nodes while holding shift they will be aligned to the grid, this controls the size of that grid.',
|
||||
defaultValue: LiteGraph.CANVAS_GRID_SIZE,
|
||||
onChange(value) {
|
||||
LiteGraph.CANVAS_GRID_SIZE = +value || 10
|
||||
}
|
||||
})
|
||||
|
||||
// Keep the 'pysssss.SnapToGrid' setting id so we don't need to migrate setting values.
|
||||
// Using a new setting id can cause existing users to lose their existing settings.
|
||||
app.ui.settings.addSetting({
|
||||
id: 'pysssss.SnapToGrid',
|
||||
category: ['LiteGraph', 'Canvas', 'AlwaysSnapToGrid'],
|
||||
name: 'Always snap to grid',
|
||||
type: 'boolean',
|
||||
defaultValue: false,
|
||||
versionAdded: '1.3.13',
|
||||
versionModified: '1.3.42',
|
||||
onChange(value) {
|
||||
app.graph.config.alwaysSnapToGrid = !!value
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -894,7 +894,7 @@ app.registerExtension({
|
||||
// Not a widget input or already handled input
|
||||
if (
|
||||
!(input.type in ComfyWidgets) &&
|
||||
!(input.widget[GET_CONFIG]?.()?.[0] instanceof Array)
|
||||
!(input.widget?.[GET_CONFIG]?.()?.[0] instanceof Array)
|
||||
) {
|
||||
return r //also Not a ComfyWidgets input or combo (do nothing)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user