fix: HUD drag functionality - auto-manage click-through mode

- Don't enable click-through on show (allows initial interaction)
- Disable click-through when mouse enters HUD (allows clicking/dragging)
- Enable click-through when mouse leaves (so HUD doesn't block game)
- Remove duplicate leaveEvent handler
- User can now hold Ctrl and drag without issues
This commit is contained in:
LemonNexus 2026-02-09 22:27:33 +00:00
parent ff31c68a44
commit 6cc10b14f1
1 changed files with 267 additions and 259 deletions

View File

@ -794,11 +794,6 @@ class HUDOverlay(QWidget):
else:
event.ignore()
def leaveEvent(self, event) -> None:
"""Handle mouse leave - reset drag hint."""
self.drag_hint.setStyleSheet("font-size: 8px; color: #666666;")
super().leaveEvent(event)
def _enable_click_through(self, enable: bool) -> None:
"""Enable or disable click-through behavior."""
if sys.platform == 'win32':
@ -1306,10 +1301,23 @@ class HUDOverlay(QWidget):
def showEvent(self, event) -> None:
"""Handle show event - ensure proper window attributes."""
if not self._modifier_pressed:
self._enable_click_through(True)
# Don't enable click-through immediately - let user interact first
# Click-through will be enabled after mouse leaves the window
super().showEvent(event)
def enterEvent(self, event) -> None:
"""Handle mouse enter - disable click-through so user can interact."""
self._enable_click_through(False)
super().enterEvent(event)
def leaveEvent(self, event) -> None:
"""Handle mouse leave - reset drag hint and enable click-through."""
self.drag_hint.setStyleSheet("font-size: 8px; color: #666666;")
# Enable click-through when mouse leaves so it doesn't block game
if not self._dragging:
self._enable_click_through(True)
super().leaveEvent(event)
def moveEvent(self, event) -> None:
"""Handle move event - save position periodically."""
if not hasattr(self, '_last_save'):