Improve handling of undefined coordinates
This commit is contained in:
@@ -111,14 +111,16 @@ ol.control.MousePosition.prototype.handleMouseMove = function(browserEvent) {
|
|||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
var pixel = new ol.Pixel(browserEvent.offsetX, browserEvent.offsetY);
|
var pixel = new ol.Pixel(browserEvent.offsetX, browserEvent.offsetY);
|
||||||
var coordinate = map.getCoordinateFromPixel(pixel);
|
var coordinate = map.getCoordinateFromPixel(pixel);
|
||||||
|
var html;
|
||||||
if (goog.isDef(coordinate)) {
|
if (goog.isDef(coordinate)) {
|
||||||
coordinate = this.transform_(coordinate);
|
coordinate = this.transform_(coordinate);
|
||||||
}
|
if (goog.isDef(this.coordinateFormat_)) {
|
||||||
var html;
|
html = this.coordinateFormat_(coordinate);
|
||||||
if (goog.isDef(this.coordinateFormat_)) {
|
} else {
|
||||||
html = this.coordinateFormat_(coordinate);
|
html = coordinate.toString();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
html = coordinate.toString();
|
html = this.undefinedHTML_;
|
||||||
}
|
}
|
||||||
this.divElement_.innerHTML = html;
|
this.divElement_.innerHTML = html;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user