From 661322707f003e89cf3a0897c72d2a9053d401df Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Sat, 23 Nov 2024 06:59:19 +0900 Subject: [PATCH] set min brush size to 1 --- extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js b/extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js index da07d3c7c..0b305dbc7 100644 --- a/extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js +++ b/extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js @@ -474,6 +474,7 @@ onUiLoaded(async() => { input.click(); if (!withoutValue) { const maxValue = parseFloat(input.getAttribute("max")) || 100; + const minValue = parseFloat(input.getAttribute("min")) || 1; // allow brush size up to 1/2 diagonal of the image, beyond gradio's arbitrary limit const canvasImg = gradioApp().querySelector(`${elemId} img`); if (canvasImg) { @@ -481,6 +482,9 @@ onUiLoaded(async() => { if (maxDiameter > maxValue) { input.setAttribute("max", maxDiameter); } + if (minValue > 1) { + input.setAttribute("min", '1'); + } } const brush_factor = deltaY > 0 ? 1 - opts.canvas_hotkey_brush_factor : 1 + opts.canvas_hotkey_brush_factor; const currentRadius = parseFloat(input.value);