patch for improved mousedragging. We were able to test this on my eeepc
and get a very obvious speedup in performance. This adds a configurable 'interval' to the dragpan control (and an interval to the 'drag' control, defaulting to 0px). Patch put together by tcoulter. (Closes #1509) git-svn-id: http://svn.openlayers.org/trunk/openlayers@7608 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -28,14 +28,27 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
panned: false,
|
||||
|
||||
/**
|
||||
* Property: interval
|
||||
* The number of milliseconds that should ellapse before
|
||||
* panning the map again. Set this to increase dragging performance.
|
||||
* Defaults to 25 milliseconds.
|
||||
*/
|
||||
interval: 25,
|
||||
|
||||
/**
|
||||
* Method: draw
|
||||
* Creates a Drag handler, using <panMap> and
|
||||
* <panMapDone> as callbacks.
|
||||
*/
|
||||
draw: function() {
|
||||
this.handler = new OpenLayers.Handler.Drag(this,
|
||||
{"move": this.panMap, "done": this.panMapDone});
|
||||
this.handler = new OpenLayers.Handler.Drag(this, {
|
||||
"move": this.panMap,
|
||||
"done": this.panMapDone
|
||||
}, {
|
||||
interval: this.interval
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,12 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
dragPan: null,
|
||||
|
||||
/**
|
||||
* APIProprety: dragPanOptions
|
||||
* Options passed to the DragPan control.
|
||||
*/
|
||||
dragPanOptions: null,
|
||||
|
||||
/**
|
||||
* Property: zoomBox
|
||||
* {<OpenLayers.Control.ZoomBox>}
|
||||
@@ -41,7 +47,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
* {Boolean} Whether the mousewheel should zoom the map
|
||||
*/
|
||||
zoomWheelEnabled: true,
|
||||
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.Navigation
|
||||
* Create a new navigation control
|
||||
@@ -110,7 +116,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
'double': true,
|
||||
'stopDouble': true
|
||||
});
|
||||
this.dragPan = new OpenLayers.Control.DragPan({map: this.map});
|
||||
this.dragPan = new OpenLayers.Control.DragPan(
|
||||
OpenLayers.Util.extend({map: this.map}, this.dragPanOptions)
|
||||
);
|
||||
this.zoomBox = new OpenLayers.Control.ZoomBox(
|
||||
{map: this.map, keyMask: OpenLayers.Handler.MOD_SHIFT});
|
||||
this.dragPan.draw();
|
||||
|
||||
Reference in New Issue
Block a user