mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-02-08 00:32:08 -08:00
limit the minimum delta to 1
This commit is contained in:
parent
356339eff2
commit
e009f586a2
1 changed files with 6 additions and 1 deletions
|
|
@ -483,7 +483,12 @@ onUiLoaded(async() => {
|
|||
const currentRadius = parseFloat(input.value);
|
||||
const currentArea = currentRadius ** 2;
|
||||
const newArea = currentArea * brush_factor;
|
||||
const newValue = Math.sqrt(newArea);
|
||||
let delta = Math.sqrt(newArea) - currentRadius;
|
||||
// gradio seems to have a minimum brush size step of 1
|
||||
if (Math.abs(delta) < 1) {
|
||||
delta = delta > 0 ? 1 : -1;
|
||||
}
|
||||
const newValue = currentRadius + delta;
|
||||
input.value = Math.min(Math.max(newValue, 0), maxValue);
|
||||
}
|
||||
input.dispatchEvent(new Event("change"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue