~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/openlayers/lib/OpenLayers/Control/Pan.js

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
 
2
 * license.  See http://svn.openlayers.org/trunk/openlayers/license.txt for the
 
3
 * full text of the license. */
 
4
 
 
5
/**
 
6
 * @requires OpenLayers/Control.js
 
7
 */
 
8
 
 
9
/**
 
10
 * Class: OpenLayers.Control.Pan
 
11
 *
 
12
 * Inherits from:
 
13
 *  - <OpenLayers.Control>
 
14
 */
 
15
OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
 
16
 
 
17
    /** 
 
18
     * APIProperty: slideFactor
 
19
     * {Integer} Number of pixels by which we'll pan the map in any direction 
 
20
     *     on clicking the arrow buttons. 
 
21
     */
 
22
    slideFactor: 50,
 
23
 
 
24
    /** 
 
25
     * Property: direction
 
26
     * {String} in {'North', 'South', 'East', 'West'}
 
27
     */
 
28
    direction: null,
 
29
 
 
30
    /**
 
31
     * Property: type
 
32
     * {String} The type of <OpenLayers.Control> -- When added to a 
 
33
     *     <Control.Panel>, 'type' is used by the panel to determine how to 
 
34
     *     handle our events.
 
35
     */
 
36
    type: OpenLayers.Control.TYPE_BUTTON,
 
37
 
 
38
    /**
 
39
     * Constructor: OpenLayers.Control.Pan 
 
40
     * Control which handles the panning (in any of the cardinal directions)
 
41
     *     of the map by a set px distance. 
 
42
     *
 
43
     * Parameters:
 
44
     * direction - {String} The direction this button should pan.
 
45
     * options - {Object} An optional object whose properties will be used
 
46
     *     to extend the control.
 
47
     */
 
48
    initialize: function(direction, options) {
 
49
    
 
50
        this.direction = direction;
 
51
        this.CLASS_NAME += this.direction;
 
52
        
 
53
        OpenLayers.Control.prototype.initialize.apply(this, [options]);
 
54
    },
 
55
    
 
56
    /**
 
57
     * Method: trigger
 
58
     */
 
59
    trigger: function(){
 
60
    
 
61
        switch (this.direction) {
 
62
            case OpenLayers.Control.Pan.NORTH: 
 
63
                this.map.pan(0, -this.slideFactor);
 
64
                break;
 
65
            case OpenLayers.Control.Pan.SOUTH: 
 
66
                this.map.pan(0, this.slideFactor);
 
67
                break;
 
68
            case OpenLayers.Control.Pan.WEST: 
 
69
                this.map.pan(-this.slideFactor, 0);
 
70
                break;
 
71
            case OpenLayers.Control.Pan.EAST: 
 
72
                this.map.pan(this.slideFactor, 0);
 
73
                break;
 
74
        }
 
75
    },
 
76
 
 
77
    CLASS_NAME: "OpenLayers.Control.Pan"
 
78
});
 
79
 
 
80
OpenLayers.Control.Pan.NORTH = "North";
 
81
OpenLayers.Control.Pan.SOUTH = "South";
 
82
OpenLayers.Control.Pan.EAST = "East";
 
83
OpenLayers.Control.Pan.WEST = "West";
 
 
b'\\ No newline at end of file'