[Mapbender_dev] Raphaeljs not bubbling

Karim Malhas karim at malhas.de
Mon Jun 7 04:57:57 EDT 2010


Dear List,

I am trying to modify the loadkmlgeorss module, which uses the Marker
class, to respond to click events to display a balloon popup.

If the Raphaeljs library is included this doesn't seem possible right
now.

The Problem as I understand it:

Each marker instantiates it's own 'canvas' - in Raphael this means a new
<svg> element is added to the DOM.
So if multiple markers are present, multiple <svg> appear stacked above
each other.
The problem is, that events don't seem to come through the topmost
svg element, meaning that only a click on the marker that was add last
will bring the desired result.

Possible solutions:

- Create a global canvas element.
  If all elements are in a single canvas, event propagation works
  however because canvas.clear() is called a couple of times
  in the code, a global canvas doesn't work without changes.
  This could be modifyed to grouping elements using 'canvas.set()', 
  and set.remove().
  I am not 100% sure how feasable that is, though.

- Create a common canvas element for the markers only
  drawback: the markers will work, but it can' t be used with any other
  modules that need a canvas

ideas?

Regards,
Karim


More information about the Mapbender_dev mailing list