1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-15 10:13:07 +00:00

Compare commits

...

7 commits

Author SHA1 Message Date
Emmanouil Papadeas
ffc98a4b7f Remove confusing text from the tooltips of the play animation buttons
Addresses #1114
2024-10-10 16:33:50 +03:00
Emmanouil Papadeas
7a3050b5a0 Fix formatting 2024-10-10 15:29:41 +03:00
Emmanouil Papadeas
55325a38a4 Use a Vector2i in Selection.gd when pasting 2024-10-10 15:29:36 +03:00
Emmanouil Papadeas
8802e3ab41 Slightly improve camera zoom and pan touch gestures
Not quite there yet
2024-10-10 15:29:12 +03:00
Emmanouil Papadeas
abcf6f5ec6 Remove unneeded Global.current_project in SymmetryGuide 2024-10-10 15:28:46 +03:00
Emmanouil Papadeas
9cf3045bf3 Fix "previous_project" shortcut not doing anything when we are on the first tab 2024-10-10 15:27:45 +03:00
Emmanouil Papadeas
39afb5e15b Add buttons with menus that move the symmetry guides to the center of the canvas, or the view center 2024-10-10 15:27:06 +03:00
8 changed files with 131 additions and 35 deletions

View file

@ -1957,10 +1957,18 @@ msgstr ""
msgid "Enable horizontal mirrored drawing"
msgstr ""
msgid "Vertical"
msgstr ""
msgid "Enable vertical mirrored drawing"
msgstr ""
msgid "Vertical"
#. Found in the global tool options, in the menu that appears next to each mirror button. It affects the position of a symmetry guide.
msgid "Move to canvas center"
msgstr ""
#. Found in the global tool options, in the menu that appears next to each mirror button. It affects the position of a symmetry guide.
msgid "Move to view center"
msgstr ""
msgid "Current frame:"
@ -1978,10 +1986,10 @@ msgstr ""
msgid "Go to the previous frame"
msgstr ""
msgid "Play the animation backwards (from end to beginning)"
msgid "Play the animation backwards"
msgstr ""
msgid "Play the animation forward (from beginning to end)"
msgid "Play the animation forward"
msgstr ""
msgid "Go to the next frame"

View file

@ -78,13 +78,14 @@ func _input(event: InputEvent) -> void:
zoom_camera(-1)
elif event is InputEventMagnifyGesture: # Zoom gesture on touchscreens
if event.factor >= 1: # Zoom in
zoom_camera(1)
#zoom_camera(event.factor)
if event.factor >= 1.0: # Zoom in
zoom_camera(event.factor * 0.3)
else: # Zoom out
zoom_camera(-1)
zoom_camera((event.factor * 0.7) - 1.0)
elif event is InputEventPanGesture:
# Pan gesture on touchscreens
offset = offset + event.delta.rotated(camera_angle) * 7.0 / zoom
offset = offset + event.delta.rotated(camera_angle) * 2.0 / zoom
elif event is InputEventMouseMotion:
if drag:
offset = offset - event.relative.rotated(camera_angle) / zoom
@ -95,7 +96,7 @@ func _input(event: InputEvent) -> void:
offset = offset + (dir.rotated(camera_angle) / zoom) * CAMERA_SPEED_RATE
func zoom_camera(dir: int) -> void:
func zoom_camera(dir: float) -> void:
var viewport_size := viewport_container.size
if Global.smooth_zoom:
var zoom_margin := zoom * dir / 5

View file

@ -21,11 +21,11 @@ func _input(_event: InputEvent) -> void:
super._input(_event)
if type == Types.HORIZONTAL:
project.y_symmetry_point = points[0].y * 2 - 1
points[0].y = clampf(points[0].y, 0, Global.current_project.size.y)
points[1].y = clampf(points[1].y, 0, Global.current_project.size.y)
points[0].y = clampf(points[0].y, 0, project.size.y)
points[1].y = clampf(points[1].y, 0, project.size.y)
elif type == Types.VERTICAL:
points[0].x = clampf(points[0].x, 0, Global.current_project.size.x)
points[1].x = clampf(points[1].x, 0, Global.current_project.size.x)
points[0].x = clampf(points[0].x, 0, project.size.x)
points[1].x = clampf(points[1].x, 0, project.size.x)
project.x_symmetry_point = points[0].x * 2 - 1

View file

@ -736,9 +736,9 @@ func paste(in_place := false) -> void:
var clip_map := SelectionMap.new()
clip_map.data = clipboard.selection_map
var max_size := Vector2(
max(clip_map.get_size().x, project.selection_map.get_size().x),
max(clip_map.get_size().y, project.selection_map.get_size().y)
var max_size := Vector2i(
maxi(clip_map.get_size().x, project.selection_map.get_size().x),
maxi(clip_map.get_size().y, project.selection_map.get_size().y)
)
project.selection_map.copy_from(clip_map)

View file

@ -11,6 +11,10 @@ extends PanelContainer
func _ready() -> void:
Tools.options_reset.connect(reset_options)
%HorizontalMirrorOptions.get_popup().id_pressed.connect(
_on_horizontal_mirror_options_id_pressed
)
%VerticalMirrorOptions.get_popup().id_pressed.connect(_on_vertical_mirror_options_id_pressed)
# Resize tools panel when window gets resized
get_tree().get_root().size_changed.connect(_on_resized)
horizontal_mirror.button_pressed = Tools.horizontal_mirror
@ -89,3 +93,23 @@ func _on_alpha_lock_toggled(toggled_on: bool) -> void:
func _on_Dynamics_pressed() -> void:
var pos := dynamics.global_position + Vector2(0, 32)
dynamics_panel.popup_on_parent(Rect2(pos, dynamics_panel.size))
func _on_horizontal_mirror_options_id_pressed(id: int) -> void:
var project := Global.current_project
if id == 0:
project.x_symmetry_point = project.size.x - 1
elif id == 1:
project.x_symmetry_point = Global.camera.camera_screen_center.x * 2
project.y_symmetry_axis.points[0].x = project.x_symmetry_point / 2 + 0.5
project.y_symmetry_axis.points[1].x = project.x_symmetry_point / 2 + 0.5
func _on_vertical_mirror_options_id_pressed(id: int) -> void:
var project := Global.current_project
if id == 0:
project.y_symmetry_point = project.size.y - 1
elif id == 1:
project.y_symmetry_point = Global.camera.camera_screen_center.y * 2
project.x_symmetry_axis.points[0].y = project.y_symmetry_point / 2 + 0.5
project.x_symmetry_axis.points[1].y = project.y_symmetry_point / 2 + 0.5

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=24 format=3 uid="uid://wo0hqxkst808"]
[gd_scene load_steps=25 format=3 uid="uid://wo0hqxkst808"]
[ext_resource type="Texture2D" uid="uid://cjrokejjsp5dm" path="res://assets/graphics/misc/horizontal_mirror_off.png" id="1"]
[ext_resource type="Texture2D" uid="uid://hiduvaa73fr6" path="res://assets/graphics/misc/vertical_mirror_off.png" id="2"]
[ext_resource type="Script" path="res://src/UI/GlobalToolOptions/GlobalToolOptions.gd" id="3"]
[ext_resource type="Texture2D" uid="uid://ct8wn8m6x4m54" path="res://assets/graphics/misc/value_arrow.svg" id="3_faalk"]
[ext_resource type="Texture2D" uid="uid://22h12g8p3jtd" path="res://assets/graphics/misc/pixel_perfect_off.png" id="4"]
[ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="5"]
[ext_resource type="Texture2D" uid="uid://j8eywwy082a4" path="res://assets/graphics/misc/alpha_lock_off.png" id="5_jv20x"]
@ -73,7 +74,7 @@ size_flags_vertical = 0
columns = 5
[node name="Horizontal" type="Button" parent="ScrollContainer/CenterContainer/GridContainer" groups=["UIButtons"]]
custom_minimum_size = Vector2(32, 32)
custom_minimum_size = Vector2(44, 32)
layout_mode = 2
tooltip_text = "Enable horizontal mirrored drawing"
mouse_default_cursor_shape = 2
@ -81,19 +82,49 @@ toggle_mode = true
shortcut = SubResource("Shortcut_eld87")
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/Horizontal"]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 5.0
offset_top = -10.0
offset_right = 25.0
offset_bottom = 11.0
grow_vertical = 2
texture = ExtResource("1")
[node name="HorizontalMirrorOptions" type="MenuButton" parent="ScrollContainer/CenterContainer/GridContainer/Horizontal"]
unique_name_in_owner = true
custom_minimum_size = Vector2(22, 0)
layout_mode = 1
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -22.0
offset_top = -10.0
offset_bottom = 10.0
mouse_default_cursor_shape = 2
item_count = 2
popup/item_0/text = "Move to canvas center"
popup/item_1/text = "Move to view center"
popup/item_1/id = 1
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/Horizontal/HorizontalMirrorOptions"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -10.0
offset_top = -10.5
offset_right = 10.0
offset_bottom = 10.5
texture = ExtResource("1")
offset_left = -6.0
offset_top = -6.0
offset_right = 6.0
offset_bottom = 6.0
texture = ExtResource("3_faalk")
[node name="Vertical" type="Button" parent="ScrollContainer/CenterContainer/GridContainer" groups=["UIButtons"]]
custom_minimum_size = Vector2(32, 32)
custom_minimum_size = Vector2(44, 32)
layout_mode = 2
tooltip_text = "Enable vertical mirrored drawing"
mouse_default_cursor_shape = 2
@ -101,16 +132,48 @@ toggle_mode = true
shortcut = SubResource("Shortcut_ai7qc")
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/Vertical"]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 5.0
offset_top = -10.0
offset_right = 25.0
offset_bottom = 10.0
grow_vertical = 2
texture = ExtResource("2")
[node name="VerticalMirrorOptions" type="MenuButton" parent="ScrollContainer/CenterContainer/GridContainer/Vertical"]
unique_name_in_owner = true
custom_minimum_size = Vector2(22, 0)
layout_mode = 1
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -22.0
offset_top = -10.0
offset_bottom = 10.0
grow_horizontal = 0
grow_vertical = 2
mouse_default_cursor_shape = 2
item_count = 2
popup/item_0/text = "Move to canvas center"
popup/item_1/text = "Move to view center"
popup/item_1/id = 1
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/Vertical/VerticalMirrorOptions"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -10.0
offset_top = -10.0
offset_right = 10.0
offset_bottom = 10.0
texture = ExtResource("2")
offset_left = -6.0
offset_top = -6.0
offset_right = 6.0
offset_bottom = 6.0
texture = ExtResource("3_faalk")
[node name="PixelPerfect" type="Button" parent="ScrollContainer/CenterContainer/GridContainer" groups=["UIButtons"]]
custom_minimum_size = Vector2(32, 32)

View file

@ -9,9 +9,8 @@ func _input(_event: InputEvent) -> void:
# system to fail, because user is trying to draw while switching project simultaneously.
# This is because the current project has changed and the system tries to commit to the
# wrong undoredo.
var tab_idx = current_tab
# If a project is currently worked upon, then don't switch it.
# This doesn't stop the bug completely but significantly reduces it's chances
# This doesn't stop the bug completely but significantly reduces its chances
# of appearing.
if (
Input.is_action_pressed("activate_left_tool")
@ -20,15 +19,16 @@ func _input(_event: InputEvent) -> void:
return
# Due to the bug mentioned above, we will use is_action_just_released
# instead of is_action_just_pressed. This won't remove the bug completely
# but will significantly reduce it's chancce of appearing.
# but it will significantly reduce its chance of appearing.
var tab_idx := current_tab
if Input.is_action_just_released(&"next_project", true):
tab_idx += 1
if tab_idx >= tab_count:
tab_idx = 0
elif Input.is_action_just_released(&"previous_project", true):
tab_idx = current_tab - 1
tab_idx -= 1
if tab_idx < 0:
tab_idx -= 1
tab_idx = tab_count - 1
if tab_idx != current_tab:
current_tab = tab_idx

View file

@ -589,7 +589,7 @@ texture = ExtResource("23")
unique_name_in_owner = true
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
tooltip_text = "Play the animation backwards (from end to beginning)"
tooltip_text = "Play the animation backwards"
focus_mode = 0
mouse_default_cursor_shape = 2
toggle_mode = true
@ -612,7 +612,7 @@ unique_name_in_owner = true
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
size_flags_horizontal = 0
tooltip_text = "Play the animation forward (from beginning to end)"
tooltip_text = "Play the animation forward"
focus_mode = 0
mouse_default_cursor_shape = 2
toggle_mode = true