Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
e773664f
Unverified
Commit
e773664f
authored
Jun 20, 2020
by
Rémi Verschelde
Committed by
GitHub
Jun 20, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39687 from Calinou/2d-editor-shift-horizontal-scroll
Scroll horizontally when holding Shift with Scroll to Pan enabled
parents
ea30d122
84e1c5e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
canvas_item_editor_plugin.cpp
editor/plugins/canvas_item_editor_plugin.cpp
+20
-19
No files found.
editor/plugins/canvas_item_editor_plugin.cpp
View file @
e773664f
...
...
@@ -1207,7 +1207,26 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
bool
CanvasItemEditor
::
_gui_input_zoom_or_pan
(
const
Ref
<
InputEvent
>
&
p_event
,
bool
p_already_accepted
)
{
Ref
<
InputEventMouseButton
>
b
=
p_event
;
if
(
b
.
is_valid
()
&&
!
p_already_accepted
)
{
bool
pan_on_scroll
=
bool
(
EditorSettings
::
get_singleton
()
->
get
(
"editors/2d/scroll_to_pan"
))
&&
!
b
->
get_control
();
const
bool
pan_on_scroll
=
bool
(
EditorSettings
::
get_singleton
()
->
get
(
"editors/2d/scroll_to_pan"
))
&&
!
b
->
get_control
();
if
(
pan_on_scroll
)
{
// Perform horizontal scrolling first so we can check for Shift being held.
if
(
b
->
is_pressed
()
&&
(
b
->
get_button_index
()
==
BUTTON_WHEEL_LEFT
||
(
b
->
get_shift
()
&&
b
->
get_button_index
()
==
BUTTON_WHEEL_UP
)))
{
// Pan left
view_offset
.
x
-=
int
(
EditorSettings
::
get_singleton
()
->
get
(
"editors/2d/pan_speed"
))
/
zoom
*
b
->
get_factor
();
update_viewport
();
return
true
;
}
if
(
b
->
is_pressed
()
&&
(
b
->
get_button_index
()
==
BUTTON_WHEEL_RIGHT
||
(
b
->
get_shift
()
&&
b
->
get_button_index
()
==
BUTTON_WHEEL_DOWN
)))
{
// Pan right
view_offset
.
x
+=
int
(
EditorSettings
::
get_singleton
()
->
get
(
"editors/2d/pan_speed"
))
/
zoom
*
b
->
get_factor
();
update_viewport
();
return
true
;
}
}
if
(
b
->
is_pressed
()
&&
b
->
get_button_index
()
==
BUTTON_WHEEL_DOWN
)
{
// Scroll or pan down
...
...
@@ -1239,24 +1258,6 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
return
true
;
}
if
(
b
->
is_pressed
()
&&
b
->
get_button_index
()
==
BUTTON_WHEEL_LEFT
)
{
// Pan left
if
(
pan_on_scroll
)
{
view_offset
.
x
-=
int
(
EditorSettings
::
get_singleton
()
->
get
(
"editors/2d/pan_speed"
))
/
zoom
*
b
->
get_factor
();
update_viewport
();
return
true
;
}
}
if
(
b
->
is_pressed
()
&&
b
->
get_button_index
()
==
BUTTON_WHEEL_RIGHT
)
{
// Pan right
if
(
pan_on_scroll
)
{
view_offset
.
x
+=
int
(
EditorSettings
::
get_singleton
()
->
get
(
"editors/2d/pan_speed"
))
/
zoom
*
b
->
get_factor
();
update_viewport
();
return
true
;
}
}
if
(
!
panning
)
{
if
(
b
->
is_pressed
()
&&
(
b
->
get_button_index
()
==
BUTTON_MIDDLE
||
...
...
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