1
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
2
|
* full list of contributors). Published under the 2-clause BSD license.
|
3
|
* See license.txt in the OpenLayers distribution or repository for the
|
4
|
* full text of the license. */
|
5
|
|
6
|
/**
|
7
|
* @requires OpenLayers/Control/Panel.js
|
8
|
* @requires OpenLayers/Control/Pan.js
|
9
|
*/
|
10
|
|
11
|
/**
|
12
|
* Class: OpenLayers.Control.PanPanel
|
13
|
* The PanPanel is visible control for panning the map North, South, East or
|
14
|
* West in small steps. By default it is drawn in the top left corner of the
|
15
|
* map.
|
16
|
*
|
17
|
* Note:
|
18
|
* If you wish to use this class with the default images and you want
|
19
|
* it to look nice in ie6, you should add the following, conditionally
|
20
|
* added css stylesheet to your HTML file:
|
21
|
*
|
22
|
* (code)
|
23
|
* <!--[if lte IE 6]>
|
24
|
* <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
|
25
|
* <![endif]-->
|
26
|
* (end)
|
27
|
*
|
28
|
* Inherits from:
|
29
|
* - <OpenLayers.Control.Panel>
|
30
|
*/
|
31
|
OpenLayers.Control.PanPanel = OpenLayers.Class(OpenLayers.Control.Panel, {
|
32
|
|
33
|
/**
|
34
|
* APIProperty: slideFactor
|
35
|
* {Integer} Number of pixels by which we'll pan the map in any direction
|
36
|
* on clicking the arrow buttons, defaults to 50. If you want to pan
|
37
|
* by some ratio of the map dimensions, use <slideRatio> instead.
|
38
|
*/
|
39
|
slideFactor: 50,
|
40
|
|
41
|
/**
|
42
|
* APIProperty: slideRatio
|
43
|
* {Number} The fraction of map width/height by which we'll pan the map
|
44
|
* on clicking the arrow buttons. Default is null. If set, will
|
45
|
* override <slideFactor>. E.g. if slideRatio is .5, then Pan Up will
|
46
|
* pan up half the map height.
|
47
|
*/
|
48
|
slideRatio: null,
|
49
|
|
50
|
/**
|
51
|
* Constructor: OpenLayers.Control.PanPanel
|
52
|
* Add the four directional pan buttons.
|
53
|
*
|
54
|
* Parameters:
|
55
|
* options - {Object} An optional object whose properties will be used
|
56
|
* to extend the control.
|
57
|
*/
|
58
|
initialize: function(options) {
|
59
|
OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
|
60
|
var options = {
|
61
|
slideFactor: this.slideFactor,
|
62
|
slideRatio: this.slideRatio
|
63
|
};
|
64
|
this.addControls([
|
65
|
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH, options),
|
66
|
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH, options),
|
67
|
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST, options),
|
68
|
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST, options)
|
69
|
]);
|
70
|
},
|
71
|
|
72
|
CLASS_NAME: "OpenLayers.Control.PanPanel"
|
73
|
});
|