Skip to content

Commit

Permalink
[CtrlItemSlotEx] Removed checking for mouse hovers in the _input fu…
Browse files Browse the repository at this point in the history
…nction
  • Loading branch information
peter-kish committed May 30, 2024
1 parent 4b21c14 commit d1b3c37
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions addons/gloot/ui/ctrl_item_slot.gd
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ func _on_mouse_entered():
var item = item_slot.get_item()
emit_signal("item_mouse_entered", item)


func _on_mouse_exited():
var item = item_slot.get_item()
emit_signal("item_mouse_exited", item)
Expand Down
22 changes: 12 additions & 10 deletions addons/gloot/ui/ctrl_item_slot_ex.gd
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ func _set_panel_style(panel: Panel, style: StyleBox) -> void:
panel.add_theme_stylebox_override("panel", style)


func _input(event) -> void:
if event is InputEventMouseMotion:
if get_global_rect().has_point(get_global_mouse_position()) && slot_highlighted_style:
_set_panel_style(_background_panel, slot_highlighted_style)
return

if slot_style:
_set_panel_style(_background_panel, slot_style)
else:
_background_panel.hide()
func _on_mouse_entered():
if slot_highlighted_style:
_set_panel_style(_background_panel, slot_highlighted_style)
super._on_mouse_entered()


func _on_mouse_exited():
if slot_style:
_set_panel_style(_background_panel, slot_style)
else:
_background_panel.hide()
super._on_mouse_exited()

0 comments on commit d1b3c37

Please sign in to comment.