Seperate getEventCoordinate into internal/external method
This commit is contained in:
@@ -135,7 +135,7 @@ map.on('pointermove', function(evt) {
|
|||||||
if (evt.dragging) {
|
if (evt.dragging) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const coordinate = map.getEventCoordinate(evt.originalEvent);
|
const coordinate = map.getEventCoordinateExternal(evt.originalEvent);
|
||||||
displaySnap(coordinate);
|
displaySnap(coordinate);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ map.on('pointermove', function(evt) {
|
|||||||
if (evt.dragging) {
|
if (evt.dragging) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const coordinate = map.getEventCoordinate(evt.originalEvent);
|
const coordinate = map.getEventCoordinateExternal(evt.originalEvent);
|
||||||
displaySnap(coordinate);
|
displaySnap(coordinate);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ map.on('pointermove', function(evt) {
|
|||||||
if (evt.dragging) {
|
if (evt.dragging) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const coordinate = map.getEventCoordinate(evt.originalEvent);
|
const coordinate = map.getEventCoordinateExternal(evt.originalEvent);
|
||||||
displayCountryInfo(coordinate);
|
displayCountryInfo(coordinate);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
* @param {Event} event Event.
|
||||||
* @return {import("./coordinate.js").Coordinate} Coordinate.
|
* @return {import("./coordinate.js").Coordinate} Coordinate.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
getEventCoordinate(event) {
|
getEventCoordinateExternal(event) {
|
||||||
return this.getCoordinateFromPixelExternal(this.getEventPixel(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.
|
* Returns the map pixel position for a browser event relative to the viewport.
|
||||||
* @param {Event|TouchEvent} event Event.
|
* @param {Event|TouchEvent} event Event.
|
||||||
|
|||||||
@@ -223,13 +223,13 @@ class OverviewMap extends Control {
|
|||||||
|
|
||||||
const move = function(event) {
|
const move = function(event) {
|
||||||
const position = /** @type {?} */ (computeDesiredMousePosition(event));
|
const position = /** @type {?} */ (computeDesiredMousePosition(event));
|
||||||
const coordinates = ovmap.getEventCoordinate(/** @type {Event} */ (position));
|
const coordinates = ovmap.getEventCoordinateInternal(/** @type {Event} */ (position));
|
||||||
|
|
||||||
overlay.setPosition(coordinates);
|
overlay.setPosition(coordinates);
|
||||||
};
|
};
|
||||||
|
|
||||||
const endMoving = function(event) {
|
const endMoving = function(event) {
|
||||||
const coordinates = ovmap.getEventCoordinate(event);
|
const coordinates = ovmap.getEventCoordinateInternal(event);
|
||||||
|
|
||||||
scope.getMap().getView().setCenterInternal(coordinates);
|
scope.getMap().getView().setCenterInternal(coordinates);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user