mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 02:32:18 +00:00
Emit only one change when deleting nodes (#296)
This commit is contained in:
@@ -2971,12 +2971,14 @@ export class LGraphCanvas {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @todo Refactor to where it belongs - e.g. Deleting / creating nodes is not actually canvas event. */
|
||||||
emitBeforeChange(): void {
|
emitBeforeChange(): void {
|
||||||
this.emitEvent({
|
this.emitEvent({
|
||||||
subType: "before-change",
|
subType: "before-change",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @todo See {@link emitBeforeChange} */
|
||||||
emitAfterChange(): void {
|
emitAfterChange(): void {
|
||||||
this.emitEvent({
|
this.emitEvent({
|
||||||
subType: "after-change",
|
subType: "after-change",
|
||||||
@@ -3314,9 +3316,12 @@ export class LGraphCanvas {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes all selected items from the graph.
|
* Deletes all selected items from the graph.
|
||||||
|
*
|
||||||
|
* @todo Refactor deletion task to LGraph. Selection is a canvas property, delete is a graph action.
|
||||||
*/
|
*/
|
||||||
deleteSelected(): void {
|
deleteSelected(): void {
|
||||||
const { graph } = this
|
const { graph } = this
|
||||||
|
this.emitBeforeChange()
|
||||||
graph.beforeChange()
|
graph.beforeChange()
|
||||||
|
|
||||||
for (const item of this.selectedItems) {
|
for (const item of this.selectedItems) {
|
||||||
@@ -3337,6 +3342,7 @@ export class LGraphCanvas {
|
|||||||
this.highlighted_links = {}
|
this.highlighted_links = {}
|
||||||
this.setDirty(true)
|
this.setDirty(true)
|
||||||
graph.afterChange()
|
graph.afterChange()
|
||||||
|
this.emitAfterChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user