Changeset 7608
- Timestamp:
- 07/30/08 12:27:48 (4 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Control/DragPan.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Control/Navigation.js (modified) (3 diffs)
- trunk/openlayers/lib/OpenLayers/Handler/Drag.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Control/DragPan.js
r6833 r7608 30 30 31 31 /** 32 * Property: interval 33 * The number of milliseconds that should ellapse before 34 * panning the map again. Set this to increase dragging performance. 35 * Defaults to 25 milliseconds. 36 */ 37 interval: 25, 38 39 /** 32 40 * Method: draw 33 41 * Creates a Drag handler, using <panMap> and … … 35 43 */ 36 44 draw: function() { 37 this.handler = new OpenLayers.Handler.Drag(this, 38 {"move": this.panMap, "done": this.panMapDone}); 45 this.handler = new OpenLayers.Handler.Drag(this, { 46 "move": this.panMap, 47 "done": this.panMapDone 48 }, { 49 interval: this.interval 50 } 51 ); 39 52 }, 40 53 trunk/openlayers/lib/OpenLayers/Control/Navigation.js
r6462 r7608 31 31 dragPan: null, 32 32 33 /** 34 * APIProprety: dragPanOptions 35 * Options passed to the DragPan control. 36 */ 37 dragPanOptions: null, 38 33 39 /** 34 40 * Property: zoomBox … … 42 48 */ 43 49 zoomWheelEnabled: true, 44 50 45 51 /** 46 52 * Constructor: OpenLayers.Control.Navigation … … 111 117 'stopDouble': true 112 118 }); 113 this.dragPan = new OpenLayers.Control.DragPan({map: this.map}); 119 this.dragPan = new OpenLayers.Control.DragPan( 120 OpenLayers.Util.extend({map: this.map}, this.dragPanOptions) 121 ); 114 122 this.zoomBox = new OpenLayers.Control.ZoomBox( 115 123 {map: this.map, keyMask: OpenLayers.Handler.MOD_SHIFT}); trunk/openlayers/lib/OpenLayers/Handler/Drag.js
r5911 r7608 67 67 */ 68 68 oldOnselectstart: null, 69 70 /** 71 * Property: interval 72 * In order to increase performance, an interval (in milliseconds) 73 * can be set to reduce the number of drag events called. If set, 74 * a new drag event will not be set until the interval has passed. 75 * Defaults to 0, meaning no interval. 76 */ 77 interval: 0, 78 79 /** 80 * Property: timeoutId 81 * The id of the timeout used for the mousedown interval. 82 * This is "private", and should be left alone. 83 */ 84 timeoutId: null, 69 85 70 86 /** … … 192 208 */ 193 209 mousemove: function (evt) { 194 if (this.started) { 195 if(evt.xy.x != this.last.x || evt.xy.y != this.last.y) { 196 this.dragging = true; 197 this.move(evt); 198 this.callback("move", [evt.xy]); 199 if(!this.oldOnselectstart) { 200 this.oldOnselectstart = document.onselectstart; 201 document.onselectstart = function() {return false;}; 202 } 203 this.last = evt.xy; 204 } 210 if (this.started && !this.timeoutId && (evt.xy.x != this.last.x || evt.xy.y != this.last.y)) { 211 if (this.interval > 0) { 212 this.timeoutId = setTimeout(OpenLayers.Function.bind(this.removeTimeout, this), this.interval); 213 } 214 this.dragging = true; 215 this.move(evt); 216 this.callback("move", [evt.xy]); 217 if(!this.oldOnselectstart) { 218 this.oldOnselectstart = document.onselectstart; 219 document.onselectstart = function() {return false;}; 220 } 221 this.last = this.evt.xy; 205 222 } 206 223 return true; 224 }, 225 226 /** 227 * Method: removeTimeout 228 * Private. Called by mousemove() to remove the drag timeout. 229 */ 230 removeTimeout: function() { 231 this.timeoutId = null; 207 232 }, 208 233
