mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-24 22:12:17 -03:00
Add onInteractionEnd callback to Canvas
Introduces an optional onInteractionEnd callback to the Canvas class, which is triggered at the end of user interactions. CanvasView now uses this callback to update output after interactions, improving responsiveness to user actions.
This commit is contained in:
@@ -11,7 +11,7 @@ import {createModuleLogger} from "./utils/LoggerUtils.js";
|
||||
const log = createModuleLogger('Canvas');
|
||||
|
||||
export class Canvas {
|
||||
constructor(node, widget) {
|
||||
constructor(node, widget, callbacks = {}) {
|
||||
this.node = node;
|
||||
this.widget = widget;
|
||||
this.canvas = document.createElement('canvas');
|
||||
@@ -22,6 +22,7 @@ export class Canvas {
|
||||
this.selectedLayer = null;
|
||||
this.selectedLayers = [];
|
||||
this.onSelectionChange = null;
|
||||
this.onInteractionEnd = callbacks.onInteractionEnd || null;
|
||||
this.lastMousePosition = {x: 0, y: 0};
|
||||
|
||||
this.viewport = {
|
||||
|
||||
Reference in New Issue
Block a user