diff --git a/examples/igc.js b/examples/igc.js index 261108f59a..be2d2f984d 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -135,7 +135,7 @@ map.on('pointermove', function(evt) { if (evt.dragging) { return; } - const coordinate = map.getEventCoordinate(evt.originalEvent); + const coordinate = map.getEventCoordinateExternal(evt.originalEvent); displaySnap(coordinate); }); diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 1eceb86fdf..8ccfbc685c 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -85,7 +85,7 @@ map.on('pointermove', function(evt) { if (evt.dragging) { return; } - const coordinate = map.getEventCoordinate(evt.originalEvent); + const coordinate = map.getEventCoordinateExternal(evt.originalEvent); displaySnap(coordinate); }); diff --git a/examples/utfgrid.js b/examples/utfgrid.js index 92b117c100..b2007e921d 100644 --- a/examples/utfgrid.js +++ b/examples/utfgrid.js @@ -63,7 +63,7 @@ map.on('pointermove', function(evt) { if (evt.dragging) { return; } - const coordinate = map.getEventCoordinate(evt.originalEvent); + const coordinate = map.getEventCoordinateExternal(evt.originalEvent); displayCountryInfo(coordinate); }); diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index f4e49f0750..27597fae3c 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -629,15 +629,24 @@ class PluggableMap extends BaseObject { } /** - * Returns the coordinate in view projection for a browser event. + * Returns the coordinate in user projection for a browser event. * @param {Event} event Event. * @return {import("./coordinate.js").Coordinate} Coordinate. * @api */ - getEventCoordinate(event) { + getEventCoordinateExternal(event) { return this.getCoordinateFromPixelExternal(this.getEventPixel(event)); } + /** + * Returns the coordinate in view projection for a browser event. + * @param {Event} event Event. + * @return {import("./coordinate.js").Coordinate} Coordinate. + */ + getEventCoordinateInternal(event) { + return this.getCoordinateFromPixelInternal(this.getEventPixel(event)); + } + /** * Returns the map pixel position for a browser event relative to the viewport. * @param {Event|TouchEvent} event Event. diff --git a/src/ol/control/OverviewMap.js b/src/ol/control/OverviewMap.js index 0d7a87ad98..ff051e56ea 100644 --- a/src/ol/control/OverviewMap.js +++ b/src/ol/control/OverviewMap.js @@ -223,13 +223,13 @@ class OverviewMap extends Control { const move = function(event) { const position = /** @type {?} */ (computeDesiredMousePosition(event)); - const coordinates = ovmap.getEventCoordinate(/** @type {Event} */ (position)); + const coordinates = ovmap.getEventCoordinateInternal(/** @type {Event} */ (position)); overlay.setPosition(coordinates); }; const endMoving = function(event) { - const coordinates = ovmap.getEventCoordinate(event); + const coordinates = ovmap.getEventCoordinateInternal(event); scope.getMap().getView().setCenterInternal(coordinates);