mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 09:14:42 -04:00
Add Pan Tool (#399)
This commit is contained in:
parent
425b11d4b2
commit
2a7e668976
25 changed files with 369 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
14
src/Tools/Pan.gd
Normal file
14
src/Tools/Pan.gd
Normal 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
22
src/Tools/Pan.tscn
Normal 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
|
|
@ -5,6 +5,7 @@ extends VBoxContainer
|
|||
onready var tools := [
|
||||
[$RectSelect, "rectangle_select"],
|
||||
[$Zoom, "zoom"],
|
||||
[$Pan, "pan"],
|
||||
[$ColorPicker, "colorpicker"],
|
||||
[$Pencil, "pencil"],
|
||||
[$Eraser, "eraser"],
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue