From 5a3c861051a042932d50c02e9f70da4196a4253e Mon Sep 17 00:00:00 2001 From: euzuro Date: Thu, 26 Apr 2007 23:29:10 +0000 Subject: [PATCH] fix for #681 - Make sure markers layer always draws on the first moveTo(), regardless of the value of 'zoomChanged'. git-svn-id: http://svn.openlayers.org/trunk/openlayers@3098 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Markers.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/Markers.js b/lib/OpenLayers/Layer/Markers.js index 55150f0a2c..5ecea4b9fb 100644 --- a/lib/OpenLayers/Layer/Markers.js +++ b/lib/OpenLayers/Layer/Markers.js @@ -21,6 +21,15 @@ OpenLayers.Layer.Markers.prototype = /** internal marker list * @type Array(OpenLayers.Marker) */ markers: null, + + + /** internal state of drawing. This is a workaround for the fact + * that the map does not call moveTo with a zoomChanged when the + * map is first starting up. This lets us catch the case where we + * have *never* drawn the layer, and draw it even if the zoom hasn't + * changed. + * @type Boolean */ + drawn: false, /** * @constructor @@ -51,8 +60,9 @@ OpenLayers.Layer.Markers.prototype = moveTo:function(bounds, zoomChanged, dragging) { OpenLayers.Layer.prototype.moveTo.apply(this, arguments); - if (zoomChanged) { + if (zoomChanged || !this.drawn) { this.redraw(); + this.drawn = true; } },