Use frame state for pixel to coord conversion
This commit is contained in:
@@ -88,7 +88,9 @@ ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel =
|
|||||||
if (this.getLayer().getSource() instanceof ol.source.ImageVector) {
|
if (this.getLayer().getSource() instanceof ol.source.ImageVector) {
|
||||||
// for ImageVector sources use the original hit-detection logic,
|
// for ImageVector sources use the original hit-detection logic,
|
||||||
// so that for example also transparent polygons are detected
|
// so that for example also transparent polygons are detected
|
||||||
var coordinate = this.getMap().getCoordinateFromPixel(pixel);
|
var coordinate = pixel.slice();
|
||||||
|
ol.vec.Mat4.multVec2(
|
||||||
|
frameState.pixelToCoordinateMatrix, coordinate, coordinate);
|
||||||
var hasFeature = this.forEachFeatureAtCoordinate(
|
var hasFeature = this.forEachFeatureAtCoordinate(
|
||||||
coordinate, frameState, goog.functions.TRUE, this);
|
coordinate, frameState, goog.functions.TRUE, this);
|
||||||
|
|
||||||
|
|||||||
@@ -235,7 +235,9 @@ ol.renderer.webgl.ImageLayer.prototype.forEachLayerAtPixel =
|
|||||||
if (this.getLayer().getSource() instanceof ol.source.ImageVector) {
|
if (this.getLayer().getSource() instanceof ol.source.ImageVector) {
|
||||||
// for ImageVector sources use the original hit-detection logic,
|
// for ImageVector sources use the original hit-detection logic,
|
||||||
// so that for example also transparent polygons are detected
|
// so that for example also transparent polygons are detected
|
||||||
var coordinate = this.getMap().getCoordinateFromPixel(pixel);
|
var coordinate = pixel.slice();
|
||||||
|
ol.vec.Mat4.multVec2(
|
||||||
|
frameState.pixelToCoordinateMatrix, coordinate, coordinate);
|
||||||
var hasFeature = this.forEachFeatureAtCoordinate(
|
var hasFeature = this.forEachFeatureAtCoordinate(
|
||||||
coordinate, frameState, goog.functions.TRUE, this);
|
coordinate, frameState, goog.functions.TRUE, this);
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ goog.require('ol.layer.Vector');
|
|||||||
goog.require('ol.render.webgl.ReplayGroup');
|
goog.require('ol.render.webgl.ReplayGroup');
|
||||||
goog.require('ol.renderer.vector');
|
goog.require('ol.renderer.vector');
|
||||||
goog.require('ol.renderer.webgl.Layer');
|
goog.require('ol.renderer.webgl.Layer');
|
||||||
|
goog.require('ol.vec.Mat4');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -165,7 +166,9 @@ ol.renderer.webgl.VectorLayer.prototype.hasFeatureAtCoordinate =
|
|||||||
*/
|
*/
|
||||||
ol.renderer.webgl.VectorLayer.prototype.forEachLayerAtPixel =
|
ol.renderer.webgl.VectorLayer.prototype.forEachLayerAtPixel =
|
||||||
function(pixel, frameState, callback, thisArg) {
|
function(pixel, frameState, callback, thisArg) {
|
||||||
var coordinate = this.getMap().getCoordinateFromPixel(pixel);
|
var coordinate = pixel.slice();
|
||||||
|
ol.vec.Mat4.multVec2(
|
||||||
|
frameState.pixelToCoordinateMatrix, coordinate, coordinate);
|
||||||
var hasFeature = this.hasFeatureAtCoordinate(coordinate, frameState);
|
var hasFeature = this.hasFeatureAtCoordinate(coordinate, frameState);
|
||||||
|
|
||||||
if (hasFeature) {
|
if (hasFeature) {
|
||||||
|
|||||||
Reference in New Issue
Block a user