From a46e251eb28ef442c9179ecdcb14890a46803a43 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 28 Sep 2012 12:53:44 +0200 Subject: [PATCH] Update demos to use new controls system --- demos/full-screen/full-screen.js | 5 ----- demos/side-by-side/side-by-side.js | 29 +++++++++++++---------------- demos/two-layers/two-layers.js | 9 ++++----- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/demos/full-screen/full-screen.js b/demos/full-screen/full-screen.js index c0384a8be2..c7ce3c6796 100644 --- a/demos/full-screen/full-screen.js +++ b/demos/full-screen/full-screen.js @@ -5,7 +5,6 @@ goog.require('ol.Collection'); goog.require('ol.Coordinate'); goog.require('ol.Map'); goog.require('ol.MapOptions'); // FIXME this should not be required -goog.require('ol.control.Zoom'); goog.require('ol.source.MapQuestOpenAerial'); @@ -23,7 +22,3 @@ var map = new ol.Map(document.getElementById('map'), { layers: new ol.Collection([layer]), zoom: 2 }); -var zoom = new ol.control.Zoom({ - delta: 4, - map: map -}); diff --git a/demos/side-by-side/side-by-side.js b/demos/side-by-side/side-by-side.js index 6406ed9952..9196fc9bae 100644 --- a/demos/side-by-side/side-by-side.js +++ b/demos/side-by-side/side-by-side.js @@ -28,6 +28,17 @@ var domMap = new ol.Map(document.getElementById('domMap'), { zoom: 0 }); +domMap.getControls().push(new ol.control.Attribution({ + target: document.getElementById('attribution') +})); + +domMap.getControls().push(new ol.control.MousePosition({ + coordinateFormat: ol.CoordinateFormat.hdms, + projection: ol.Projection.getFromCode('EPSG:4326'), + target: document.getElementById('domMousePosition'), + undefinedHtml: ' ' +})); + var webglMap = new ol.Map(document.getElementById('webglMap'), { renderer: ol.RendererHint.WEBGL }); @@ -38,26 +49,12 @@ if (!goog.isNull(webglMap)) { webglMap.bindTo('rotation', domMap); } -var attributionControl = new ol.control.Attribution({ - map: domMap, - target: document.getElementById('attribution') -}); - -var domMousePositionControl = new ol.control.MousePosition({ +webglMap.getControls().push(new ol.control.MousePosition({ coordinateFormat: ol.CoordinateFormat.hdms, - map: domMap, - projection: ol.Projection.getFromCode('EPSG:4326'), - target: document.getElementById('domMousePosition'), - undefinedHtml: ' ' -}); - -var webglMousePositionControl = new ol.control.MousePosition({ - coordinateFormat: ol.CoordinateFormat.hdms, - map: webglMap, projection: ol.Projection.getFromCode('EPSG:4326'), target: document.getElementById('webglMousePosition'), undefinedHtml: ' ' -}); +})); var keyboardInteraction = new ol.interaction.Keyboard(); keyboardInteraction.addCallback('0', function() { diff --git a/demos/two-layers/two-layers.js b/demos/two-layers/two-layers.js index 54a0a662a4..d0e1e51c88 100644 --- a/demos/two-layers/two-layers.js +++ b/demos/two-layers/two-layers.js @@ -31,6 +31,10 @@ var webglMap = new ol.Map(document.getElementById('webglMap'), { zoom: 5 }); +webglMap.getControls().push(new ol.control.Attribution({ + target: document.getElementById('attribution') +})); + var domMap = new ol.Map(document.getElementById('domMap'), { renderer: ol.RendererHint.DOM }); @@ -38,8 +42,3 @@ domMap.bindTo('center', webglMap); domMap.bindTo('layers', webglMap); domMap.bindTo('resolution', webglMap); domMap.bindTo('rotation', webglMap); - -var attributionControl = new ol.control.Attribution({ - map: webglMap, - target: document.getElementById('attribution') -});