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

Make selection tool options not editable when there is no selection

This commit is contained in:
Manolis Papadeas 2021-05-09 00:56:23 +03:00
parent 6adb01aac1
commit 70d5fad9fd
2 changed files with 15 additions and 9 deletions

View file

@ -21,11 +21,7 @@ onready var hspinbox : SpinBox = find_node("HSpinBox")
func _ready() -> void:
var select_rect : Rect2 = selection_node.big_bounding_rectangle
xspinbox.value = select_rect.position.x
yspinbox.value = select_rect.position.y
wspinbox.value = select_rect.size.x
hspinbox.value = select_rect.size.y
set_spinbox_values()
func _input(event : InputEvent) -> void:
@ -41,6 +37,19 @@ func _input(event : InputEvent) -> void:
_snap_to_grid = false
func set_spinbox_values() -> void:
var select_rect : Rect2 = selection_node.big_bounding_rectangle
xspinbox.editable = !select_rect.has_no_area()
yspinbox.editable = !select_rect.has_no_area()
wspinbox.editable = !select_rect.has_no_area()
hspinbox.editable = !select_rect.has_no_area()
xspinbox.value = select_rect.position.x
yspinbox.value = select_rect.position.y
wspinbox.value = select_rect.size.x
hspinbox.value = select_rect.size.y
func draw_start(position : Vector2) -> void:
if selection_node.arrow_key_move:
return

View file

@ -229,10 +229,7 @@ func _big_bounding_rectangle_changed(value : Rect2) -> void:
big_bounding_rectangle = value
for slot in Tools._slots.values():
if slot.tool_node is SelectionTool:
slot.tool_node.xspinbox.value = value.position.x
slot.tool_node.yspinbox.value = value.position.y
slot.tool_node.wspinbox.value = value.size.x
slot.tool_node.hspinbox.value = value.size.y
slot.tool_node.set_spinbox_values()
update_gizmos()