Improve handling of undefined coordinates

This commit is contained in:
Tom Payne
2012-08-13 17:24:25 +02:00
parent d5bd49d86b
commit e9e1b8eaa9

View File

@@ -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;
};