From 90052a1a7b4735165b0906ea1d88d095e09870b3 Mon Sep 17 00:00:00 2001 From: Daze Date: Wed, 27 Nov 2024 22:16:03 -0300 Subject: [PATCH] Entry block: Change top of shape to ellipsis To make entry blocks more distinguishable from the parameter blocks. Add another drag area, a rectangle that approximates the added ellipsis part. So the block can also be dragged from it. This drag area has a fixed size and doesn't expand. --- .../ui/blocks/entry_block/entry_block.tscn | 7 ++++++ .../blocks/utilities/background/background.gd | 22 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/addons/block_code/ui/blocks/entry_block/entry_block.tscn b/addons/block_code/ui/blocks/entry_block/entry_block.tscn index 8e031c01..5201e4c3 100644 --- a/addons/block_code/ui/blocks/entry_block/entry_block.tscn +++ b/addons/block_code/ui/blocks/entry_block/entry_block.tscn @@ -19,6 +19,12 @@ layout_mode = 2 mouse_filter = 2 theme_override_constants/separation = 0 +[node name="DragDropArea" parent="VBoxContainer" instance=ExtResource("3_swkpp")] +custom_minimum_size = Vector2(80, 16) +layout_mode = 2 +size_flags_horizontal = 0 +mouse_default_cursor_shape = 2 + [node name="TopMarginContainer" type="MarginContainer" parent="VBoxContainer"] custom_minimum_size = Vector2(0, 30) layout_mode = 2 @@ -56,4 +62,5 @@ layout_mode = 2 [node name="SnapPoint" parent="VBoxContainer" instance=ExtResource("4_yj206")] layout_mode = 2 +[connection signal="drag_started" from="VBoxContainer/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] [connection signal="drag_started" from="VBoxContainer/TopMarginContainer/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] diff --git a/addons/block_code/ui/blocks/utilities/background/background.gd b/addons/block_code/ui/blocks/utilities/background/background.gd index 11f79667..182f8862 100644 --- a/addons/block_code/ui/blocks/utilities/background/background.gd +++ b/addons/block_code/ui/blocks/utilities/background/background.gd @@ -77,9 +77,29 @@ func _get_knob_shape(displacement: Vector2 = Vector2.ZERO) -> PackedVector2Array func _get_entry_shape() -> PackedVector2Array: var box_shape = _get_box_shape(size) + var ellipsis = PackedVector2Array( + [ + Vector2(5, -4.012612), + Vector2(10, -7.240165), + Vector2(15, -9.822201), + Vector2(20, -11.84718), + Vector2(25, -13.37339), + Vector2(30, -14.43944), + Vector2(35, -15.06994), + Vector2(40, -15.27864), + Vector2(45, -15.06994), + Vector2(50, -14.43944), + Vector2(55, -13.37339), + Vector2(60, -11.84718), + Vector2(65, -9.822201), + Vector2(70, -7.240165), + Vector2(75, -4.012612), + Vector2(80, 0), + ] + ) var bottom_knob_shape = _get_knob_shape(Vector2(Constants.KNOB_X, size.y)) bottom_knob_shape.reverse() - return box_shape.slice(0, 3) + bottom_knob_shape + box_shape.slice(3) + return box_shape.slice(0, 1) + ellipsis + box_shape.slice(1, 3) + bottom_knob_shape + box_shape.slice(3) func _get_statement_shape() -> PackedVector2Array: