Accept a ol.ProjectionLike in ol.control.MousePosition#setProjection

This commit is contained in:
Frederic Junod
2017-06-09 08:27:43 +02:00
parent d8ed2eb1be
commit 4898c83590
2 changed files with 4 additions and 5 deletions

View File

@@ -4,7 +4,6 @@ goog.require('ol.control');
goog.require('ol.control.MousePosition'); goog.require('ol.control.MousePosition');
goog.require('ol.coordinate'); goog.require('ol.coordinate');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.OSM'); goog.require('ol.source.OSM');
var mousePositionControl = new ol.control.MousePosition({ var mousePositionControl = new ol.control.MousePosition({
@@ -37,7 +36,7 @@ var map = new ol.Map({
var projectionSelect = document.getElementById('projection'); var projectionSelect = document.getElementById('projection');
projectionSelect.addEventListener('change', function(event) { projectionSelect.addEventListener('change', function(event) {
mousePositionControl.setProjection(ol.proj.get(event.target.value)); mousePositionControl.setProjection(event.target.value);
}); });
var precisionInput = document.getElementById('precision'); var precisionInput = document.getElementById('precision');

View File

@@ -47,7 +47,7 @@ ol.control.MousePosition = function(opt_options) {
this.setCoordinateFormat(options.coordinateFormat); this.setCoordinateFormat(options.coordinateFormat);
} }
if (options.projection) { if (options.projection) {
this.setProjection(ol.proj.get(options.projection)); this.setProjection(options.projection);
} }
/** /**
@@ -192,13 +192,13 @@ ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
/** /**
* Set the projection that is used to report the mouse position. * Set the projection that is used to report the mouse position.
* @param {ol.proj.Projection} projection The projection to report mouse * @param {ol.ProjectionLike} projection The projection to report mouse
* position in. * position in.
* @observable * @observable
* @api * @api
*/ */
ol.control.MousePosition.prototype.setProjection = function(projection) { ol.control.MousePosition.prototype.setProjection = function(projection) {
this.set(ol.control.MousePosition.Property_.PROJECTION, projection); this.set(ol.control.MousePosition.Property_.PROJECTION, ol.proj.get(projection));
}; };