If attach events to the marker element really can cause performance problems,
we can create the events object in the marker's constructor without attach the events to the DOM element, and than attach the events to the DOM element in the draw method.<br><br>initialize: function(lonlat, icon) {<br>
....<br><br> this.events = new OpenLayers.Events(this, null, null);<br> },<br><br>draw: function(px) {<br> var div = this.icon.draw(px);<br> <br> this.events.attachToElement(div);<br>
<br> return div;<br> },<br><br>BTW: May be need allow events to fall through, otherwise, the map element can not capture the mouseup event when using the box handler and release mouse on the marker element.<br>
<br clear="all">Li XinGang<br>EMail: <a href="mailto:slinavlee@gmail.com">slinavlee@gmail.com</a><br>Blog: <a href="http://avlee.cnblogs.com">avlee.cnblogs.com</a><br>Site: <a href="http://www.mapboost.org">www.mapboost.org</a><br>
<br><br><div class="gmail_quote">On Tue, Oct 27, 2009 at 4:42 AM, Andreas Hocevar <span dir="ltr"><<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
reverted that change due to lack of a better solution.<br>
<br>
Regards,<br>
Andreas.<br>
<div class="im"><br>
Christopher Schmidt wrote:<br>
> Sent to the wrong list.<br>
><br>
> ----- Forwarded message from Ian Trotter <<a href="mailto:itr@pointcarbon.com">itr@pointcarbon.com</a>> -----<br>
><br>
> From: Ian Trotter <<a href="mailto:itr@pointcarbon.com">itr@pointcarbon.com</a>><br>
> To: "<a href="mailto:trac@openlayers.org">trac@openlayers.org</a>" <<a href="mailto:trac@openlayers.org">trac@openlayers.org</a>><br>
> Date: Mon, 26 Oct 2009 17:31:12 +0100<br>
> Subject: [OpenLayers-Trac] Error in Marker.js<br>
> Reply-To: <a href="mailto:dev@openlayers.org">dev@openlayers.org</a><br>
><br>
> Hi,<br>
><br>
> The resolution of <a href="http://trac.openlayers.org/ticket/2258" target="_blank">http://trac.openlayers.org/ticket/2258</a> seems to have introduced a bug with the event-handling for markers. It seems that the Marker.events property is no longer being set when a marker is initialised.<br>
><br>
> As an example, you can see that <a href="http://openlayers.org/dev/examples/georss-markers.html" target="_blank">http://openlayers.org/dev/examples/georss-markers.html</a> no longer shows the markers, with an error message that marker.events is null.<br>
><br>
> - Ian<br>
><br>
><br>
> _______________________________________________<br>
> Trac mailing list<br>
> <a href="mailto:Trac@openlayers.org">Trac@openlayers.org</a><br>
> <a href="http://openlayers.org/mailman/listinfo/trac" target="_blank">http://openlayers.org/mailman/listinfo/trac</a><br>
><br>
><br>
> ----- End forwarded message -----<br>
><br>
><br>
<br>
<br>
--<br>
</div><font color="#888888">Andreas Hocevar<br>
OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
Expert service straight from the developers.<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@openlayers.org">Dev@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/dev" target="_blank">http://openlayers.org/mailman/listinfo/dev</a><br>
</div></div></blockquote></div><br>