# \[Bug\] Component::isMouseOver not reliable in AU with globalScaleFactor != 1.0

**URL:** <https://forum.juce.com/t/bug-component-ismouseover-not-reliable-in-au-with-globalscalefactor-1-0/65117>\
**Category:** General JUCE discussion\
**Created:** [February 6, 2025, 1:52pm UTC](https://forum.juce.com/t/bug-component-ismouseover-not-reliable-in-au-with-globalscalefactor-1-0/65117 "2025-02-06T13:52:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luzifer](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/luzifer/32/60_2.png) [@luzifer](https://forum.juce.com/u/luzifer)\
**Post date:** [February 6, 2025, 1:52pm UTC](https://forum.juce.com/t/bug-component-ismouseover-not-reliable-in-au-with-globalscalefactor-1-0/65117/1 "2025-02-06T13:52:57Z")

</div>

In AudioUnit editors the assumption `Component::mouseEnter()` → `Component::isMouseOver() -> true` doesn’t always hold true if `Desktop::setGlobalScaleFactor()` was called with a value unequal to 1.

I’ve included a drop-in replacement for AudioPluginDemo that demonstrates the problem. The demo’s global scale factor is 0.9. If you approach the hover target component **slowly** from the bottom edge you’ll see that it is being repainted with full opacity but the color doesn’t change to red (which is only the case if `HoverTarget::isMouseOver()` returns true).

The behavior is a bit host host dependent:

- On **Reaper** the problem is there in the beginning but disappears if the plug-in window is resized.
- On **Ableton** and **Logic** the problem isn’t there when instantiating a new plug-in but appears when resizing the plug-in window.
- On **AudioPluginHost** i fail to reproduce the problem

> <https://gist.github.com/lucijan/c6c13467a728234bbcb16b43c725f765>

Investigating a bit further it seems that `MouseInputSourceImpl::setPointerState` is causing a `mouseEnter` event with the new pointer state (including `position` and `componentUnderMouse`) before updating `lastPointerState`. However `Component::isMouseOver()` is using `MouseInputSource::getScreenPosition()` to determine if `Component::reallyContains()` the position. When called from inside `Component::mouseEnter()` this value isn’t updated yet.  
It isn’t entirely clear to me why this problem only occurs in this specific setup (i.e AU with scaleFactor) and isn’t more universal.

> Our current work-around is to use `Component::isMouseOverOrDragging()` which doesn’t check if the position is really contained in the component’s bounds.
