diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/icons/icon_tool_pan.png | bin | 0 -> 1555 bytes | |||
-rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.cpp | 15 | ||||
-rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.h | 3 |
3 files changed, 15 insertions, 3 deletions
diff --git a/tools/editor/icons/icon_tool_pan.png b/tools/editor/icons/icon_tool_pan.png Binary files differnew file mode 100644 index 0000000000..5c078a7b1c --- /dev/null +++ b/tools/editor/icons/icon_tool_pan.png diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 0d275557c3..5f87b791f7 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -54,7 +54,7 @@ void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { void CanvasItemEditor::_tool_select(int p_index) { - ToolButton *tb[TOOL_MAX]={select_button,move_button,rotate_button}; + ToolButton *tb[TOOL_MAX]={select_button,move_button,rotate_button,pan_button}; for(int i=0;i<TOOL_MAX;i++) { tb[i]->set_pressed(i==p_index); @@ -665,7 +665,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { //if (!canvas_items.size()) // return; - if (b.button_index!=BUTTON_LEFT || Input::get_singleton()->is_key_pressed(KEY_SPACE)) + if (tool==TOOL_PAN || b.button_index!=BUTTON_LEFT || Input::get_singleton()->is_key_pressed(KEY_SPACE)) return; if (!b.pressed) { @@ -962,7 +962,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { if (drag==DRAG_NONE) { - if (m.button_mask&BUTTON_MASK_MIDDLE || (m.button_mask&BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE))) { + if ( (m.button_mask&BUTTON_MASK_LEFT && tool == TOOL_PAN) || m.button_mask&BUTTON_MASK_MIDDLE || (m.button_mask&BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE))) { h_scroll->set_val( h_scroll->get_val() - m.relative_x/zoom); v_scroll->set_val( v_scroll->get_val() - m.relative_y/zoom); @@ -1424,6 +1424,7 @@ void CanvasItemEditor::_notification(int p_what) { select_button->set_icon( get_icon("ToolSelect","EditorIcons")); move_button->set_icon( get_icon("ToolMove","EditorIcons")); rotate_button->set_icon( get_icon("ToolRotate","EditorIcons")); + pan_button->set_icon( get_icon("ToolPan", "EditorIcons")); select_handle=get_icon("EditorHandle","EditorIcons"); lock_button->set_icon(get_icon("Lock","EditorIcons")); unlock_button->set_icon(get_icon("Unlock","EditorIcons")); @@ -2236,6 +2237,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { hb->add_child(memnew(VSeparator)); + pan_button = memnew( ToolButton ); + pan_button->set_toggle_mode(true); + hb->add_child(pan_button); + pan_button->connect("pressed",this,"_tool_select",make_binds(TOOL_PAN)); + pan_button->set_tooltip("Pan Mode"); + + hb->add_child(memnew(VSeparator)); + lock_button = memnew( ToolButton ); hb->add_child(lock_button); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h index 256847e8ef..3d9b50c01c 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.h +++ b/tools/editor/plugins/canvas_item_editor_plugin.h @@ -69,6 +69,7 @@ class CanvasItemEditor : public VBoxContainer { TOOL_SELECT, TOOL_MOVE, TOOL_ROTATE, + TOOL_PAN, TOOL_MAX }; @@ -178,6 +179,8 @@ class CanvasItemEditor : public VBoxContainer { ToolButton *move_button; ToolButton *rotate_button; + ToolButton *pan_button; + ToolButton *lock_button; ToolButton *unlock_button; |