source:
trunk/workshop-routing-foss4g/web/GeoExt/examples/zoomslider.js
@
  77
        | Revision 76, 1.5 KB checked in by djay, 14 years ago (diff) | |
|---|---|
| 
 | |
| Rev | Line | |
|---|---|---|
| [76] | 1 | /** | 
| 2 | * Copyright (c) 2008-2010 The Open Source Geospatial Foundation | |
| 3 | * | |
| 4 | * Published under the BSD license. | |
| 5 | * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text | |
| 6 | * of the license. | |
| 7 | */ | |
| 8 | ||
| 9 | /** api: example[zoomslider] | |
| 10 | * Zoom Slider | |
| 11 | * ----------- | |
| 12 | * Use a slider to control map scale. | |
| 13 | */ | |
| 14 | ||
| 15 | var panel, slider; | |
| 16 | ||
| 17 | Ext.onReady(function() { | |
| 18 | ||
| 19 | // create a map panel with an embedded slider | |
| 20 | panel = new GeoExt.MapPanel({ | |
| 21 | title: "Map", | |
| 22 | renderTo: "map-container", | |
| 23 | height: 300, | |
| 24 | width: 400, | |
| 25 | map: { | |
| 26 | controls: [new OpenLayers.Control.Navigation()] | |
| 27 | }, | |
| 28 | layers: [new OpenLayers.Layer.WMS( | |
| 29 | "Global Imagery", | |
| 30 | "http://maps.opengeo.org/geowebcache/service/wms", | |
| 31 | {layers: "bluemarble"} | |
| 32 | )], | |
| 33 | extent: [-5, 35, 15, 55], | |
| 34 | items: [{ | |
| 35 | xtype: "gx_zoomslider", | |
| 36 | vertical: true, | |
| 37 | height: 100, | |
| 38 | x: 10, | |
| 39 | y: 20, | |
| 40 | plugins: new GeoExt.ZoomSliderTip() | |
| 41 | }] | |
| 42 | }); | |
| 43 | ||
| 44 | // create a separate slider bound to the map but displayed elsewhere | |
| 45 | slider = new GeoExt.ZoomSlider({ | |
| 46 | map: panel.map, | |
| 47 | aggressive: true, | |
| 48 | width: 200, | |
| 49 | plugins: new GeoExt.ZoomSliderTip({ | |
| 50 | template: "<div>Zoom Level: {zoom}</div>" | |
| 51 | }), | |
| 52 | renderTo: document.body | |
| 53 | }); | |
| 54 | ||
| 55 | }); | 
Note: See TracBrowser
        for help on using the repository browser.
       
 