Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
8519d52e
Commit
8519d52e
authored
Jul 02, 2023
by
Danil Boldyrev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing the copy/paste function, correct code
parent
8a07c59b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
28 deletions
+39
-28
extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js
extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js
+39
-28
No files found.
extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js
View file @
8519d52e
...
@@ -608,29 +608,34 @@ onUiLoaded(async() => {
...
@@ -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() => {
...
@@ -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
;
}
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment