Make drawFeature() immediate

This commit is contained in:
Tim Schaub
2016-03-18 01:38:48 -06:00
parent ef0487c3ab
commit ec2daf2118

View File

@@ -517,11 +517,10 @@ ol.render.canvas.Immediate.prototype.drawGeometry = function(geometry) {
/**
* Render a feature into the canvas. In order to respect the zIndex of the
* style this method draws asynchronously and thus *after* calls to
* drawXxxxGeometry have been finished, effectively drawing the feature
* *on top* of everything else. You probably should be using an
* {@link ol.layer.Vector} instead of calling this method directly.
* Render a feature into the canvas. Note that any `zIndex` on the provided
* style will be ignored - features are rendered immediately in the order that
* this method is called. If you need `zIndex` support, you should be using an
* {@link ol.layer.Vector} instead.
*
* @param {ol.Feature} feature Feature.
* @param {ol.style.Style} style Style.
@@ -533,17 +532,9 @@ ol.render.canvas.Immediate.prototype.drawFeature = function(feature, style) {
!ol.extent.intersects(this.extent_, geometry.getExtent())) {
return;
}
var zIndex = style.getZIndex();
if (zIndex === undefined) {
zIndex = 0;
}
this.drawAsync(zIndex, function(render) {
render.setFillStrokeStyle(style.getFill(), style.getStroke());
render.setImageStyle(style.getImage());
render.setTextStyle(style.getText());
goog.asserts.assert(geometry, 'geometry must be truthy');
render.drawGeometry(geometry);
});
this.setStyle(style);
goog.asserts.assert(geometry, 'geometry must be truthy');
this.drawGeometry(geometry);
};