Meaningful variable names

This commit is contained in:
Frederic Junod
2013-06-20 16:56:59 +02:00
parent 22adf354e2
commit 4217c5e47a
2 changed files with 13 additions and 13 deletions

View File

@@ -9,7 +9,7 @@ goog.require('ol.layer.TileLayer');
goog.require('ol.proj');
goog.require('ol.source.OSM');
var control = new ol.control.MousePosition({
var mousePositionControl = new ol.control.MousePosition({
coordinateFormat: ol.coordinate.createStringXY(4),
projection: 'EPSG:4326',
// 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({
controls: ol.control.defaults({}, [control]),
controls: ol.control.defaults({}, [mousePositionControl]),
layers: [
new ol.layer.TileLayer({
source: new ol.source.OSM()
@@ -34,13 +34,13 @@ var map = new ol.Map({
})
});
var projection = new ol.dom.Input(document.getElementById('projection'));
projection.on('change:value', function() {
control.setProjection(ol.proj.get(projection.getValue()));
var projectionSelect = new ol.dom.Input(document.getElementById('projection'));
projectionSelect.on('change:value', function() {
mousePositionControl.setProjection(ol.proj.get(projectionSelect.getValue()));
});
var precision = new ol.dom.Input(document.getElementById('precision'));
precision.on('change:value', function() {
var format = ol.coordinate.createStringXY(precision.getValue());
control.setCoordinateFormat(format);
var precisionInput = new ol.dom.Input(document.getElementById('precision'));
precisionInput.on('change:value', function() {
var format = ol.coordinate.createStringXY(precisionInput.getValue());
mousePositionControl.setCoordinateFormat(format);
});

View File

@@ -8,11 +8,11 @@ goog.require('ol.layer.TileLayer');
goog.require('ol.source.OSM');
var control = new ol.control.ScaleLine();
var scaleLineControl = new ol.control.ScaleLine();
var map = new ol.Map({
controls: ol.control.defaults({}, [
control
scaleLineControl
]),
layers: [
new ol.layer.TileLayer({
@@ -28,5 +28,5 @@ var map = new ol.Map({
});
var units = new ol.dom.Input(document.getElementById('units'));
units.bindTo('value', control, 'units');
var unitsSelect = new ol.dom.Input(document.getElementById('units'));
unitsSelect.bindTo('value', scaleLineControl, 'units');