MouseWheel capture only stays if element is full screen
Hey!
I have a hierachy very roughly speaking like this:
Within this hierachy, I have my MapLikeElement, which is some UI object with a behavior on that allows me functionality similar to a map: move and zoom.
Moving using mouse clicks, and zooming using mouse wheel. As it is right now, I have the issue that if the MapLikeElement covers the entire screen, I can move and zoom as I expect, however, if the MapLikeElement only partially covers the screen, then I am able to move as I expect, but I can't zoom. The element is not reacting to MouseWheel events at that point. Except for the special case that I can zoom while moving, which I presume happens because the element gets MouseCapture, as I capture the mouse during my movement.
Is there a way I can receive the MouseWheel events similar to the MouseDown events, that works both with and without mouse capture?`
Thanks in advance!
I have a hierachy very roughly speaking like this:
Code: Select all
<Grid>
<Grid></Grid>
...
<Grid>
<MapLikeElement />
</Grid>
</Grid>
Moving using mouse clicks, and zooming using mouse wheel. As it is right now, I have the issue that if the MapLikeElement covers the entire screen, I can move and zoom as I expect, however, if the MapLikeElement only partially covers the screen, then I am able to move as I expect, but I can't zoom. The element is not reacting to MouseWheel events at that point. Except for the special case that I can zoom while moving, which I presume happens because the element gets MouseCapture, as I capture the mouse during my movement.
Is there a way I can receive the MouseWheel events similar to the MouseDown events, that works both with and without mouse capture?`
Thanks in advance!
-
sfernandez
Site Admin
- Posts: 3109
- Joined:
Re: MouseWheel capture only stays if element is full screen
Does your MapLikeElement hit test correctly? Because mouse events are started (routed) from the element that is returned from the hit test. And an element is hit-testable if it has any content drawn in its OnRender().
Could you attach a minimal version of your MapLikeElement class definition? without all the logic, just to see the inheritance and methods you are overriding.
Could you attach a minimal version of your MapLikeElement class definition? without all the logic, just to see the inheritance and methods you are overriding.
Re: MouseWheel capture only stays if element is full screen
Thanks for the quick reply!
Turns out the issue was we were sending the MouseWheel event to the view at location (0, 0) every time. So when the element didnt have anything renderable in that location we were not receiving the input.
Turns out the issue was we were sending the MouseWheel event to the view at location (0, 0) every time. So when the element didnt have anything renderable in that location we were not receiving the input.
-
sfernandez
Site Admin
- Posts: 3109
- Joined:
Re: MouseWheel capture only stays if element is full screen
Glad you fixed the issue, marking this as solved.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 18 guests