diff --git a/assets/graphics/cursor_icons/pan_cursor.png b/assets/graphics/cursor_icons/pan_cursor.png new file mode 100644 index 000000000..5133ed1f3 Binary files /dev/null and b/assets/graphics/cursor_icons/pan_cursor.png differ diff --git a/assets/graphics/cursor_icons/pan_cursor.png.import b/assets/graphics/cursor_icons/pan_cursor.png.import new file mode 100644 index 000000000..74b82cccf --- /dev/null +++ b/assets/graphics/cursor_icons/pan_cursor.png.import @@ -0,0 +1,13 @@ +[remap] + +importer="image" +type="Image" +path="res://.import/pan_cursor.png-d26b4ee611af84aa6cee0ba9a3bf0b20.image" + +[deps] + +source_file="res://assets/graphics/cursor_icons/pan_cursor.png" +dest_files=[ "res://.import/pan_cursor.png-d26b4ee611af84aa6cee0ba9a3bf0b20.image" ] + +[params] + diff --git a/assets/graphics/dark_themes/tools/pan.png b/assets/graphics/dark_themes/tools/pan.png new file mode 100644 index 000000000..fd6686d11 Binary files /dev/null and b/assets/graphics/dark_themes/tools/pan.png differ diff --git a/assets/graphics/dark_themes/tools/pan.png.import b/assets/graphics/dark_themes/tools/pan.png.import new file mode 100644 index 000000000..b2fc827a9 --- /dev/null +++ b/assets/graphics/dark_themes/tools/pan.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pan.png-a44bb7863ccaae49a9c7019dae7a87d0.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/dark_themes/tools/pan.png" +dest_files=[ "res://.import/pan.png-a44bb7863ccaae49a9c7019dae7a87d0.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.png b/assets/graphics/dark_themes/tools/pan_l.png new file mode 100644 index 000000000..53d0d9385 Binary files /dev/null and b/assets/graphics/dark_themes/tools/pan_l.png differ 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 000000000..d685f9f16 Binary files /dev/null and b/assets/graphics/dark_themes/tools/pan_l_r.png differ diff --git a/assets/graphics/dark_themes/tools/pan_l_r.png.import b/assets/graphics/dark_themes/tools/pan_l_r.png.import new file mode 100644 index 000000000..2e05a3371 --- /dev/null +++ b/assets/graphics/dark_themes/tools/pan_l_r.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pan_l_r.png-c60ecf8203c7de6505e77d5a16b6cb27.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/dark_themes/tools/pan_l_r.png" +dest_files=[ "res://.import/pan_l_r.png-c60ecf8203c7de6505e77d5a16b6cb27.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_r.png b/assets/graphics/dark_themes/tools/pan_r.png new file mode 100644 index 000000000..1e5251563 Binary files /dev/null and b/assets/graphics/dark_themes/tools/pan_r.png differ 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 000000000..e529aecdd Binary files /dev/null and b/assets/graphics/light_themes/tools/pan.png differ diff --git a/assets/graphics/light_themes/tools/pan.png.import b/assets/graphics/light_themes/tools/pan.png.import new file mode 100644 index 000000000..759fcd24b --- /dev/null +++ b/assets/graphics/light_themes/tools/pan.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pan.png-3990c6552c218d35dd933ec4c072de6d.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/light_themes/tools/pan.png" +dest_files=[ "res://.import/pan.png-3990c6552c218d35dd933ec4c072de6d.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.png b/assets/graphics/light_themes/tools/pan_l.png new file mode 100644 index 000000000..4ed9b4abf Binary files /dev/null and b/assets/graphics/light_themes/tools/pan_l.png differ 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 000000000..f992c491a Binary files /dev/null and b/assets/graphics/light_themes/tools/pan_l_r.png differ diff --git a/assets/graphics/light_themes/tools/pan_l_r.png.import b/assets/graphics/light_themes/tools/pan_l_r.png.import new file mode 100644 index 000000000..82faaf82d --- /dev/null +++ b/assets/graphics/light_themes/tools/pan_l_r.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pan_l_r.png-7508784c786bf5678e35f9020a10105e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/light_themes/tools/pan_l_r.png" +dest_files=[ "res://.import/pan_l_r.png-7508784c786bf5678e35f9020a10105e.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_r.png b/assets/graphics/light_themes/tools/pan_r.png new file mode 100644 index 000000000..8e24e94cd Binary files /dev/null and b/assets/graphics/light_themes/tools/pan_r.png differ diff --git a/assets/graphics/light_themes/tools/pan_r.png.import b/assets/graphics/light_themes/tools/pan_r.png.import new file mode 100644 index 000000000..e6ccde98e --- /dev/null +++ b/assets/graphics/light_themes/tools/pan_r.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pan_r.png-7c0992cd5258a750b8158036bb8a060c.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/light_themes/tools/pan_r.png" +dest_files=[ "res://.import/pan_r.png-7c0992cd5258a750b8158036bb8a060c.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/project.godot b/project.godot index 4fed3a84a..579c2d8f6 100644 --- a/project.godot +++ b/project.godot @@ -419,6 +419,16 @@ mirror_view={ "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"unicode":0,"echo":false,"script":null) ] } +left_pan_tool={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"unicode":0,"echo":false,"script":null) + ] +} +right_pan_tool={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":true,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"unicode":0,"echo":false,"script":null) + ] +} [locale] diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index 4f65ca04c..f9e27c1f9 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -452,6 +452,11 @@ Press %s to move the content""") % [InputMap.get_action_list("left_rectangle_sel %s for left mouse button %s for right mouse button""") % [InputMap.get_action_list("left_zoom_tool")[0].as_text(), InputMap.get_action_list("right_zoom_tool")[0].as_text()] + var pan_tool : BaseButton = find_node_by_name(root, "Pan") + pan_tool.hint_tooltip = tr("""Pan + +%s for left mouse button +%s for right mouse button""") % [InputMap.get_action_list("left_pan_tool")[0].as_text(), InputMap.get_action_list("right_pan_tool")[0].as_text()] var color_picker : BaseButton = find_node_by_name(root, "ColorPicker") color_picker.hint_tooltip = tr("""Color Picker diff --git a/src/Autoload/Tools.gd b/src/Autoload/Tools.gd index e9b98e6d5..394bf923d 100644 --- a/src/Autoload/Tools.gd +++ b/src/Autoload/Tools.gd @@ -40,7 +40,8 @@ signal color_changed(color, button) var _tools = { "RectSelect" : "res://src/Tools/RectSelect.tscn", - "Zoom" : "res://src/Tools/Zoom.tscn", + "Zoom" : "res://src/Tools/Pan.tscn", + "Pan" : "res://src/Tools/Pan.tscn", "ColorPicker" : "res://src/Tools/ColorPicker.tscn", "Pencil" : "res://src/Tools/Pencil.tscn", "Eraser" : "res://src/Tools/Eraser.tscn", diff --git a/src/Tools/Pan.gd b/src/Tools/Pan.gd new file mode 100644 index 000000000..84e031cb8 --- /dev/null +++ b/src/Tools/Pan.gd @@ -0,0 +1,14 @@ +extends "res://src/Tools/Base.gd" + +func draw_start(_position : Vector2) -> 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