[gd_scene load_steps=6 format=3 uid="uid://c35n21ii7onhe"]

[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"]
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/Sliders/ValueSlider.tscn" id="2"]
[ext_resource type="Script" path="res://src/Tools/UtilityTools/CropTool.gd" id="3"]
[ext_resource type="Texture2D" uid="uid://bgrq56ndc4ydj" path="res://assets/graphics/misc/unlocked_size.png" id="4"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/Sliders/ValueSliderV2.tscn" id="5"]

[node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("3")

[node name="ModeLabel" type="Label" parent="." index="2"]
layout_mode = 2
text = "Mode:"

[node name="HBoxContainer" type="HBoxContainer" parent="." index="3"]
layout_mode = 2

[node name="CropMode" type="OptionButton" parent="HBoxContainer" index="0"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
clip_text = true
item_count = 2
selected = 0
popup/item_0/text = "Margins"
popup/item_0/id = 0
popup/item_1/text = "Position + Size"
popup/item_1/id = 1

[node name="SizeLock" type="Button" parent="HBoxContainer" index="1"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Locked size

When enabled using the tool on the canvas will only move the cropping rectangle.

When disabled using the tool on the canvas will draw the rectangle."
focus_mode = 0
mouse_default_cursor_shape = 2
toggle_mode = true
icon = ExtResource("4")

[node name="MarginsContainer" type="VBoxContainer" parent="." index="4"]
unique_name_in_owner = true
layout_mode = 2

[node name="MarginsLabel" type="Label" parent="MarginsContainer" index="0"]
layout_mode = 2
text = "Margins:"

[node name="Top" parent="MarginsContainer" index="1" instance=ExtResource("2")]
unique_name_in_owner = true
layout_mode = 2
allow_greater = true
allow_lesser = true
prefix = "Top:"

[node name="Bottom" parent="MarginsContainer" index="2" instance=ExtResource("2")]
unique_name_in_owner = true
layout_mode = 2
allow_greater = true
allow_lesser = true
prefix = "Bottom:"

[node name="Left" parent="MarginsContainer" index="3" instance=ExtResource("2")]
unique_name_in_owner = true
layout_mode = 2
allow_greater = true
allow_lesser = true
prefix = "Left:"

[node name="Right" parent="MarginsContainer" index="4" instance=ExtResource("2")]
unique_name_in_owner = true
layout_mode = 2
allow_greater = true
allow_lesser = true
prefix = "Right:"

[node name="RatioContainer" type="VBoxContainer" parent="." index="5"]
unique_name_in_owner = true
visible = false
layout_mode = 2

[node name="AspectRatioLabel" type="Label" parent="RatioContainer" index="0"]
layout_mode = 2
text = "Aspect Ratio:"

[node name="HBoxContainer" type="HBoxContainer" parent="RatioContainer" index="1"]
layout_mode = 2

[node name="RatioX" parent="RatioContainer/HBoxContainer" index="0" instance=ExtResource("2")]
unique_name_in_owner = true
layout_mode = 2
min_value = 1.0
value = 1.0
allow_greater = true

[node name="Label" type="Label" parent="RatioContainer/HBoxContainer" index="1"]
layout_mode = 2
text = ":"

[node name="RatioY" parent="RatioContainer/HBoxContainer" index="2" instance=ExtResource("2")]
unique_name_in_owner = true
layout_mode = 2
min_value = 1.0
value = 1.0
allow_greater = true

[node name="PosSizeContainer" type="VBoxContainer" parent="." index="6"]
unique_name_in_owner = true
layout_mode = 2

[node name="PositionLabel" type="Label" parent="PosSizeContainer" index="0"]
layout_mode = 2
text = "Position:"

[node name="Position" parent="PosSizeContainer" index="1" instance=ExtResource("5")]
unique_name_in_owner = true
layout_mode = 2
allow_greater = true
allow_lesser = true

[node name="SizeLabel" type="Label" parent="PosSizeContainer" index="2"]
layout_mode = 2
text = "Size:"

[node name="Size" parent="PosSizeContainer" index="3" instance=ExtResource("5")]
unique_name_in_owner = true
layout_mode = 2
value = Vector2(1, 1)
min_value = Vector2(1, 1)
allow_greater = true
show_ratio = true
prefix_x = "Width:"
prefix_y = "Height:"

[node name="Apply" type="Button" parent="." index="7"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Apply"

[node name="DimensionsLabel" type="Label" parent="." index="8"]
unique_name_in_owner = true
layout_mode = 2

[connection signal="item_selected" from="HBoxContainer/CropMode" to="." method="_on_CropMode_item_selected"]
[connection signal="toggled" from="HBoxContainer/SizeLock" to="." method="_on_SizeLock_toggled"]
[connection signal="value_changed" from="MarginsContainer/Top" to="." method="_on_Top_value_changed"]
[connection signal="value_changed" from="MarginsContainer/Bottom" to="." method="_on_Bottom_value_changed"]
[connection signal="value_changed" from="MarginsContainer/Left" to="." method="_on_Left_value_changed"]
[connection signal="value_changed" from="MarginsContainer/Right" to="." method="_on_Right_value_changed"]
[connection signal="value_changed" from="RatioContainer/HBoxContainer/RatioX" to="." method="_on_RatioX_value_changed"]
[connection signal="value_changed" from="RatioContainer/HBoxContainer/RatioY" to="." method="_on_RatioY_value_changed"]
[connection signal="value_changed" from="PosSizeContainer/Position" to="." method="_on_Position_value_changed"]
[connection signal="ratio_toggled" from="PosSizeContainer/Size" to="." method="_on_Size_ratio_toggled"]
[connection signal="value_changed" from="PosSizeContainer/Size" to="." method="_on_Size_value_changed"]
[connection signal="pressed" from="Apply" to="." method="_on_Apply_pressed"]
