summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authormarynate <mary.w.nate@gmail.com>2014-05-17 10:41:04 +0800
committermarynate <mary.w.nate@gmail.com>2014-05-21 09:51:51 +0800
commit9737c02e21202e22da672b546fb64c620aa56f18 (patch)
tree0889fa7769ccddce8d4416e849585e8868e72fbe /tools/editor
parenta364bc437138d359b3105a8370911f0aab2385db (diff)
Add 2d unifrom scale
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 01ca5a1135..0d275557c3 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1058,7 +1058,8 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
Vector2 begin=local_rect.pos;
Vector2 end=local_rect.pos+local_rect.size;
Vector2 minsize = canvas_item->edit_get_minimum_size();
- bool symmetric=m.mod.shift;
+ bool uniform = m.mod.shift;
+ bool symmetric=m.mod.alt;
switch(drag) {
@@ -1078,10 +1079,19 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
} break;
case DRAG_BOTTOM_RIGHT: {
+ if (uniform) {
+ drag_vector.y=drag_vector.x;
+ minsize.y=minsize.x;
+ }
incend(begin.x,end.x,drag_vector.x,minsize.x,symmetric);
incend(begin.y,end.y,drag_vector.y,minsize.y,symmetric);
- } break;
+ } break;
case DRAG_TOP_LEFT: {
+
+ if (uniform) {
+ drag_vector.y=drag_vector.x;
+ minsize.y=minsize.x;
+ }
incbeg(begin.x,end.x,drag_vector.x,minsize.x,symmetric);
incbeg(begin.y,end.y,drag_vector.y,minsize.y,symmetric);
} break;
@@ -1097,12 +1107,20 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
} break;
case DRAG_TOP_RIGHT: {
+ if (uniform) {
+ drag_vector.x=-drag_vector.y;
+ minsize.x=minsize.y;
+ }
incbeg(begin.y,end.y,drag_vector.y,minsize.y,symmetric);
incend(begin.x,end.x,drag_vector.x,minsize.x,symmetric);
} break;
case DRAG_BOTTOM_LEFT: {
+ if (uniform) {
+ drag_vector.x=-drag_vector.y;
+ minsize.x=minsize.y;
+ }
incbeg(begin.x,end.x,drag_vector.x,minsize.x,symmetric);
incend(begin.y,end.y,drag_vector.y,minsize.y,symmetric);
} break;