From c0ad6226de72425a28d4e62ac0f9a6a086963172 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Mon, 22 May 2006 17:13:15 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Layer/Marker.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/OpenLayers/Layer/Marker.js b/lib/OpenLayers/Layer/Marker.js index 2f1d63402e..d33128f3a7 100644 --- a/lib/OpenLayers/Layer/Marker.js +++ b/lib/OpenLayers/Layer/Marker.js @@ -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 */