Added the ability to change the % of change in brush size

Gradio-v4-updates
Danil Boldyrev 2023-12-12 23:26:16 +03:00
parent 36762c013e
commit 26450143c5
3 changed files with 9 additions and 3 deletions

View File

@ -89,6 +89,8 @@ In transparency mode, you can paint but the effect will not be what you expect,
8. In the settings you can turn off the tooltip and functionality that you do not need
9. You can adjust the size of the maximum size of the brush and the ability to change the % by which it is changed
## Known bugs:
1. If a white image appears when you cancel on the Hotkey, press the cancel hotkey again and the image will return.
@ -199,6 +201,8 @@ Canvas Zoom поддерживает интеграцию с другими по
8. В настройках вы можете отключить подсказку и функционал которым вы не пользуетесь
9. Вы можете настроить размер максимального размера кисти и возможность изменения %, на который он изменяется
## Известные баги:
1. Если при отмене на горячей клавише появляется белое изображение, нажмите горячую клавишу отмены еще раз, и изображение вернется.

View File

@ -322,6 +322,7 @@ onUiLoaded(async () => {
canvas_zoom_add_buttons: false,
canvas_zoom_inpaint_brushcolor: "#000000",
canvas_zoom_transparency_level: 70,
canvas_zoom_brush_size_change: 5,
canvas_zoom_brush_size: 200,
canvas_zoom_disabled_functions: [],
};
@ -1105,8 +1106,8 @@ onUiLoaded(async () => {
[hotkeysConfig.canvas_zoom_hotkey_fill]: fillCanvasWithColor,
[hotkeysConfig.canvas_zoom_hotkey_transparency]: toggleOpacityMode,
[hotkeysConfig.canvas_zoom_hotkey_undo]: undoLastAction,
[hotkeysConfig.canvas_zoom_inc_brush_size]: () => adjustBrushSize(elemId, -5, false),
[hotkeysConfig.canvas_zoom_dec_brush_size]: () => adjustBrushSize(elemId, 5, false),
[hotkeysConfig.canvas_zoom_inc_brush_size]: () => adjustBrushSize(elemId, -hotkeysConfig.canvas_zoom_brush_size_change, false),
[hotkeysConfig.canvas_zoom_dec_brush_size]: () => adjustBrushSize(elemId, hotkeysConfig.canvas_zoom_brush_size_change, false),
};
const action = hotkeyActions[event.code];
@ -1261,7 +1262,7 @@ onUiLoaded(async () => {
if (!isModifierKey(e, hotkeysConfig.canvas_hotkey_adjust)) return;
e.preventDefault();
adjustBrushSize(elemId, e.deltaY);
adjustBrushSize(elemId, e.deltaY, false, hotkeysConfig.canvas_zoom_brush_size_change);
});
/**

View File

@ -23,6 +23,7 @@ shared.options_templates.update(shared.options_section(('canvas_zoom', "Canvas Z
"canvas_auto_expand": shared.OptionInfo(True, "Automatic expansion of an image that does not fit completely within the canvas area, similar to manual S and R entry"),
"canvas_zoom_enable_integration": shared.OptionInfo(True, "Enable integration with ControlNet, Regional Prompter and Latent Couple(Two Shot), Inpaint Anything"),
"canvas_zoom_brush_size": shared.OptionInfo(200, "Increase % of the maximum brush size", gr.Slider, {"minimum": 100, "maximum": 1000, "step": 50}),
"canvas_zoom_brush_size_change": shared.OptionInfo(5, "Percentage at which the brush size changes, the higher the percentage the faster the brush changes its size", gr.Slider, {"minimum": 1, "maximum": 10, "step": 1}),
"canvas_zoom_transparency_level": shared.OptionInfo(70, "Opacity level in inpaint.Works with webui 1.6 otherwise this setting will adjust the transparency in transparency mode from the extension", gr.Slider, {"minimum": 10, "maximum": 100, "step": 5}),
"canvas_zoom_brush_opacity": shared.OptionInfo(False, "Makes the brush the same transparency as the mask"),
# "canvas_zoom_inpaint_prevent_work": shared.OptionInfo(False, "Always prevent inpainting models work on txt2img tab by default"), #TODO