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

Fixes to perspective editor (#1034)

* removed some redundant code

(not sure how it got there), made tracker toggle obey the variable

* Changed perspective editor from Control to PanelContainer to avoid some UI issues
This commit is contained in:
Variable 2024-07-13 22:52:32 +05:00 committed by GitHub
parent b4384f4085
commit e1649a064e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 13 deletions

View file

@ -1,15 +1,18 @@
extends Control
extends PanelContainer
var axes: Node2D
var do_pool := [] ## A pool that stores data of points removed by undo
var delete_pool := [] ## A pool that containing deleted data and their index
## The vanishing point UI resource
var vanishing_point_res := preload("res://src/UI/PerspectiveEditor/VanishingPoint.tscn")
## Option to show/hide tracker guides. (guides whose end points follow the mouse)
var tracker_disabled := false
@onready var vanishing_point_container = $"%VanishingPointContainer"
func _ready() -> void:
Global.project_switched.connect(_update_points)
$VBoxContainer/TrackerLines.button_pressed = !tracker_disabled
func _on_AddPoint_pressed() -> void:
@ -23,7 +26,6 @@ func _on_AddPoint_pressed() -> void:
func _on_TrackerLines_toggled(button_pressed: bool) -> void:
for point in vanishing_point_container.get_children():
tracker_disabled = !button_pressed

View file

@ -2,9 +2,8 @@
[ext_resource type="Script" path="res://src/UI/PerspectiveEditor/PerspectiveEditor.gd" id="1"]
[node name="PerspectiveEditor" type="Control"]
[node name="PerspectiveEditor" type="PanelContainer"]
custom_minimum_size = Vector2(270, 10)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
@ -17,11 +16,7 @@ script = ExtResource("1")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
self_modulate = Color(0.698039, 0.698039, 0.698039, 0.698039)
clip_contents = true
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 4.0
offset_right = -4.0
layout_mode = 2
size_flags_vertical = 3
[node name="Header" type="HBoxContainer" parent="VBoxContainer"]

View file

@ -156,6 +156,3 @@ func _draw() -> void:
# if we put width <= -1, then the arc line will automatically adjust itself to remain thin
# in 0.x this behavior was achieved at width <= 1
draw_arc(point, CIRCLE_RAD * 2 / Global.camera.zoom.x, 0, 360, 360, default_color)
if is_hidden: # Hidden line
return

View file

@ -186,6 +186,9 @@ func add_line(loaded_line_data := {}, is_tracker := false) -> void:
if is_tracker: # Settings for Tracker mode
line.track_mouse = true
tracker_line = line
# The tracker line is initially always hidden when a new point is added because
# mouse is outside of canvas during that time.
# This is not related to the disable tracker toggle in perspective editor
tracker_line.hide_perspective_line()
else: # Settings for Normal mode
var line_button := preload("res://src/UI/PerspectiveEditor/LineButton.tscn").instantiate()