Skip to content

Commit

Permalink
Entry block: Change top of shape to ellipsis
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DoomTas3r authored and manuq committed Dec 2, 2024
1 parent 698a549 commit 90052a1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
7 changes: 7 additions & 0 deletions addons/block_code/ui/blocks/entry_block/entry_block.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
22 changes: 21 additions & 1 deletion addons/block_code/ui/blocks/utilities/background/background.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 90052a1

Please sign in to comment.