OpenLayers OpenLayers

Ticket #1400: panels.4.patch

File panels.4.patch, 14.1 kB (added by euzuro, 2 months ago)

last few changes to proposed patch

  • theme/default/style.css

    old new  
    223223    filter: alpha(opacity=50); 
    224224}    
    225225 
    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    height: 18px; 
     233    width: 18px; 
     234    cursor: pointer; 
     235    position: absolute; 
     236
     237 
     238.olControlPanPanel .olControlPanButtonNorthItemInactive { 
     239    top: 0px; 
     240    left: 9px; 
     241    background-image: url(img/north-mini.png); 
     242
     243.olControlPanPanel .olControlPanButtonSouthItemInactive { 
     244    top: 36px; 
     245    left: 9px; 
     246    background-image: url(img/south-mini.png); 
     247
     248.olControlPanPanel .olControlPanButtonWestItemInactive { 
     249    position: absolute; 
     250    top: 18px; 
     251    left: 0px; 
     252    background-image: url(img/west-mini.png); 
     253
     254.olControlPanPanel .olControlPanButtonEastItemInactive { 
     255    top: 18px; 
     256    left: 18px; 
     257    background-image: url(img/east-mini.png); 
     258
     259 
     260.olControlZoomPanel { 
     261    top: 71px; 
     262    left: 14px; 
     263}  
     264 
     265.olControlZoomPanel div { 
     266    position: absolute; 
     267    height: 18px; 
     268    width: 18px; 
     269    cursor: pointer; 
     270
     271 
     272.olControlZoomPanel .olControlZoomInButtonItemInactive { 
     273    top: 0px; 
     274    left: 0px; 
     275    background-image: url(img/zoom-plus-mini.png); 
     276
     277 
     278.olControlZoomPanel .olControlZoomToMaxExtentItemInactive { 
     279    top: 18px; 
     280    left: 0px; 
     281    background-image: url(img/zoom-world-mini.png); 
     282
     283 
     284.olControlZoomPanel .olControlZoomOutButtonItemInactive { 
     285    top: 36px; 
     286    left: 0px; 
     287    background-image: url(img/zoom-minus-mini.png); 
     288
     289 
    230290.olPopupCloseBox { 
    231291  background: url("img/close.gif") no-repeat; 
    232292  cursor: pointer; 
  • lib/OpenLayers/Control/ZoomPanel.js

    old new  
     1/** 
     2 * @requires OpenLayers/Control/Panel.js 
     3 * @requires OpenLayers/Control/ZoomInButton.js 
     4 * @requires OpenLayers/Control/ZoomOutButton.js 
     5 * @requires OpenLayers/Control/ZoomToMaxExtent.js 
     6 */ 
     7 
     8/** 
     9 * Class: OpenLayers.Control.ZoomPanel 
     10 */ 
     11OpenLayers.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.ZoomInButton(), 
     25          new OpenLayers.Control.ZoomToMaxExtent(), 
     26          new OpenLayers.Control.ZoomOutButton() 
     27        ]); 
     28    }, 
     29 
     30    CLASS_NAME: "OpenLayers.Control.ZoomPanel" 
     31}); 
  • lib/OpenLayers/Control/ZoomInButton.js

    old new  
     1/** 
     2 *  
     3 * @requires OpenLayers/Control.js 
     4 */ 
     5 
     6/** 
     7 * Class: OpenLayers.Control.ZoomInButton 
     8 */ 
     9OpenLayers.Control.ZoomInButton = OpenLayers.Class(OpenLayers.Control, { 
     10 
     11    /** 
     12     * Property: type 
     13     * {String} The type of <OpenLayers.Control> -- When added to a  
     14     *     <Control.Panel>, 'type' is used by the panel to determine how to  
     15     *     handle our events. 
     16     */ 
     17    type: OpenLayers.Control.TYPE_BUTTON, 
     18     
     19    /** 
     20     * Method: trigger 
     21     */ 
     22    trigger: function(){ 
     23        this.map.zoomIn(); 
     24    }, 
     25 
     26    CLASS_NAME: "OpenLayers.Control.ZoomInButton" 
     27}); 
  • lib/OpenLayers/Control/ZoomOutButton.js

    old new  
     1/** 
     2 *  
     3 * @requires OpenLayers/Control.js 
     4 */ 
     5 
     6/** 
     7 * Class: OpenLayers.Control.ZoomInButton 
     8 */ 
     9OpenLayers.Control.ZoomOutButton = OpenLayers.Class(OpenLayers.Control, { 
     10 
     11    /** 
     12     * Property: type 
     13     * {String} The type of <OpenLayers.Control> -- When added to a  
     14     *     <Control.Panel>, 'type' is used by the panel to determine how to  
     15     *     handle our events. 
     16     */ 
     17    type: OpenLayers.Control.TYPE_BUTTON, 
     18     
     19    /** 
     20     * Method: trigger 
     21     */ 
     22    trigger: function(){ 
     23        this.map.zoomOut(); 
     24    }, 
     25 
     26    CLASS_NAME: "OpenLayers.Control.ZoomOutButton" 
     27}); 
  • lib/OpenLayers/Control/PanButton.js

    old new  
     1/** 
     2 *  
     3 * @requires OpenLayers/Control.js 
     4 */ 
     5 
     6/** 
     7 * Class: OpenLayers.Control.PanButton 
     8 */ 
     9OpenLayers.Control.PanButton = OpenLayers.Class(OpenLayers.Control, { 
     10 
     11    /**  
     12     * APIProperty: slideFactor 
     13     * {Integer} Number of pixels by which we'll pan the map in any direction  
     14     *     on clicking the arrow buttons.  
     15     */ 
     16    slideFactor: 50, 
     17 
     18    /**  
     19     * Property: direction 
     20     * {String} in {'North', 'South', 'East', 'West'} 
     21     */ 
     22    direction: null, 
     23 
     24    /** 
     25     * Property: type 
     26     * {String} The type of <OpenLayers.Control> -- When added to a  
     27     *     <Control.Panel>, 'type' is used by the panel to determine how to  
     28     *     handle our events. 
     29     */ 
     30    type: OpenLayers.Control.TYPE_BUTTON, 
     31 
     32    /** 
     33     * Constructor: OpenLayers.Control.PanButton  
     34     * Add our two mousedefaults controls. 
     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(dir, options) { 
     42     
     43        this.direction = dir; 
     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.PanButton.NORTH:  
     56                this.map.pan(0, -this.slideFactor); 
     57                break; 
     58            case OpenLayers.Control.PanButton.SOUTH:  
     59                this.map.pan(0, this.slideFactor); 
     60                break; 
     61            case OpenLayers.Control.PanButton.WEST:  
     62                this.map.pan(-this.slideFactor, 0); 
     63                break; 
     64            case OpenLayers.Control.PanButton.EAST:  
     65                this.map.pan(this.slideFactor, 0); 
     66                break; 
     67        } 
     68    }, 
     69 
     70    CLASS_NAME: "OpenLayers.Control.PanButton" 
     71}); 
     72 
     73OpenLayers.Control.PanButton.NORTH = "North"; 
     74OpenLayers.Control.PanButton.SOUTH = "South"; 
     75OpenLayers.Control.PanButton.EAST = "East"; 
     76OpenLayers.Control.PanButton.WEST = "West"; 
  • lib/OpenLayers/Control/ZoomToMaxExtent.js

    old new  
    1515 *  - <OpenLayers.Control> 
    1616 */ 
    1717OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class(OpenLayers.Control, { 
     18 
    1819    /** 
    1920     * 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. 
    2124     */ 
    2225    type: OpenLayers.Control.TYPE_BUTTON, 
    2326     
  • lib/OpenLayers/Control/PanPanel.js

    old new  
     1/** 
     2 * @requires OpenLayers/Control/Panel.js 
     3 * @requires OpenLayers/Control/PanButton.js 
     4 */ 
     5 
     6/** 
     7 * Class: OpenLayers.Control.PanPanel 
     8 */ 
     9OpenLayers.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.PanButton(OpenLayers.Control.PanButton.NORTH), 
     23          new OpenLayers.Control.PanButton(OpenLayers.Control.PanButton.SOUTH), 
     24          new OpenLayers.Control.PanButton(OpenLayers.Control.PanButton.EAST), 
     25          new OpenLayers.Control.PanButton(OpenLayers.Control.PanButton.WEST) 
     26        ]); 
     27    }, 
     28 
     29    CLASS_NAME: "OpenLayers.Control.PanPanel" 
     30}); 
  • lib/OpenLayers.js

    old new  
    210210            "OpenLayers/Layer/WFS.js", 
    211211            "OpenLayers/Control/MouseToolbar.js", 
    212212            "OpenLayers/Control/NavToolbar.js", 
     213            "OpenLayers/Control/PanPanel.js", 
     214            "OpenLayers/Control/PanButton.js", 
     215            "OpenLayers/Control/ZoomInButton.js", 
     216            "OpenLayers/Control/ZoomOutButton.js", 
     217            "OpenLayers/Control/ZoomPanel.js", 
    213218            "OpenLayers/Control/EditingToolbar.js", 
    214219            "OpenLayers/Lang.js", 
    215220            "OpenLayers/Lang/en.js" 
  • examples/pan-zoom-panels.html

    old new  
     1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
     2    "http://www.w3.org/TR/html4/loose.dtd"> 
     3<html> 
     4<head> 
     5    <title>Pan and Zoom Panels</title> 
     6    <style> 
     7    #mapDiv { 
     8        height: 256px; 
     9        width: 512px; 
     10    } 
     11    </style> 
     12    <script type="text/javascript" src="../lib/OpenLayers.js"></script> 
     13    <script> 
     14    var map; 
     15    var lon = 5; 
     16    var lat = 40; 
     17    var zoom = 5; 
     18    function init(){ 
     19        map = new OpenLayers.Map( 'mapDiv', {controls: []} ); 
     20         
     21        var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
     22                  "http://labs.metacarta.com/wms/vmap0", 
     23                  {layers: 'basic'} ); 
     24        map.addLayers([wms]); 
     25         
     26        map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 
     27        map.addControl( new OpenLayers.Control.PanPanel() ); 
     28        map.addControl( new OpenLayers.Control.ZoomPanel() ); 
     29    } 
     30    </script> 
     31</head> 
     32<body onload='init();'> 
     33<h1>Pan and Zoom Panels</h1> 
     34<div id="mapDiv"></div> 
     35<p>The pan and zoom panels allow you to use CSS styling to change the 
     36   look and feel of the panels, including changing their position 
     37   and their icons without needing to change any code. 
     38</p>    
     39</body> 
     40</html>