mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-02-28 11:04:54 +08:00
Canvas: Undo hotkey
This commit is contained in:
parent
4e808fbef4
commit
356339eff2
@ -226,6 +226,7 @@ onUiLoaded(async() => {
|
||||
canvas_show_tooltip: true,
|
||||
canvas_auto_expand: true,
|
||||
canvas_blur_prompt: false,
|
||||
canvas_hotkey_undo: "KeyZ",
|
||||
};
|
||||
|
||||
const functionMap = {
|
||||
@ -321,6 +322,7 @@ onUiLoaded(async() => {
|
||||
action: "Adjust brush size",
|
||||
keySuffix: " + wheel"
|
||||
},
|
||||
{configKey: "canvas_hotkey_undo", action: "Undo brush stroke"},
|
||||
{configKey: "canvas_hotkey_reset", action: "Reset zoom"},
|
||||
{
|
||||
configKey: "canvas_hotkey_fullscreen",
|
||||
@ -489,6 +491,11 @@ onUiLoaded(async() => {
|
||||
}
|
||||
}
|
||||
|
||||
// Undo the last brush stroke by clicking the undo button
|
||||
function undoBrushStroke() {
|
||||
gradioApp().querySelector(`${elemId} button[aria-label='Undo']`).click();
|
||||
}
|
||||
|
||||
// Reset zoom when uploading a new image
|
||||
const fileInput = gradioApp().querySelector(
|
||||
`${elemId} input[type="file"][accept="image/*"].svelte-116rqfv`
|
||||
@ -708,7 +715,8 @@ onUiLoaded(async() => {
|
||||
[hotkeysConfig.canvas_hotkey_overlap]: toggleOverlap,
|
||||
[hotkeysConfig.canvas_hotkey_fullscreen]: fitToScreen,
|
||||
[hotkeysConfig.canvas_hotkey_shrink_brush]: () => adjustBrushSize(elemId, 10),
|
||||
[hotkeysConfig.canvas_hotkey_grow_brush]: () => adjustBrushSize(elemId, -10)
|
||||
[hotkeysConfig.canvas_hotkey_grow_brush]: () => adjustBrushSize(elemId, -10),
|
||||
[hotkeysConfig.canvas_hotkey_undo]: undoBrushStroke
|
||||
};
|
||||
|
||||
const action = hotkeyActions[event.code];
|
||||
|
@ -7,6 +7,7 @@ shared.options_templates.update(shared.options_section(('canvas_hotkey', "Canvas
|
||||
"canvas_hotkey_shrink_brush": shared.OptionInfo("Q", "Shrink the brush size"),
|
||||
"canvas_hotkey_grow_brush": shared.OptionInfo("W", "Enlarge the brush size"),
|
||||
"canvas_hotkey_move": shared.OptionInfo("F", "Moving the canvas").info("To work correctly in firefox, turn off 'Automatically search the page text when typing' in the browser settings"),
|
||||
"canvas_hotkey_undo": shared.OptionInfo("Z", "Undo brush stroke"),
|
||||
"canvas_hotkey_fullscreen": shared.OptionInfo("S", "Fullscreen Mode, maximizes the picture so that it fits into the screen and stretches it to its full width "),
|
||||
"canvas_hotkey_reset": shared.OptionInfo("R", "Reset zoom and canvas position"),
|
||||
"canvas_hotkey_overlap": shared.OptionInfo("O", "Toggle overlap").info("Technical button, needed for testing"),
|
||||
|
Loading…
Reference in New Issue
Block a user