Page 1 of 1

[ML] Overlapping 3D-Elements conflict for mouse focus

Posted: 12 May 2013, 12:16
by m4rcel
Frame3D-elements conflict with their mouse events, if they overlap with other Frame3D-elements, even if the style defines that one element ist above the other concerning the z-Offset.

Look at the following Manialink example:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<manialink version="1" background="title" navigable3d="0"> 
	<timeout>0</timeout>
	<stylesheet>
		<frame3dstyles>
			<style3d id="StyleGreen" model="WindowH" thickness="0.05" yoffset="0" fyoffset="0" zoffset="0"   fzoffset="0.05" color="008800EE" fcolor="008800EE" lightcolor="001100" flightcolor="00EE00"/>
			<style3d id="StyleRed"   model="WindowH" thickness="0.05" yoffset="0" fyoffset="0" zoffset="0.1" fzoffset="0.15" color="880000EE" fcolor="880000EE" lightcolor="110000" flightcolor="EE0000"/>
		</frame3dstyles>
	</stylesheet>
	<frame3d id="green" style3d="StyleGreen"              sizen="100 20" ScriptEvents="1" />
	<frame3d id="red"   style3d="StyleRed"   posn="50 -5" sizen="100 20" ScriptEvents="1" />
	<script><![CDATA[
while(True) {
	yield;
	foreach (Event in PendingEvents) {
		log("Event " ^ Event.Type ^ " of Control " ^ Event.ControlId);
	}
}
	]]></script>
</manialink>
The red element is displayed in front of the green element, as of the higher zoffset-values. Yet, the red element may not get the mouse event, because the green element is catching it first. (You can see which gets the mouse in the ML by the lights of the elements: If it lights up, that element has the mouse focus.)

There are even several scenarios on who gets the mouse, depening on the user's action:
  • Move the mouse from outside all elements into the red element, and slowly into the area where both elements are overlapping. The red element keeps the mouse. This is a correct behavior.
  • Move the mouse from outside all elements into the green element, and slowly into the area where both elements are overlapping. The green element keeps the mouse, although the red element is in front of the green one and should get the mouse focus.
  • Move the mouse from outside all elements directly and fast into the overlapping area. Neither of the elements can keep the mouse focus, there are infinite events created because each element tries to "steal" the mouse focus from the other one. After some time, one of the elements will eventually "win" and keeps the mouse focus.

The behavior is a bit hard to describe, I hope you get what I mean :)