Ticket #1400: panel.7.patch
| File panel.7.patch, 11.3 kB (added by euzuro, 2 months ago) |
|---|
-
theme/default/style.css
old new 223 223 filter: alpha(opacity=50); 224 224 } 225 225 226 /* 227 * Due to current limitations in the OpenLayers code, you can only 228 * replace this image with another image which is 17px x 17px. 229 */ 226 .olControlPanPanel { 227 top: 10px; 228 left: 5px; 229 } 230 231 .olControlPanPanel div { 232 background-image: url(img/pan-panel.png); 233 height: 18px; 234 width: 18px; 235 cursor: pointer; 236 position: absolute; 237 } 238 239 .olControlPanPanel .olControlPanNorthItemInactive { 240 top: 0px; 241 left: 9px; 242 background-position: 0px 0px; 243 } 244 .olControlPanPanel .olControlPanSouthItemInactive { 245 top: 36px; 246 left: 9px; 247 background-position: 18px 0px; 248 } 249 .olControlPanPanel .olControlPanWestItemInactive { 250 position: absolute; 251 top: 18px; 252 left: 0px; 253 background-position: 0px 18px; 254 } 255 .olControlPanPanel .olControlPanEastItemInactive { 256 top: 18px; 257 left: 18px; 258 background-position: 18px 18px; 259 } 260 261 .olControlZoomPanel { 262 top: 71px; 263 left: 14px; 264 } 265 266 .olControlZoomPanel div { 267 background-image: url(img/zoom-panel.png); 268 position: absolute; 269 height: 18px; 270 width: 18px; 271 cursor: pointer; 272 } 273 274 .olControlZoomPanel .olControlZoomInItemInactive { 275 top: 0px; 276 left: 0px; 277 background-position: 0px 0px; 278 } 279 280 .olControlZoomPanel .olControlZoomToMaxExtentItemInactive { 281 top: 18px; 282 left: 0px; 283 background-position: 0px -18px; 284 } 285 286 .olControlZoomPanel .olControlZoomOutItemInactive { 287 top: 36px; 288 left: 0px; 289 background-position: 0px 18px; 290 } 291 230 292 .olPopupCloseBox { 231 293 background: url("img/close.gif") no-repeat; 232 294 cursor: pointer; -
lib/OpenLayers/Control/ZoomPanel.js
old new 1 /** 2 * @requires OpenLayers/Control/Panel.js 3 * @requires OpenLayers/Control/ZoomIn.js 4 * @requires OpenLayers/Control/ZoomOut.js 5 * @requires OpenLayers/Control/ZoomToMaxExtent.js 6 */ 7 8 /** 9 * Class: OpenLayers.Control.ZoomPanel 10 */ 11 OpenLayers.Control.ZoomPanel = OpenLayers.Class(OpenLayers.Control.Panel, { 12 13 /** 14 * Constructor: OpenLayers.Control.ZoomPanel 15 * Add the three zooming controls. 16 * 17 * Parameters: 18 * options - {Object} An optional object whose properties will be used 19 * to extend the control. 20 */ 21 initialize: function(options) { 22 OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); 23 this.addControls([ 24 new OpenLayers.Control.ZoomIn(), 25 new OpenLayers.Control.ZoomToMaxExtent(), 26 new OpenLayers.Control.ZoomOut() 27 ]); 28 }, 29 30 CLASS_NAME: "OpenLayers.Control.ZoomPanel" 31 }); -
lib/OpenLayers/Control/ZoomIn.js
old new 1 /** 2 * @requires OpenLayers/Control.js 3 */ 4 5 /** 6 * Class: OpenLayers.Control.ZoomIn 7 */ 8 OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control, { 9 10 /** 11 * Property: type 12 * {String} The type of <OpenLayers.Control> -- When added to a 13 * <Control.Panel>, 'type' is used by the panel to determine how to 14 * handle our events. 15 */ 16 type: OpenLayers.Control.TYPE_BUTTON, 17 18 /** 19 * Method: trigger 20 */ 21 trigger: function(){ 22 this.map.zoomIn(); 23 }, 24 25 CLASS_NAME: "OpenLayers.Control.ZoomIn" 26 }); -
lib/OpenLayers/Control/ZoomOut.js
old new 1 /** 2 * @requires OpenLayers/Control.js 3 */ 4 5 /** 6 * Class: OpenLayers.Control.ZoomOut 7 */ 8 OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control, { 9 10 /** 11 * Property: type 12 * {String} The type of <OpenLayers.Control> -- When added to a 13 * <Control.Panel>, 'type' is used by the panel to determine how to 14 * handle our events. 15 */ 16 type: OpenLayers.Control.TYPE_BUTTON, 17 18 /** 19 * Method: trigger 20 */ 21 trigger: function(){ 22 this.map.zoomOut(); 23 }, 24 25 CLASS_NAME: "OpenLayers.Control.ZoomOut" 26 }); -
lib/OpenLayers/Control/Pan.js
old new 1 /** 2 * @requires OpenLayers/Control.js 3 */ 4 5 /** 6 * Class: OpenLayers.Control.Pan 7 */ 8 OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, { 9 10 /** 11 * APIProperty: slideFactor 12 * {Integer} Number of pixels by which we'll pan the map in any direction 13 * on clicking the arrow buttons. 14 */ 15 slideFactor: 50, 16 17 /** 18 * Property: direction 19 * {String} in {'North', 'South', 'East', 'West'} 20 */ 21 direction: null, 22 23 /** 24 * Property: type 25 * {String} The type of <OpenLayers.Control> -- When added to a 26 * <Control.Panel>, 'type' is used by the panel to determine how to 27 * handle our events. 28 */ 29 type: OpenLayers.Control.TYPE_BUTTON, 30 31 /** 32 * Constructor: OpenLayers.Control.Pan 33 * Control which handles the panning (in any of the cardinal directions) 34 * of the map by a set px distance. 35 * 36 * Parameters: 37 * direction - {String} The direction this button should pan. 38 * options - {Object} An optional object whose properties will be used 39 * to extend the control. 40 */ 41 initialize: function(direction, options) { 42 43 this.direction = direction; 44 this.CLASS_NAME += this.direction; 45 46 OpenLayers.Control.prototype.initialize.apply(this, [options]); 47 }, 48 49 /** 50 * Method: trigger 51 */ 52 trigger: function(){ 53 54 switch (this.direction) { 55 case OpenLayers.Control.Pan.NORTH: 56 this.map.pan(0, -this.slideFactor); 57 break; 58 case OpenLayers.Control.Pan.SOUTH: 59 this.map.pan(0, this.slideFactor); 60 break; 61 case OpenLayers.Control.Pan.WEST: 62 this.map.pan(-this.slideFactor, 0); 63 break; 64 case OpenLayers.Control.Pan.EAST: 65 this.map.pan(this.slideFactor, 0); 66 break; 67 } 68 }, 69 70 CLASS_NAME: "OpenLayers.Control.Pan" 71 }); 72 73 OpenLayers.Control.Pan.NORTH = "North"; 74 OpenLayers.Control.Pan.SOUTH = "South"; 75 OpenLayers.Control.Pan.EAST = "East"; 76 OpenLayers.Control.Pan.WEST = "West"; -
lib/OpenLayers/Control/ZoomToMaxExtent.js
old new 15 15 * - <OpenLayers.Control> 16 16 */ 17 17 OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class(OpenLayers.Control, { 18 18 19 /** 19 20 * Property: type 20 * TYPE_BUTTON. 21 * {String} The type of <OpenLayers.Control> -- When added to a 22 * <Control.Panel>, 'type' is used by the panel to determine how to 23 * handle our events. 21 24 */ 22 25 type: OpenLayers.Control.TYPE_BUTTON, 23 26 -
lib/OpenLayers/Control/PanPanel.js
old new 1 /** 2 * @requires OpenLayers/Control/Panel.js 3 * @requires OpenLayers/Control/Pan.js 4 */ 5 6 /** 7 * Class: OpenLayers.Control.PanPanel 8 */ 9 OpenLayers.Control.PanPanel = OpenLayers.Class(OpenLayers.Control.Panel, { 10 11 /** 12 * Constructor: OpenLayers.Control.PanPanel 13 * Add the four directional pan buttons. 14 * 15 * Parameters: 16 * options - {Object} An optional object whose properties will be used 17 * to extend the control. 18 */ 19 initialize: function(options) { 20 OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); 21 this.addControls([ 22 new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH), 23 new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH), 24 new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST), 25 new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST) 26 ]); 27 }, 28 29 CLASS_NAME: "OpenLayers.Control.PanPanel" 30 }); -
lib/OpenLayers.js
old new 210 210 "OpenLayers/Layer/WFS.js", 211 211 "OpenLayers/Control/MouseToolbar.js", 212 212 "OpenLayers/Control/NavToolbar.js", 213 "OpenLayers/Control/PanPanel.js", 214 "OpenLayers/Control/Pan.js", 215 "OpenLayers/Control/ZoomIn.js", 216 "OpenLayers/Control/ZoomOut.js", 217 "OpenLayers/Control/ZoomPanel.js", 213 218 "OpenLayers/Control/EditingToolbar.js", 214 219 "OpenLayers/Lang.js", 215 220 "OpenLayers/Lang/en.js" -
examples/pan-zoom-panels.html
old new 1 <html> 2 <head> 3 <title>Pan and Zoom Panels</title> 4 <link rel="stylesheet" href="../theme/default/style.css" type="text/css" /> 5 <link rel="stylesheet" href="style.css" type="text/css" /> 6 <script type="text/javascript" src="../lib/OpenLayers.js"></script> 7 <script> 8 var map; 9 var lon = 5; 10 var lat = 40; 11 var zoom = 5; 12 function init(){ 13 map = new OpenLayers.Map("map", { 14 controls: [ 15 new OpenLayers.Control.Navigation(), 16 new OpenLayers.Control.PanPanel(), 17 new OpenLayers.Control.ZoomPanel() 18 ] 19 }); 20 21 var wms = new OpenLayers.Layer.WMS( 22 "OpenLayers WMS", 23 "http://labs.metacarta.com/wms/vmap0", 24 {layers: 'basic'} 25 ); 26 map.addLayers([wms]); 27 28 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 29 } 30 </script> 31 </head> 32 <body onload='init();'> 33 <h1 id="title">Pan and Zoom Panels</h1> 34 <div id="tags"></div> 35 <p id="shortdesc">Customizable pan and zoom panels</p> 36 </p> 37 <div id="map" class="smallmap"></div> 38 <p id="docs"> 39 The pan and zoom panels allow you to use CSS styling to change the 40 look and feel of the panels, including changing their position 41 and their icons without needing to change any code. 42 </p> 43 </body> 44 </html>
