mirror of
https://github.com/openvinotoolkit/stable-diffusion-webui.git
synced 2024-12-15 07:03:06 +03:00
fixing the copy/paste function, correct code
This commit is contained in:
parent
8a07c59baa
commit
8519d52ef5
@ -608,29 +608,34 @@ onUiLoaded(async() => {
|
|||||||
|
|
||||||
// Handle keydown events
|
// Handle keydown events
|
||||||
function handleKeyDown(event) {
|
function handleKeyDown(event) {
|
||||||
|
// Disable key locks to make pasting from the buffer work correctly
|
||||||
|
if ((event.ctrlKey && event.code === 'KeyV') || event.code === "F5") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// before activating shortcut, ensure user is not actively typing in an input field
|
// before activating shortcut, ensure user is not actively typing in an input field
|
||||||
if(event.target.nodeName === 'TEXTAREA' || event.target.nodeName === 'INPUT') {
|
if (event.target.nodeName === 'TEXTAREA' || event.target.nodeName === 'INPUT') {
|
||||||
event.preventDefault;
|
return;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
const hotkeyActions = {
|
|
||||||
[hotkeysConfig.canvas_hotkey_reset]: resetZoom,
|
|
||||||
[hotkeysConfig.canvas_hotkey_overlap]: toggleOverlap,
|
|
||||||
[hotkeysConfig.canvas_hotkey_fullscreen]: fitToScreen
|
|
||||||
};
|
|
||||||
|
|
||||||
const action = hotkeyActions[event.code];
|
const hotkeyActions = {
|
||||||
if (action) {
|
[hotkeysConfig.canvas_hotkey_reset]: resetZoom,
|
||||||
event.preventDefault();
|
[hotkeysConfig.canvas_hotkey_overlap]: toggleOverlap,
|
||||||
action(event);
|
[hotkeysConfig.canvas_hotkey_fullscreen]: fitToScreen
|
||||||
}
|
};
|
||||||
|
|
||||||
if (
|
const action = hotkeyActions[event.code];
|
||||||
isModifierKey(event, hotkeysConfig.canvas_hotkey_zoom) ||
|
if (action) {
|
||||||
isModifierKey(event, hotkeysConfig.canvas_hotkey_adjust)
|
event.preventDefault();
|
||||||
) {
|
action(event);
|
||||||
event.preventDefault();
|
}
|
||||||
}
|
|
||||||
|
if (
|
||||||
|
isModifierKey(event, hotkeysConfig.canvas_hotkey_zoom) ||
|
||||||
|
isModifierKey(event, hotkeysConfig.canvas_hotkey_adjust)
|
||||||
|
) {
|
||||||
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,16 +697,22 @@ onUiLoaded(async() => {
|
|||||||
|
|
||||||
// Handle the move event for pan functionality. Updates the panX and panY variables and applies the new transform to the target element.
|
// Handle the move event for pan functionality. Updates the panX and panY variables and applies the new transform to the target element.
|
||||||
function handleMoveKeyDown(e) {
|
function handleMoveKeyDown(e) {
|
||||||
|
|
||||||
|
// Disable key locks to make pasting from the buffer work correctly
|
||||||
|
if ((e.ctrlKey && e.code === 'KeyV') || e.code === "F5") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// before activating shortcut, ensure user is not actively typing in an input field
|
||||||
|
if (e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'INPUT') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.code === hotkeysConfig.canvas_hotkey_move) {
|
if (e.code === hotkeysConfig.canvas_hotkey_move) {
|
||||||
// before activating shortcut, ensure user is not actively typing in an input field
|
if (!e.ctrlKey && !e.metaKey && isKeyDownHandlerAttached) {
|
||||||
if(e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'INPUT') {
|
e.preventDefault();
|
||||||
event.preventDefault;
|
document.activeElement.blur();
|
||||||
} else {
|
isMoving = true;
|
||||||
if (!e.ctrlKey && !e.metaKey && isKeyDownHandlerAttached) {
|
|
||||||
e.preventDefault();
|
|
||||||
document.activeElement.blur();
|
|
||||||
isMoving = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user