Use user projection for event coordinate

This commit is contained in:
Tim Schaub
2019-09-26 11:23:55 +02:00
parent d8f55ea3f1
commit 1e27846d6d
3 changed files with 148 additions and 4 deletions
+4 -3
View File
@@ -36,7 +36,7 @@ class MapBrowserEvent extends MapEvent {
this.pixel_ = null;
/**
* The coordinate in view projection corresponding to the original browser event.
* The coordinate in the user projection corresponding to the original browser event.
* @type {import("./coordinate.js").Coordinate}
*/
this.coordinate_ = null;
@@ -68,13 +68,14 @@ class MapBrowserEvent extends MapEvent {
}
/**
* The coordinate in view projection corresponding to the original browser event.
* The coordinate corresponding to the original browser event. This will be in the user
* projection if one is set. Otherwise it will be in the view projection.
* @type {import("./coordinate.js").Coordinate}
* @api
*/
get coordinate() {
if (!this.coordinate_) {
this.coordinate_ = this.map.getCoordinateFromPixelInternal(this.pixel);
this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel);
}
return this.coordinate_;
}