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
8fc6766d
Unverified
Commit
8fc6766d
authored
Jun 03, 2020
by
Rémi Verschelde
Committed by
GitHub
Jun 03, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39165 from Calinou/tilemap-editor-zoom-mouse-wheel
Implement zooming using Ctrl + Mouse wheel in the TileMap editor
parents
1a5d472b
def2059d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
tile_map_editor_plugin.cpp
editor/plugins/tile_map_editor_plugin.cpp
+16
-0
tile_map_editor_plugin.h
editor/plugins/tile_map_editor_plugin.h
+1
-0
No files found.
editor/plugins/tile_map_editor_plugin.cpp
View file @
8fc6766d
...
...
@@ -194,6 +194,21 @@ void TileMapEditor::_palette_multi_selected(int index, bool selected) {
_update_palette
();
}
void
TileMapEditor
::
_palette_input
(
const
Ref
<
InputEvent
>
&
p_event
)
{
const
Ref
<
InputEventMouseButton
>
mb
=
p_event
;
// Zoom in/out using Ctrl + mouse wheel.
if
(
mb
.
is_valid
()
&&
mb
->
is_pressed
()
&&
mb
->
get_command
())
{
if
(
mb
->
is_pressed
()
&&
mb
->
get_button_index
()
==
BUTTON_WHEEL_UP
)
{
size_slider
->
set_value
(
size_slider
->
get_value
()
+
0.2
);
}
if
(
mb
->
is_pressed
()
&&
mb
->
get_button_index
()
==
BUTTON_WHEEL_DOWN
)
{
size_slider
->
set_value
(
size_slider
->
get_value
()
-
0.2
);
}
}
}
void
TileMapEditor
::
_canvas_mouse_enter
()
{
mouse_over
=
true
;
CanvasItemEditor
::
get_singleton
()
->
update_viewport
();
...
...
@@ -1913,6 +1928,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
palette
->
add_theme_constant_override
(
"vseparation"
,
8
*
EDSCALE
);
palette
->
connect
(
"item_selected"
,
callable_mp
(
this
,
&
TileMapEditor
::
_palette_selected
));
palette
->
connect
(
"multi_selected"
,
callable_mp
(
this
,
&
TileMapEditor
::
_palette_multi_selected
));
palette
->
connect
(
"gui_input"
,
callable_mp
(
this
,
&
TileMapEditor
::
_palette_input
));
palette_container
->
add_child
(
palette
);
// Add message for when no texture is selected.
...
...
editor/plugins/tile_map_editor_plugin.h
View file @
8fc6766d
...
...
@@ -182,6 +182,7 @@ class TileMapEditor : public VBoxContainer {
void
_menu_option
(
int
p_option
);
void
_palette_selected
(
int
index
);
void
_palette_multi_selected
(
int
index
,
bool
selected
);
void
_palette_input
(
const
Ref
<
InputEvent
>
&
p_event
);
Dictionary
_create_cell_dictionary
(
int
tile
,
bool
flip_x
,
bool
flip_y
,
bool
transpose
,
Vector2
autotile_coord
);
void
_start_undo
(
const
String
&
p_action
);
...
...
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