Cope with map being null
This commit is contained in:
@@ -85,6 +85,9 @@ goog.inherits(ol.control.MousePosition, ol.control.Control);
|
|||||||
*/
|
*/
|
||||||
ol.control.MousePosition.prototype.handleMapProjectionChanged = function() {
|
ol.control.MousePosition.prototype.handleMapProjectionChanged = function() {
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
|
if (goog.isNull(map)) {
|
||||||
|
this.transform_ = ol.Projection.identityTransform;
|
||||||
|
} else {
|
||||||
var mapProjection = map.getProjection();
|
var mapProjection = map.getProjection();
|
||||||
if (!goog.isDef(mapProjection) || !goog.isDef(this.projection_)) {
|
if (!goog.isDef(mapProjection) || !goog.isDef(this.projection_)) {
|
||||||
this.transform_ = ol.Projection.identityTransform;
|
this.transform_ = ol.Projection.identityTransform;
|
||||||
@@ -93,6 +96,7 @@ ol.control.MousePosition.prototype.handleMapProjectionChanged = function() {
|
|||||||
ol.Projection.getTransform(mapProjection, this.projection_);
|
ol.Projection.getTransform(mapProjection, this.projection_);
|
||||||
}
|
}
|
||||||
// FIXME should we instead re-calculate using the last known mouse position?
|
// FIXME should we instead re-calculate using the last known mouse position?
|
||||||
|
}
|
||||||
this.element.innerHTML = this.undefinedHtml_;
|
this.element.innerHTML = this.undefinedHtml_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user