mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-06 15:15:05 +08:00
limit the minimum delta to 1
This commit is contained in:
parent
356339eff2
commit
e009f586a2
@ -483,7 +483,12 @@ onUiLoaded(async() => {
|
|||||||
const currentRadius = parseFloat(input.value);
|
const currentRadius = parseFloat(input.value);
|
||||||
const currentArea = currentRadius ** 2;
|
const currentArea = currentRadius ** 2;
|
||||||
const newArea = currentArea * brush_factor;
|
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.value = Math.min(Math.max(newValue, 0), maxValue);
|
||||||
}
|
}
|
||||||
input.dispatchEvent(new Event("change"));
|
input.dispatchEvent(new Event("change"));
|
||||||
|
Loading…
Reference in New Issue
Block a user