small re-org of Marker layer innards
git-svn-id: http://svn.openlayers.org/trunk/openlayers@248 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -25,10 +25,7 @@ OpenLayers.Layer.Marker.prototype =
|
||||
*/
|
||||
moveTo: function(bounds, zoomChanged) {
|
||||
if (zoomChanged) {
|
||||
this.div.innerHTML = "";
|
||||
for(i=0; i < this.markers.length; i++) {
|
||||
this.drawMarker(this.markers[i]);
|
||||
}
|
||||
this.redraw();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -42,15 +39,40 @@ OpenLayers.Layer.Marker.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
/** clear all the marker div's from the layer and then redraw all of them.
|
||||
* 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
|
||||
*
|
||||
* @private
|
||||
*
|
||||
* @param {OpenLayers.Marker} marker
|
||||
*/
|
||||
drawMarker: function(marker) {
|
||||
var px = this.map.getPixelFromLonLat(marker.lonlat);
|
||||
var m = marker.generateMarker(px);
|
||||
this.div.appendChild(m);
|
||||
var markerDiv = marker.generateMarker(px);
|
||||
this.div.appendChild(markerDiv);
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
|
||||
Reference in New Issue
Block a user