Skip to content

Commit

Permalink
Queue free pin container when not used
Browse files Browse the repository at this point in the history
  • Loading branch information
DoomTas3r authored Nov 1, 2024
1 parent 2670101 commit a74086c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion addons/block_code/ui/blocks/block/block.gd
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var pinned: bool:

pinned = value

if not block_pinned_container:
if pinned:
block_pinned_container = Container.new()
block_pinned_container.mouse_filter = Control.MOUSE_FILTER_IGNORE

Expand All @@ -66,6 +66,9 @@ var pinned: bool:
block_pinned_panel.add_child(block_pinned_icon)
block_pinned_container.add_child(block_pinned_panel)
add_child(block_pinned_container)
else:
remove_child(block_pinned_container)
block_pinned_container.queue_free()

block_pinned_container.visible = pinned

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func _gui_input(event: InputEvent) -> void:
if button_event.button_index == MOUSE_BUTTON_LEFT:
_drag_start_position = event.global_position
else:
if not parent_block:
parent_block = BlockTreeUtil.get_parent_block(self)

if parent_block and parent_block.can_delete:
# Accepts to avoid menu conflicts
accept_event()

if not parent_block:
parent_block = BlockTreeUtil.get_parent_block(self)

# A new right-click menu with items
var _context_menu := PopupMenu.new()
_context_menu.add_icon_item(EditorInterface.get_editor_theme().get_icon("Duplicate", "EditorIcons"), "Duplicate")
Expand Down

0 comments on commit a74086c

Please sign in to comment.