improve: image preview - compact mode for same aspect ratio

issue: There is an issue where, after the first execution, it always runs one more time even if it hasn't changed.
This commit is contained in:
Dr.Lt.Data
2023-10-16 07:51:30 +09:00
parent 973b555807
commit 3ebc87e446
3 changed files with 11 additions and 4 deletions
+7 -1
View File
@@ -1,4 +1,5 @@
import { ComfyApp, app } from "../../scripts/app.js";
import { api } from "../../scripts/api.js";
function load_image(str) {
let base64String = canvas.toDataURL('image/png');
@@ -38,6 +39,10 @@ app.registerExtension({
let w = node.widgets.find(obj => obj.name === 'image');
Object.defineProperty(w, 'value', {
async set(v) {
const stackTrace = new Error().stack;
if(stackTrace.includes('presetText.js'))
return;
w._value = v;
let image = new Image();
@@ -52,7 +57,8 @@ app.registerExtension({
else
w._value = '';
}
catch {
catch(exception) {
console.log(exception);
w._value = '';
}
node.imgs = [image];
+1 -1
View File
@@ -2,7 +2,7 @@ import configparser
import os
version = "V4.23.2"
version = "V4.23.3"
dependency_version = 14
+3 -2
View File
@@ -226,15 +226,16 @@ async def segs_picker(request):
@server.PromptServer.instance.routes.get("/view/validate")
async def segs_picker(request):
async def view_validate(request):
if "filename" in request.rel_url.query:
filename = request.rel_url.query["filename"]
subfolder = request.rel_url.query["subfolder"]
filename, output_dir = folder_paths.annotated_filepath(filename)
if filename[0] == '/' or '..' in filename:
return web.Response(status=400)
file = os.path.join(output_dir, filename)
file = os.path.join(output_dir, subfolder, filename)
if os.path.isfile(file):
return web.Response(status=200)