Meaningful variable names
This commit is contained in:
@@ -9,7 +9,7 @@ goog.require('ol.layer.TileLayer');
|
|||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.OSM');
|
goog.require('ol.source.OSM');
|
||||||
|
|
||||||
var control = new ol.control.MousePosition({
|
var mousePositionControl = new ol.control.MousePosition({
|
||||||
coordinateFormat: ol.coordinate.createStringXY(4),
|
coordinateFormat: ol.coordinate.createStringXY(4),
|
||||||
projection: 'EPSG:4326',
|
projection: 'EPSG:4326',
|
||||||
// comment the following two lines to have the mouse position
|
// comment the following two lines to have the mouse position
|
||||||
@@ -20,7 +20,7 @@ var control = new ol.control.MousePosition({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
controls: ol.control.defaults({}, [control]),
|
controls: ol.control.defaults({}, [mousePositionControl]),
|
||||||
layers: [
|
layers: [
|
||||||
new ol.layer.TileLayer({
|
new ol.layer.TileLayer({
|
||||||
source: new ol.source.OSM()
|
source: new ol.source.OSM()
|
||||||
@@ -34,13 +34,13 @@ var map = new ol.Map({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
var projection = new ol.dom.Input(document.getElementById('projection'));
|
var projectionSelect = new ol.dom.Input(document.getElementById('projection'));
|
||||||
projection.on('change:value', function() {
|
projectionSelect.on('change:value', function() {
|
||||||
control.setProjection(ol.proj.get(projection.getValue()));
|
mousePositionControl.setProjection(ol.proj.get(projectionSelect.getValue()));
|
||||||
});
|
});
|
||||||
|
|
||||||
var precision = new ol.dom.Input(document.getElementById('precision'));
|
var precisionInput = new ol.dom.Input(document.getElementById('precision'));
|
||||||
precision.on('change:value', function() {
|
precisionInput.on('change:value', function() {
|
||||||
var format = ol.coordinate.createStringXY(precision.getValue());
|
var format = ol.coordinate.createStringXY(precisionInput.getValue());
|
||||||
control.setCoordinateFormat(format);
|
mousePositionControl.setCoordinateFormat(format);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ goog.require('ol.layer.TileLayer');
|
|||||||
goog.require('ol.source.OSM');
|
goog.require('ol.source.OSM');
|
||||||
|
|
||||||
|
|
||||||
var control = new ol.control.ScaleLine();
|
var scaleLineControl = new ol.control.ScaleLine();
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
controls: ol.control.defaults({}, [
|
controls: ol.control.defaults({}, [
|
||||||
control
|
scaleLineControl
|
||||||
]),
|
]),
|
||||||
layers: [
|
layers: [
|
||||||
new ol.layer.TileLayer({
|
new ol.layer.TileLayer({
|
||||||
@@ -28,5 +28,5 @@ var map = new ol.Map({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var units = new ol.dom.Input(document.getElementById('units'));
|
var unitsSelect = new ol.dom.Input(document.getElementById('units'));
|
||||||
units.bindTo('value', control, 'units');
|
unitsSelect.bindTo('value', scaleLineControl, 'units');
|
||||||
|
|||||||
Reference in New Issue
Block a user