File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
extensions-builtin/canvas-zoom-and-pan/javascript Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments