Adjust redraw. Before, we were appending the marker again -- but there's no reason to do that. The markers already exist, we're adjusting their position anyway. This should result in a 2/3rds speed win after the initial display, because appendChild was the largest length of time in the entire redraw process.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@267 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-05-22 17:13:15 +00:00
parent b73626fbdc
commit c0ad6226de

View File

@@ -44,24 +44,11 @@ OpenLayers.Layer.Marker.prototype =
* Use the map to recalculate new placement of markers.
*/
redraw: function() {
this.clear();
for(i=0; i < this.markers.length; i++) {
this.drawMarker(this.markers[i]);
}
},
/** This function clears the visual display of the markers, without
* removing them from memory (this.markers array).
*
* @private
*/
clear: function() {
this.div.innerHTML = "";
},
/** Calculate the screen pixel location for the marker, create it, and
* add it to the layer's div
*
@@ -72,7 +59,10 @@ OpenLayers.Layer.Marker.prototype =
drawMarker: function(marker) {
var px = this.map.getPixelFromLonLat(marker.lonlat);
var markerDiv = marker.draw(px);
this.div.appendChild(markerDiv);
if (marker.drawn != 1) {
this.div.appendChild(markerDiv);
marker.drawn = 1;
}
},
/** @final @type String */