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