oriba
Topic Author
Posts: 3
Joined: 05 Jun 2021, 20:05

MouseWheel capture only stays if element is full screen

19 Jul 2023, 14:08

Hey!

I have a hierachy very roughly speaking like this:
<Grid>
	<Grid></Grid>
	...
	
	<Grid>
		<MapLikeElement />
	</Grid>
</Grid>
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!
 
User avatar
sfernandez
Site Admin
Posts: 3008
Joined: 22 Dec 2011, 19:20

Re: MouseWheel capture only stays if element is full screen

19 Jul 2023, 18:31

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.
 
oriba
Topic Author
Posts: 3
Joined: 05 Jun 2021, 20:05

Re: MouseWheel capture only stays if element is full screen

27 Jul 2023, 11:19

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.
 
User avatar
sfernandez
Site Admin
Posts: 3008
Joined: 22 Dec 2011, 19:20

Re: MouseWheel capture only stays if element is full screen

31 Jul 2023, 14:03

Glad you fixed the issue, marking this as solved.

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 13 guests