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. */
6 * @requires OpenLayers/Control.js
7 * @requires OpenLayers/Handler/Drag.js
11 * Class: OpenLayers.Control.DragPan
12 * The DragPan control pans the map with a drag of the mouse.
15 * - <OpenLayers.Control>
17 OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
21 * {OpenLayers.Control.TYPES}
23 type: OpenLayers.Control.TYPE_TOOL,
27 * {Boolean} The map moved.
33 * {Integer} The number of milliseconds that should ellapse before
34 * panning the map again. Set this to increase dragging performance.
35 * Defaults to 25 milliseconds.
41 * Creates a Drag handler, using <panMap> and
42 * <panMapDone> as callbacks.
45 this.handler = new OpenLayers.Handler.Drag(this, {
47 "done": this.panMapDone
49 interval: this.interval
58 * xy - {<OpenLayers.Pixel>} Pixel of the mouse position
60 panMap: function(xy) {
63 this.handler.last.x - xy.x,
64 this.handler.last.y - xy.y,
65 {dragging: this.handler.dragging, animate: false}
71 * Finish the panning operation. Only call setCenter (through <panMap>)
72 * if the map has actually been moved.
75 * xy - {<OpenLayers.Pixel>} Pixel of the mouse position
77 panMapDone: function(xy) {
84 CLASS_NAME: "OpenLayers.Control.DragPan"