add another grab mode toggle to the extra options in overlay list

This commit is contained in:
Crispy 2021-07-22 15:18:40 +02:00
parent 5fc14a3def
commit 774d678bd7
3 changed files with 24 additions and 14 deletions

View file

@ -1,6 +1,6 @@
extends Node extends Node
const PATH = "user://overlay_data.json" const PATH = "user://overlay_data_DEV.json"
const DEF = { const DEF = {
"grab_mode": { "grab_mode": {
"name": "Grab mode", "name": "Grab mode",

View file

@ -112,25 +112,24 @@ margin_bottom = 191.0
icon = ExtResource( 10 ) icon = ExtResource( 10 )
[node name="MoreOptions" type="HSplitContainer" parent="."] [node name="MoreOptions" type="HSplitContainer" parent="."]
visible = false
margin_top = 8.0 margin_top = 8.0
margin_right = 2048.0 margin_right = 2048.0
margin_bottom = 215.0 margin_bottom = 215.0
[node name="Spacer" type="Control" parent="MoreOptions"] [node name="Spacer" type="Control" parent="MoreOptions"]
margin_right = 940.0 margin_right = 760.0
margin_bottom = 207.0 margin_bottom = 207.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="Container" type="PanelContainer" parent="MoreOptions"] [node name="Container" type="PanelContainer" parent="MoreOptions"]
margin_left = 952.0 margin_left = 772.0
margin_right = 2048.0 margin_right = 2048.0
margin_bottom = 207.0 margin_bottom = 207.0
[node name="List" type="HBoxContainer" parent="MoreOptions/Container"] [node name="List" type="HBoxContainer" parent="MoreOptions/Container"]
margin_left = 8.0 margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 1088.0 margin_right = 1268.0
margin_bottom = 199.0 margin_bottom = 199.0
alignment = 2 alignment = 2
@ -140,10 +139,17 @@ margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
icon = ExtResource( 2 ) icon = ExtResource( 2 )
[node name="SetSize" type="Button" parent="MoreOptions/Container/List"] [node name="Grab" type="Button" parent="MoreOptions/Container/List"]
margin_left = 180.0 margin_left = 180.0
margin_right = 356.0 margin_right = 356.0
margin_bottom = 191.0 margin_bottom = 191.0
toggle_mode = true
icon = ExtResource( 3 )
[node name="SetSize" type="Button" parent="MoreOptions/Container/List"]
margin_left = 360.0
margin_right = 536.0
margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
toggle_mode = true toggle_mode = true
icon = ExtResource( 4 ) icon = ExtResource( 4 )
@ -172,8 +178,8 @@ __meta__ = {
} }
[node name="SetAlpha" type="Button" parent="MoreOptions/Container/List"] [node name="SetAlpha" type="Button" parent="MoreOptions/Container/List"]
margin_left = 360.0 margin_left = 540.0
margin_right = 536.0 margin_right = 716.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
toggle_mode = true toggle_mode = true
@ -204,8 +210,8 @@ __meta__ = {
} }
[node name="Target" type="OptionButton" parent="MoreOptions/Container/List"] [node name="Target" type="OptionButton" parent="MoreOptions/Container/List"]
margin_left = 540.0 margin_left = 720.0
margin_right = 720.0 margin_right = 900.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
text = "Left" text = "Left"
@ -215,15 +221,15 @@ items = [ "Head", ExtResource( 7 ), false, 0, null, "Left", ExtResource( 13 ), f
selected = 1 selected = 1
[node name="Reset" type="Button" parent="MoreOptions/Container/List"] [node name="Reset" type="Button" parent="MoreOptions/Container/List"]
margin_left = 724.0 margin_left = 904.0
margin_right = 900.0 margin_right = 1080.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
icon = ExtResource( 5 ) icon = ExtResource( 5 )
[node name="CloseOptions" type="Button" parent="MoreOptions/Container/List"] [node name="CloseOptions" type="Button" parent="MoreOptions/Container/List"]
margin_left = 904.0 margin_left = 1084.0
margin_right = 1080.0 margin_right = 1260.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
icon = ExtResource( 11 ) icon = ExtResource( 11 )
@ -233,6 +239,7 @@ icon = ExtResource( 11 )
[connection signal="toggled" from="BasicOptions/List/Visibility" to="." method="_on_Visibility_toggled"] [connection signal="toggled" from="BasicOptions/List/Visibility" to="." method="_on_Visibility_toggled"]
[connection signal="pressed" from="BasicOptions/List/Options" to="." method="_on_Options_pressed"] [connection signal="pressed" from="BasicOptions/List/Options" to="." method="_on_Options_pressed"]
[connection signal="pressed" from="MoreOptions/Container/List/Remove" to="." method="_on_Remove_pressed"] [connection signal="pressed" from="MoreOptions/Container/List/Remove" to="." method="_on_Remove_pressed"]
[connection signal="toggled" from="MoreOptions/Container/List/Grab" to="." method="_on_Grab_toggled"]
[connection signal="toggled" from="MoreOptions/Container/List/SetSize" to="." method="_on_SetSize_toggled"] [connection signal="toggled" from="MoreOptions/Container/List/SetSize" to="." method="_on_SetSize_toggled"]
[connection signal="value_changed" from="MoreOptions/Container/List/SetSize/PanelContainer/SizeSlider" to="." method="_on_SizeSlider_value_changed"] [connection signal="value_changed" from="MoreOptions/Container/List/SetSize/PanelContainer/SizeSlider" to="." method="_on_SizeSlider_value_changed"]
[connection signal="toggled" from="MoreOptions/Container/List/SetAlpha" to="." method="_on_SetAlpha_toggled"] [connection signal="toggled" from="MoreOptions/Container/List/SetAlpha" to="." method="_on_SetAlpha_toggled"]

View file

@ -31,6 +31,8 @@ func _on_Visibility_toggled(state: bool) -> void:
func _on_Grab_toggled(state: bool) -> void: func _on_Grab_toggled(state: bool) -> void:
overlay.get_node("OverlayInteraction").grab_mode = state overlay.get_node("OverlayInteraction").grab_mode = state
$BasicOptions/List/Grab.pressed = state
$MoreOptions/Container/List/Grab.pressed = state
func _overlay_visible_changed(state: bool): func _overlay_visible_changed(state: bool):
@ -49,6 +51,7 @@ func _on_Remove_pressed() -> void:
func _on_Reset_pressed() -> void: func _on_Reset_pressed() -> void:
overlay.reset_offset() overlay.reset_offset()
_on_Grab_toggled(true)
func _on_Target_item_selected(index: int) -> void: func _on_Target_item_selected(index: int) -> void: