Making the canvas renderer keep track of a pending redraw. With this change we properly redraw even if the last feature in a batch has no geometry. p=me,ahocevar r=ahocevar (closes #3225)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11860 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2011-04-03 05:04:17 +00:00
parent 62dd64c1c9
commit cf311ee532
2 changed files with 76 additions and 4 deletions

View File

@@ -42,7 +42,14 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
* Property: features
* {Object} Internal object of feature/style pairs for use in redrawing the layer.
*/
features: null,
features: null,
/**
* Property: pendingRedraw
* {Boolean} The renderer needs a redraw call to render features added while
* the renderer was locked.
*/
pendingRedraw: false,
/**
* Constructor: OpenLayers.Renderer.Canvas
@@ -134,9 +141,13 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
style = style || feature.style;
style = this.applyDefaultSymbolizer(style);
this.features[feature.id] = [feature, style];
this.redraw();
this.features[feature.id] = [feature, style];
rendered = true;
this.pendingRedraw = true;
}
if (this.pendingRedraw && !this.locked) {
this.redraw();
this.pendingRedraw = false;
}
return rendered;
},
@@ -659,7 +670,6 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
if (!this.features.hasOwnProperty(id)) { continue; }
feature = this.features[id][0];
style = this.features[id][1];
if (!feature.geometry) { continue; }
this.drawGeometry(feature.geometry, style, feature.id);
if(style.label) {
labelMap.push([feature, style]);