Update rs_vae_save_image.js
This commit is contained in:
@@ -341,12 +341,15 @@ app.registerExtension({
|
||||
this._hasNewImages = false;
|
||||
|
||||
this.setSize([MIN_WIDTH, MIN_HEIGHT]);
|
||||
this.min_size = [MIN_WIDTH, MIN_HEIGHT];
|
||||
// min_size НЕ устанавливаем — иначе нода не сможет свернуться
|
||||
|
||||
// Минимальный размер применяем только к развёрнутой ноде
|
||||
this.onResize = function() {
|
||||
if (this.size[0] < MIN_WIDTH) this.size[0] = MIN_WIDTH;
|
||||
if (this.size[1] < MIN_HEIGHT) this.size[1] = MIN_HEIGHT;
|
||||
this.setDirtyCanvas(true, true);
|
||||
if (this.flags?.collapsed) return;
|
||||
let changed = false;
|
||||
if (this.size[0] < MIN_WIDTH) { this.size[0] = MIN_WIDTH; changed = true; }
|
||||
if (this.size[1] < MIN_HEIGHT) { this.size[1] = MIN_HEIGHT; changed = true; }
|
||||
if (changed) this.setDirtyCanvas(true, true);
|
||||
};
|
||||
|
||||
this.loadOutputFolders = async function () {
|
||||
@@ -490,6 +493,9 @@ app.registerExtension({
|
||||
}
|
||||
|
||||
this.onDrawBackground = function(ctx) {
|
||||
// Свёрнутая нода — ничего не рисуем
|
||||
if (this.flags?.collapsed) return;
|
||||
|
||||
ctx.save();
|
||||
try {
|
||||
if (this.imgs.length === 0) return;
|
||||
@@ -585,6 +591,13 @@ app.registerExtension({
|
||||
|
||||
const origODF = this.onDrawForeground;
|
||||
this.onDrawForeground = function (ctx, vr) {
|
||||
// При сворачивании: чистим зоны кликов, но всё равно даём ComfyUI нарисовать заголовок/порты
|
||||
if (this.flags?.collapsed) {
|
||||
this.clickZones = [];
|
||||
if (origODF) origODF.apply(this, arguments);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.save();
|
||||
try {
|
||||
if (origODF) origODF.apply(this, arguments);
|
||||
@@ -668,6 +681,9 @@ app.registerExtension({
|
||||
};
|
||||
|
||||
this.onMouseDown = function (e, pos, canvas) {
|
||||
// Свёрнутая нода — клики по превью не обрабатываем
|
||||
if (this.flags?.collapsed) return false;
|
||||
|
||||
const availableW = this.size[0] - this.padding * 2;
|
||||
const availableH = this.size[1] - this.widgetsHeight - this.padding * 2;
|
||||
const startY = this.widgetsHeight + this.padding;
|
||||
@@ -766,7 +782,7 @@ app.registerExtension({
|
||||
menu.appendChild(rootItem);
|
||||
|
||||
const customItem = document.createElement("div");
|
||||
customItem.textContent = "️ Custom path...";
|
||||
customItem.textContent = "✏️ Custom path...";
|
||||
customItem.style.cssText = 'padding:8px 15px;cursor:pointer;color:#aaa;font-size:12px;border-bottom:1px solid #333;';
|
||||
customItem.onmouseover = () => customItem.style.background = "#333";
|
||||
customItem.onmouseout = () => customItem.style.background = "#1a1a1a";
|
||||
@@ -987,4 +1003,4 @@ app.registerExtension({
|
||||
return result;
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user