Skip to content

Commit 6613227

Browse files
committed
set min brush size to 1
1 parent 1b9dea7 commit 6613227

File tree

1 file changed

+4
-0
lines changed
  • extensions-builtin/canvas-zoom-and-pan/javascript

1 file changed

+4
-0
lines changed

extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,17 @@ onUiLoaded(async() => {
474474
input.click();
475475
if (!withoutValue) {
476476
const maxValue = parseFloat(input.getAttribute("max")) || 100;
477+
const minValue = parseFloat(input.getAttribute("min")) || 1;
477478
// allow brush size up to 1/2 diagonal of the image, beyond gradio's arbitrary limit
478479
const canvasImg = gradioApp().querySelector(`${elemId} img`);
479480
if (canvasImg) {
480481
const maxDiameter = Math.sqrt(canvasImg.naturalWidth ** 2 + canvasImg.naturalHeight ** 2) / 2;
481482
if (maxDiameter > maxValue) {
482483
input.setAttribute("max", maxDiameter);
483484
}
485+
if (minValue > 1) {
486+
input.setAttribute("min", '1');
487+
}
484488
}
485489
const brush_factor = deltaY > 0 ? 1 - opts.canvas_hotkey_brush_factor : 1 + opts.canvas_hotkey_brush_factor;
486490
const currentRadius = parseFloat(input.value);

0 commit comments

Comments
 (0)