Merge pull request #6892 from fredj/ProjectionLike

Accept a ol.ProjectionLike instead of ol.proj.Projection
This commit is contained in:
Frédéric Junod
2017-06-09 08:45:45 +02:00
committed by GitHub
3 changed files with 7 additions and 8 deletions

View File

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

View File

@@ -47,7 +47,7 @@ ol.control.MousePosition = function(opt_options) {
this.setCoordinateFormat(options.coordinateFormat);
}
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.
* @param {ol.proj.Projection} projection The projection to report mouse
* @param {ol.ProjectionLike} projection The projection to report mouse
* position in.
* @observable
* @api
*/
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));
};

View File

@@ -73,7 +73,7 @@ ol.Geolocation = function(opt_options) {
this.handleTrackingChanged_, this);
if (options.projection !== undefined) {
this.setProjection(ol.proj.get(options.projection));
this.setProjection(options.projection);
}
if (options.trackingOptions !== undefined) {
this.setTrackingOptions(options.trackingOptions);
@@ -308,13 +308,13 @@ ol.Geolocation.prototype.getTrackingOptions = function() {
/**
* Set the projection to use for transforming the coordinates.
* @param {ol.proj.Projection} projection The projection the position is
* @param {ol.ProjectionLike} projection The projection the position is
* reported in.
* @observable
* @api
*/
ol.Geolocation.prototype.setProjection = function(projection) {
this.set(ol.GeolocationProperty.PROJECTION, projection);
this.set(ol.GeolocationProperty.PROJECTION, ol.proj.get(projection));
};