rename contentClipboard -> clipspace

This commit is contained in:
Dr.Lt.Data 2023-04-20 22:36:13 +09:00
parent 9e8c60e9f3
commit 65a005e9a2

View File

@ -24,7 +24,7 @@ export class ComfyApp {
* Content Clipboard * Content Clipboard
* @type {serialized node object} * @type {serialized node object}
*/ */
static contentClipboard = null; static clipspace = null;
constructor() { constructor() {
this.ui = new ComfyUI(this); this.ui = new ComfyUI(this);
@ -146,16 +146,16 @@ export class ComfyApp {
if(this.widgets) { if(this.widgets) {
widgets = this.widgets.map(({ type, name, value }) => ({ type, name, value })); widgets = this.widgets.map(({ type, name, value }) => ({ type, name, value }));
} }
ComfyApp.contentClipboard = { 'widgets': widgets, 'imgs': this.imgs, 'images': this.images }; ComfyApp.clipspace = { 'widgets': widgets, 'imgs': this.imgs, 'images': this.images };
} }
}, },
{ {
content: "Paste (Clipspace)", content: "Paste (Clipspace)",
callback: () => { callback: () => {
if(ComfyApp.contentClipboard != null) { if(ComfyApp.clipspace != null) {
console.log(ComfyApp.contentClipboard.widgets); console.log(ComfyApp.clipspace.widgets);
if(ComfyApp.contentClipboard.widgets != null) { if(ComfyApp.clipspace.widgets != null) {
ComfyApp.contentClipboard.widgets.forEach(({ type, name, value }) => { ComfyApp.clipspace.widgets.forEach(({ type, name, value }) => {
const prop = Object.values(this.widgets).find(obj => obj.type === type && obj.name === name); const prop = Object.values(this.widgets).find(obj => obj.type === type && obj.name === name);
if (prop) { if (prop) {
prop.value = value; prop.value = value;
@ -163,9 +163,9 @@ export class ComfyApp {
}); });
} }
if(ComfyApp.contentClipboard.imgs != undefined && this.imgs != undefined) { if(ComfyApp.clipspace.imgs != undefined && this.imgs != undefined) {
this.imgs = ComfyApp.contentClipboard.imgs; this.imgs = ComfyApp.clipspace.imgs;
this.images = ComfyApp.contentClipboard.images; this.images = ComfyApp.clipspace.images;
const index = this.widgets.findIndex(obj => obj.name === 'image'); const index = this.widgets.findIndex(obj => obj.name === 'image');
if(index >= 0) { if(index >= 0) {
let filename = `${this.images[0].filename} [${this.images[0].type}]`; let filename = `${this.images[0].filename} [${this.images[0].type}]`;