From 2a7e668976518ac72cd4cfa5057861e1b4f71bfd Mon Sep 17 00:00:00 2001 From: Laurenz Reinthaler <47503977+Schweini07@users.noreply.github.com> Date: Wed, 23 Dec 2020 19:41:42 +0100 Subject: [PATCH] Add Pan Tool (#399) --- assets/graphics/cursor_icons/pan_cursor.png | Bin 0 -> 234 bytes .../cursor_icons/pan_cursor.png.import | 13 ++++++ assets/graphics/dark_themes/tools/pan.png | Bin 0 -> 232 bytes .../graphics/dark_themes/tools/pan.png.import | 34 +++++++++++++++ assets/graphics/dark_themes/tools/pan_l.png | Bin 0 -> 307 bytes .../dark_themes/tools/pan_l.png.import | 34 +++++++++++++++ assets/graphics/dark_themes/tools/pan_l_r.png | Bin 0 -> 327 bytes .../dark_themes/tools/pan_l_r.png.import | 34 +++++++++++++++ assets/graphics/dark_themes/tools/pan_r.png | Bin 0 -> 285 bytes .../dark_themes/tools/pan_r.png.import | 34 +++++++++++++++ assets/graphics/light_themes/tools/pan.png | Bin 0 -> 232 bytes .../light_themes/tools/pan.png.import | 34 +++++++++++++++ assets/graphics/light_themes/tools/pan_l.png | Bin 0 -> 306 bytes .../light_themes/tools/pan_l.png.import | 34 +++++++++++++++ .../graphics/light_themes/tools/pan_l_r.png | Bin 0 -> 324 bytes .../light_themes/tools/pan_l_r.png.import | 34 +++++++++++++++ assets/graphics/light_themes/tools/pan_r.png | Bin 0 -> 283 bytes .../light_themes/tools/pan_r.png.import | 34 +++++++++++++++ project.godot | 10 +++++ src/Autoload/Global.gd | 5 +++ src/Autoload/Tools.gd | 3 +- src/Tools/Pan.gd | 14 ++++++ src/Tools/Pan.tscn | 22 ++++++++++ src/UI/ToolButtons.gd | 1 + src/UI/UI.tscn | 41 +++++++++++++----- 25 files changed, 369 insertions(+), 12 deletions(-) create mode 100644 assets/graphics/cursor_icons/pan_cursor.png create mode 100644 assets/graphics/cursor_icons/pan_cursor.png.import create mode 100644 assets/graphics/dark_themes/tools/pan.png create mode 100644 assets/graphics/dark_themes/tools/pan.png.import create mode 100644 assets/graphics/dark_themes/tools/pan_l.png create mode 100644 assets/graphics/dark_themes/tools/pan_l.png.import create mode 100644 assets/graphics/dark_themes/tools/pan_l_r.png create mode 100644 assets/graphics/dark_themes/tools/pan_l_r.png.import create mode 100644 assets/graphics/dark_themes/tools/pan_r.png create mode 100644 assets/graphics/dark_themes/tools/pan_r.png.import create mode 100644 assets/graphics/light_themes/tools/pan.png create mode 100644 assets/graphics/light_themes/tools/pan.png.import create mode 100644 assets/graphics/light_themes/tools/pan_l.png create mode 100644 assets/graphics/light_themes/tools/pan_l.png.import create mode 100644 assets/graphics/light_themes/tools/pan_l_r.png create mode 100644 assets/graphics/light_themes/tools/pan_l_r.png.import create mode 100644 assets/graphics/light_themes/tools/pan_r.png create mode 100644 assets/graphics/light_themes/tools/pan_r.png.import create mode 100644 src/Tools/Pan.gd create mode 100644 src/Tools/Pan.tscn diff --git a/assets/graphics/cursor_icons/pan_cursor.png b/assets/graphics/cursor_icons/pan_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..5133ed1f34661676f4f0e32e9b57b040850d9313 GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fjKx9jP7LeL$-D$|mUy~2hFJ8T zof61*K!L;gblwY3+ehDw#a$(io=NfjQ&g+W%2>DHv)z=I)@xCW3`<2$9dD4&5N7T_ zAUvftSd_V;OX-Uo%MGR$*2siipY!E-^Jbd!Wc5#!w hiFsRcu4CYx=$aK|MpzS^3!=S#BA|dh%Y=`=4q> ep5^mhvC7$2!*R} zvyR+n+MxBBZtgI+^8ND`yU+KeHCr^8R#x(T zEMqtq!~F4X>W|w%_0f52l@=`xk=0=c&kB;A`hso2@=D$o&+@}^iusI8b_qgpm!$3e zeKjMFhv_&N{`q;smt|4m`I0v?H#6*2^m^tnjfu}`_2Mr)^IPf}3f+(FvtF(I>ZY*N z$%85ST+2&coU5JqoU-^t#1>_7e0^B5Va+%GEmchM202^Ot@d9AdYr-2)z4*}Q$iB} D5VCWQ literal 0 HcmV?d00001 diff --git a/assets/graphics/dark_themes/tools/pan_l.png.import b/assets/graphics/dark_themes/tools/pan_l.png.import new file mode 100644 index 000000000..6eba041ac --- /dev/null +++ b/assets/graphics/dark_themes/tools/pan_l.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pan_l.png-b41dc366bfe40e2e8824f0edaf36bda5.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/dark_themes/tools/pan_l.png" +dest_files=[ "res://.import/pan_l.png-b41dc366bfe40e2e8824f0edaf36bda5.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/graphics/dark_themes/tools/pan_l_r.png b/assets/graphics/dark_themes/tools/pan_l_r.png new file mode 100644 index 0000000000000000000000000000000000000000..d685f9f16024ff9101557b7737f52e2512e67d8a GIT binary patch literal 327 zcmV-N0l5B&P)Px$0ZBwbR9J=Wm%R;xFc5{GLk6LBnH7-IMq-F8kpZ#*B|{)FKvqaeOP7WfqNFl1 zaQyhr!3oN%FtYVN-TCaZ0svg^FEI6d9JxyoWsOo2b147->_n?QNCZ&m8fB7)0Vs6c zeoG)&0Jgal!WqDrr&ZkkJKfG~2v!7a^FGAK0Vs0`#BZ13wgC!VljY{BGRY^ag9M;T zjjOp59RT<=Ujos&4Sj^%1qk?pO}MuQX%#!Az|3880GaUj=MExZjD4nK%$x-94KZa7 z^in`UNHv$9;G6Id!0w1Bt=19w>Px#*GWV{R9J=Wm(2}>Fbqb&lodJ=160Zo96Jq1hOoo{oro2x^kk&wht_c*AmuxQ z-jid4W1!6Yd3U+*cH?49O#uM7X$7=VRe*>b06bp9@d6Cz3oj;KIv)N=D{L<516@P8z}ASFsJ5du!o zgh81lMIR9<~w#|GM2hx00000NkvXXu0mjfBye#I literal 0 HcmV?d00001 diff --git a/assets/graphics/dark_themes/tools/pan_r.png.import b/assets/graphics/dark_themes/tools/pan_r.png.import new file mode 100644 index 000000000..e2375cab4 --- /dev/null +++ b/assets/graphics/dark_themes/tools/pan_r.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pan_r.png-20236549f88dc08294ac0f07e3201d2d.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/dark_themes/tools/pan_r.png" +dest_files=[ "res://.import/pan_r.png-20236549f88dc08294ac0f07e3201d2d.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/graphics/light_themes/tools/pan.png b/assets/graphics/light_themes/tools/pan.png new file mode 100644 index 0000000000000000000000000000000000000000..e529aecddd0c1f00171a339c1dad75615f6204a7 GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}i#%N%Ln2z= zP74%jP~dP`IlIWHKP&!hhStlbNa5e1y&L@xG@baGYFM1|Y(?kB%rlpN3owarSFPNd z&64DPHhA-ADb3>s2d>6cnZ=6va-<#z;=91IVMV_G94&{pD;DmuUc}n4w36Q?EotH> zL4`%)CW#9tKHD4-o#OC0cKVsiHPx#>`6pHR9J=Wm)#Y@APj{s99MAwN6G>Y-~bN50*vGU9i~1}5z-%$w5Z4X)I;Ii zuL*(F0RZlg5mMbQPP`U?SD72g_cT`n&=5dGstAe!Xb7)o1%wD7H`hWm10?f!zD{E? zMkj?3MIbjXA$AAg%ry|-U5396Kto{5tyM%cE>#B$z?GU*Yb9C%SekEvaQSU$5%Lxw z-~%?HEBk?#6ijnB96%}j<=iR)$=EU-bLK37HN=uR0G#F)T2;YXdb)4IKY+L+V&5Ir z5n1+x)j=c$01oVky7q(|gwz}mrr=HLpVQ9r+Aq-R2?Tm@9;~51J^%m!07*qoM6N<$ Eg57L$yZ`_I literal 0 HcmV?d00001 diff --git a/assets/graphics/light_themes/tools/pan_l.png.import b/assets/graphics/light_themes/tools/pan_l.png.import new file mode 100644 index 000000000..d184106db --- /dev/null +++ b/assets/graphics/light_themes/tools/pan_l.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pan_l.png-0d95c9955d31e2ab2a170dbd801211fa.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/light_themes/tools/pan_l.png" +dest_files=[ "res://.import/pan_l.png-0d95c9955d31e2ab2a170dbd801211fa.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/graphics/light_themes/tools/pan_l_r.png b/assets/graphics/light_themes/tools/pan_l_r.png new file mode 100644 index 0000000000000000000000000000000000000000..f992c491a8f537bdd0bea801e8e10430a1695481 GIT binary patch literal 324 zcmV-K0lWT*P)Px#{z*hZR9J=Wm%RWipm&?xD)^YR-)YsB?7Qzj;v1O0N65b zo+S`00AE}R5e(qOFWW=&?!39OAy^&o#oG`c2cX0y5Wj81WdqnUC+!wmS)C5Lg9MPx#)k#D_R9J=Wmpu-HFbqb&l(l28#UU)QavIi3IYh6;$Xcb7k(wV`$AN&9Zw9?5 z#|FnhnfLf`x$kzHUo0mViX%V8T)Od void: + Global.camera.drag = true + Global.camera2.drag = true + + +func draw_move(_position : Vector2) -> void: + pass + + +func draw_end(_position : Vector2) -> void: + Global.camera.drag = false + Global.camera2.drag = false diff --git a/src/Tools/Pan.tscn b/src/Tools/Pan.tscn new file mode 100644 index 000000000..2ad51df73 --- /dev/null +++ b/src/Tools/Pan.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://src/Tools/Base.tscn" type="PackedScene" id=1] +[ext_resource path="res://src/Tools/Pan.gd" type="Script" id=2] + +[node name="ToolOptions" instance=ExtResource( 1 )] +script = ExtResource( 2 ) + +[node name="PixelPerfect" parent="." index="1"] +visible = false +margin_top = 126.0 +margin_bottom = 150.0 + +[node name="EmptySpacer" parent="." index="2"] +visible = false +margin_top = 126.0 +margin_bottom = 138.0 + +[node name="Mirror" parent="." index="3"] +visible = false +margin_top = 126.0 +margin_bottom = 143.0 diff --git a/src/UI/ToolButtons.gd b/src/UI/ToolButtons.gd index d840f9866..f3dd37648 100644 --- a/src/UI/ToolButtons.gd +++ b/src/UI/ToolButtons.gd @@ -5,6 +5,7 @@ extends VBoxContainer onready var tools := [ [$RectSelect, "rectangle_select"], [$Zoom, "zoom"], + [$Pan, "pan"], [$ColorPicker, "colorpicker"], [$Pencil, "pencil"], [$Eraser, "eraser"], diff --git a/src/UI/UI.tscn b/src/UI/UI.tscn index 63f16610f..2f137297a 100644 --- a/src/UI/UI.tscn +++ b/src/UI/UI.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=26 format=2] +[gd_scene load_steps=27 format=2] [ext_resource path="res://src/UI/ToolButtons.gd" type="Script" id=1] [ext_resource path="res://src/UI/Canvas/CanvasPreview.tscn" type="PackedScene" id=2] @@ -21,6 +21,7 @@ [ext_resource path="res://src/UI/Canvas/Canvas.tscn" type="PackedScene" id=19] [ext_resource path="res://src/Palette/PalettePanelContainer.tscn" type="PackedScene" id=20] [ext_resource path="res://assets/graphics/dark_themes/tools/zoom.png" type="Texture" id=21] +[ext_resource path="res://assets/graphics/dark_themes/tools/pan.png" type="Texture" id=22] [ext_resource path="res://src/UI/ViewportContainer.gd" type="Script" id=23] [sub_resource type="ShaderMaterial" id=1] @@ -83,7 +84,7 @@ __meta__ = { margin_left = 7.0 margin_top = 7.0 margin_right = 39.0 -margin_bottom = 255.0 +margin_bottom = 291.0 size_flags_horizontal = 4 size_flags_vertical = 0 script = ExtResource( 1 ) @@ -126,7 +127,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="ColorPicker" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ +[node name="Pan" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ "UIButtons", ]] margin_top = 72.0 @@ -136,6 +137,24 @@ rect_min_size = Vector2( 32, 32 ) mouse_default_cursor_shape = 2 button_mask = 3 +[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/Pan"] +margin_right = 32.0 +margin_bottom = 32.0 +texture = ExtResource( 22 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ColorPicker" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ +"UIButtons", +]] +margin_top = 108.0 +margin_right = 32.0 +margin_bottom = 140.0 +rect_min_size = Vector2( 32, 32 ) +mouse_default_cursor_shape = 2 +button_mask = 3 + [node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/ColorPicker"] margin_right = 32.0 margin_bottom = 32.0 @@ -147,9 +166,9 @@ __meta__ = { [node name="Pencil" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ "UIButtons", ]] -margin_top = 108.0 +margin_top = 144.0 margin_right = 32.0 -margin_bottom = 140.0 +margin_bottom = 176.0 rect_min_size = Vector2( 32, 32 ) mouse_default_cursor_shape = 2 button_mask = 3 @@ -165,9 +184,9 @@ __meta__ = { [node name="Eraser" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ "UIButtons", ]] -margin_top = 144.0 +margin_top = 180.0 margin_right = 32.0 -margin_bottom = 176.0 +margin_bottom = 212.0 rect_min_size = Vector2( 32, 32 ) mouse_default_cursor_shape = 2 button_mask = 3 @@ -183,9 +202,9 @@ __meta__ = { [node name="Bucket" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ "UIButtons", ]] -margin_top = 180.0 +margin_top = 216.0 margin_right = 32.0 -margin_bottom = 212.0 +margin_bottom = 248.0 rect_min_size = Vector2( 32, 32 ) mouse_default_cursor_shape = 2 button_mask = 3 @@ -201,9 +220,9 @@ __meta__ = { [node name="LightenDarken" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ "UIButtons", ]] -margin_top = 216.0 +margin_top = 252.0 margin_right = 32.0 -margin_bottom = 248.0 +margin_bottom = 284.0 rect_min_size = Vector2( 32, 32 ) mouse_default_cursor_shape = 2 button_mask = 3