[OpenLayers-Dev] canvas hit detection simplification

Tim Schaub tschaub at opengeo.org
Fri Apr 1 19:19:47 EDT 2011


There's one additional change I'd like to get in regarding the hit 
detection in canvas.  It's a fairly big simplification that lets us 
avoid a same origin constraint on external graphics.

Currently, when the user styles a point with an external graphic, we 
render this graphic to a dedicated graphic hit canvas and then render 
just the visible pixels with an identifiable color to the main hit 
canvas. This has the benefit of only counting hits when an event 
coincides with a non-transparent pixel in the external graphic. The 
drawbacks are that it brings extra overhead and limits external graphics 
to the same origin policy.

The hit detection for external graphics can be simplified by rendering a 
rectangle on the hit canvas that is the same size as the graphic on the 
display canvas. With this method, we get rid of extra pixel manipulation 
and avoid same origin constraints.

http://trac.osgeo.org/openlayers/ticket/3238

Tim

-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.


More information about the Dev mailing list