Skip to content

Commit 756d62b

Browse files
authored
Merge pull request #237 from endlessm/focus-z-index
Block: Set z_index on focus
2 parents a91d31d + e65daa7 commit 756d62b

File tree

1 file changed

+18
-0
lines changed
  • addons/block_code/ui/blocks/block

1 file changed

+18
-0
lines changed

addons/block_code/ui/blocks/block/block.gd

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,27 @@ var _block_extension: BlockExtension
4949
func _ready():
5050
focus_mode = FocusMode.FOCUS_ALL
5151
mouse_filter = Control.MOUSE_FILTER_IGNORE
52+
focus_entered.connect(_block_on_focus_entered)
53+
focus_exited.connect(_block_on_focus_exited)
5254
_on_definition_changed()
5355

5456

57+
func _block_on_focus_entered():
58+
z_index = 1
59+
if bottom_snap:
60+
bottom_snap.z_index = -1
61+
if child_snap:
62+
child_snap.z_index = -1
63+
64+
65+
func _block_on_focus_exited():
66+
z_index = 0
67+
if bottom_snap:
68+
bottom_snap.z_index = 0
69+
if child_snap:
70+
child_snap.z_index = 0
71+
72+
5573
func _on_definition_changed():
5674
_block_extension = null
5775
_update_template_editor()

0 commit comments

Comments
 (0)