1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Add Pan Tool (#399)

This commit is contained in:
Laurenz Reinthaler 2020-12-23 19:41:42 +01:00 committed by GitHub
parent 425b11d4b2
commit 2a7e668976
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 369 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

View file

@ -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]

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

View file

@ -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

View file

@ -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) "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] [locale]

View file

@ -452,6 +452,11 @@ Press %s to move the content""") % [InputMap.get_action_list("left_rectangle_sel
%s for left mouse button %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()] %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") var color_picker : BaseButton = find_node_by_name(root, "ColorPicker")
color_picker.hint_tooltip = tr("""Color Picker color_picker.hint_tooltip = tr("""Color Picker

View file

@ -40,7 +40,8 @@ signal color_changed(color, button)
var _tools = { var _tools = {
"RectSelect" : "res://src/Tools/RectSelect.tscn", "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", "ColorPicker" : "res://src/Tools/ColorPicker.tscn",
"Pencil" : "res://src/Tools/Pencil.tscn", "Pencil" : "res://src/Tools/Pencil.tscn",
"Eraser" : "res://src/Tools/Eraser.tscn", "Eraser" : "res://src/Tools/Eraser.tscn",

14
src/Tools/Pan.gd Normal file
View file

@ -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

22
src/Tools/Pan.tscn Normal file
View file

@ -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

View file

@ -5,6 +5,7 @@ extends VBoxContainer
onready var tools := [ onready var tools := [
[$RectSelect, "rectangle_select"], [$RectSelect, "rectangle_select"],
[$Zoom, "zoom"], [$Zoom, "zoom"],
[$Pan, "pan"],
[$ColorPicker, "colorpicker"], [$ColorPicker, "colorpicker"],
[$Pencil, "pencil"], [$Pencil, "pencil"],
[$Eraser, "eraser"], [$Eraser, "eraser"],

View file

@ -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/ToolButtons.gd" type="Script" id=1]
[ext_resource path="res://src/UI/Canvas/CanvasPreview.tscn" type="PackedScene" id=2] [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/UI/Canvas/Canvas.tscn" type="PackedScene" id=19]
[ext_resource path="res://src/Palette/PalettePanelContainer.tscn" type="PackedScene" id=20] [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/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] [ext_resource path="res://src/UI/ViewportContainer.gd" type="Script" id=23]
[sub_resource type="ShaderMaterial" id=1] [sub_resource type="ShaderMaterial" id=1]
@ -83,7 +84,7 @@ __meta__ = {
margin_left = 7.0 margin_left = 7.0
margin_top = 7.0 margin_top = 7.0
margin_right = 39.0 margin_right = 39.0
margin_bottom = 255.0 margin_bottom = 291.0
size_flags_horizontal = 4 size_flags_horizontal = 4
size_flags_vertical = 0 size_flags_vertical = 0
script = ExtResource( 1 ) script = ExtResource( 1 )
@ -126,7 +127,7 @@ __meta__ = {
"_edit_use_anchors_": false "_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", "UIButtons",
]] ]]
margin_top = 72.0 margin_top = 72.0
@ -136,6 +137,24 @@ rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
button_mask = 3 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"] [node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/ColorPicker"]
margin_right = 32.0 margin_right = 32.0
margin_bottom = 32.0 margin_bottom = 32.0
@ -147,9 +166,9 @@ __meta__ = {
[node name="Pencil" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ [node name="Pencil" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons", "UIButtons",
]] ]]
margin_top = 108.0 margin_top = 144.0
margin_right = 32.0 margin_right = 32.0
margin_bottom = 140.0 margin_bottom = 176.0
rect_min_size = Vector2( 32, 32 ) rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
button_mask = 3 button_mask = 3
@ -165,9 +184,9 @@ __meta__ = {
[node name="Eraser" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ [node name="Eraser" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons", "UIButtons",
]] ]]
margin_top = 144.0 margin_top = 180.0
margin_right = 32.0 margin_right = 32.0
margin_bottom = 176.0 margin_bottom = 212.0
rect_min_size = Vector2( 32, 32 ) rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
button_mask = 3 button_mask = 3
@ -183,9 +202,9 @@ __meta__ = {
[node name="Bucket" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ [node name="Bucket" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons", "UIButtons",
]] ]]
margin_top = 180.0 margin_top = 216.0
margin_right = 32.0 margin_right = 32.0
margin_bottom = 212.0 margin_bottom = 248.0
rect_min_size = Vector2( 32, 32 ) rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
button_mask = 3 button_mask = 3
@ -201,9 +220,9 @@ __meta__ = {
[node name="LightenDarken" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[ [node name="LightenDarken" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons", "UIButtons",
]] ]]
margin_top = 216.0 margin_top = 252.0
margin_right = 32.0 margin_right = 32.0
margin_bottom = 248.0 margin_bottom = 284.0
rect_min_size = Vector2( 32, 32 ) rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
button_mask = 3 button_mask = 3