openlaszlolzx

Openlaszlo bringtoFront is not working properly


I am having an triangle with me which i am trying to rotate. The image is rotating properly i don't have any issues in that. But i have one problem the triangle should get focus only when i click on the actual point from where i can rotate. But this is not happening. I have attached an image explaining the problem. I didnt have any problem with this in swf runtime. But in DHTML runtime i am facing this issue. Does this have anything to the image that i am using?

I am using Openlaszlo5.0, testing in windows Firefox 16.0 and the test image for the triangle is an PNG.

enter image description here


Solution

  • I'm assuming from your description that you must be using a class that has a built-in bringToFront() call when you click it, like basewindow for example. With classes like this you can override the bringToFront() method and put in a check to see if the mouse is within the area you wish to respond to and then decide whether or not to call super.bringToFront(). For simplicity, my example just checks to see if the click is in the right half of the square, but you can just plug in the formula to figure out if it is within the point of your triangle or not instead in your application:

    <canvas width="1000" height="584" debug="true">
    
        <basewindow id="v1" width="100" height="100" x="25" y="25" bgcolor="0xff0000" clickable="true">
    
            <method name="bringToFront">
            <![CDATA[
    
                var x = this.getMouse('x');
                var y = this.getMouse('x'); 
    
                Debug.debug('x='+x);
                Debug.debug('y='+y);    
    
                // Ensure mouse is within right half:
    
                if (x>(this.width)/2)
                  super.bringToFront();
    
            ]]>
            </method>
    
        </basewindow>  
    
        <basewindow id="v" width="100" height="100" x="50" y="50" bgcolor="0xcccccc" clickable="true">
    
            <method name="bringToFront">
            <![CDATA[
    
                var x = this.getMouse('x');
                var y = this.getMouse('x'); 
    
                Debug.debug('x='+x);
                Debug.debug('y='+y);    
    
                // Ensure mouse is within right half:
    
                if (x>(this.width)/2)
                  super.bringToFront();
    
            ]]>
            </method>
    
        </basewindow>
    
    </canvas>
    

    I tested it in OL 4.9.0 SWF10 and it works.