Capture=false not working properly? Or am I misunderstanding it?

  • Hello!

    So here's the issue. I have created a js plugin, which has a rough square shape, but there's an area cut out in the middle. I am drawing the shape and some other graphical elements on a canvas, and I also have some textareas in the plugin.

    At first, I noticed that even though the cut out area is transparent (it is being cut with the clearRect() function), I was not able to rotate the view through it. So ok, I remembered the capture setting, and tried setting it to false. Then I could look around just fine, however my textareas started acting strange, couldn't get focus, etc. Also, this obviously meant I could rotate the view even when clicking on a solid area of the plugin, which is not a big issue, but something I wanted to avoid if possible. Then I created a workaround by checking the mouse position on the canvas, and setting capture to false whenever the cursor was above the hole, and setting it to true otherwise.

    This seemed to work just fine, however now I realised that I still can't click on hotspots behind the plugin, even though they are in the cut area. Now the documentation says

    Quote

    When enabled=true and capture=false then the mouse events will be sent to
    the layer / plugin and also to all underlying elements, controlling the pano will be still possible.


    so I thought that would mean the hotspots behind the plugin would be clickable aswell. Is this a bug, an intended limitation or am I doing something wrong here?

    Of course I could just set enabled to false, but then I couldn't use the plugin itself, and the trick with the mouse position wouldn't work either, since after first setting enabled to false the mouse events would not work anymore.

    Is there any solution to this?

    Thanks a lot!

  • Hi,

    the capture=false relates only the pano-control, that means when the pano is behind that given element.

    Controlling the event flow through several layers is not possible with that, here the underlying Flash/HTML5 architectures are mainly the limiting factors.

    Best regards,
    Klaus

  • Actually I came up with a solution, just in case anyone runs into this problem/limitation. It's not too efficient, but in our special case it works just fine.

    What I did is I essentially wrote a js plugin that listens for mousemove and click events, and when these events fire it calculates the distance between the mouse cursor and the hotspot behind the plugin that is blocked (using mouse.x/y, spheretoscreen, etc). If the distance is smaller than a specified threshold, I simply call the respective hotspots event handlers manually.

    Again, with a lot of hotspots this would probably impact performance in a bad way, but since in my case I only had to make it work with a maximum of 3-4 hotspots per panorama, the solution is acceptable :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!