mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-16 12:07:26 +08:00
consider close by 'esc' key on maskeditor.
This commit is contained in:
parent
f31fcf5280
commit
2d50ec4a98
@ -195,7 +195,6 @@ class MaskEditorDialog extends ComfyDialog {
|
|||||||
var cancelButton = this.createRightButton("Cancel", () => {
|
var cancelButton = this.createRightButton("Cancel", () => {
|
||||||
document.removeEventListener("mouseup", MaskEditorDialog.handleMouseUp);
|
document.removeEventListener("mouseup", MaskEditorDialog.handleMouseUp);
|
||||||
document.removeEventListener("keydown", MaskEditorDialog.handleKeyDown);
|
document.removeEventListener("keydown", MaskEditorDialog.handleKeyDown);
|
||||||
ComfyApp.onClipspaceEditorClosed(false);
|
|
||||||
self.close();
|
self.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -245,6 +244,22 @@ class MaskEditorDialog extends ComfyDialog {
|
|||||||
this.setEventHandler(maskCanvas);
|
this.setEventHandler(maskCanvas);
|
||||||
|
|
||||||
this.is_layout_created = true;
|
this.is_layout_created = true;
|
||||||
|
|
||||||
|
// replacement of onClose hook since close is not real close
|
||||||
|
const self = this;
|
||||||
|
const observer = new MutationObserver(function(mutations) {
|
||||||
|
mutations.forEach(function(mutation) {
|
||||||
|
if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
|
||||||
|
if(self.last_style && self.last_style != 'none')
|
||||||
|
ComfyApp.onClipspaceEditorClosed();
|
||||||
|
|
||||||
|
self.last_style = self.element.style;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const config = { attributes: true };
|
||||||
|
observer.observe(this.element, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setImages(this.imgCanvas, this.backupCanvas);
|
this.setImages(this.imgCanvas, this.backupCanvas);
|
||||||
|
|||||||
@ -55,14 +55,17 @@ export class ComfyApp {
|
|||||||
return node.imgs || (node && node.widgets && node.widgets.findIndex(obj => obj.name === 'image') >= 0);
|
return node.imgs || (node && node.widgets && node.widgets.findIndex(obj => obj.name === 'image') >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static onClipspaceEditorClosed(save_mode) {
|
static onClipspaceEditorSave() {
|
||||||
if(ComfyApp.clipspace_return_node) {
|
if(ComfyApp.clipspace_return_node) {
|
||||||
if(save_mode)
|
if(save_mode)
|
||||||
ComfyApp.pasteToClipspace(ComfyApp.clipspace_return_node);
|
ComfyApp.pasteToClipspace(ComfyApp.clipspace_return_node);
|
||||||
ComfyApp.clipspace_return_node = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static onClipspaceEditorClosed() {
|
||||||
|
ComfyApp.clipspace_return_node = null;
|
||||||
|
}
|
||||||
|
|
||||||
static copyToClipspace(node) {
|
static copyToClipspace(node) {
|
||||||
var widgets = null;
|
var widgets = null;
|
||||||
if(node.widgets) {
|
if(node.widgets) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user