Avoid pixel->coord->pixel conversion

This commit is contained in:
tsauerwein
2015-01-29 11:33:57 +01:00
parent 054227fd26
commit 4d4bed454a
10 changed files with 27 additions and 25 deletions

View File

@@ -79,7 +79,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtPixel =
* @inheritDoc
*/
ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel =
function(coordinate, frameState, callback, thisArg) {
function(pixel, frameState, callback, thisArg) {
if (goog.isNull(this.getImage())) {
return undefined;
}
@@ -87,6 +87,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel =
if (this.getLayer().getSource() instanceof ol.source.ImageVector) {
// for ImageVector sources use the original hit-detection logic,
// so that for example also transparent polygons are detected
var coordinate = this.getMap().getCoordinateFromPixel(pixel);
var hasFeature = this.forEachFeatureAtPixel(
coordinate, frameState, goog.functions.TRUE, this);
@@ -103,7 +104,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel =
}
var pixelOnCanvas =
this.getPixelFromCoordinates(coordinate, this.imageTransformInv_);
this.getPixelOnCanvas(pixel, this.imageTransformInv_);
if (goog.isNull(this.hitCanvasContext_)) {
this.hitCanvasContext_ = ol.dom.createCanvasContext2D(1, 1);