Merge all changes from the naturaldocs sandbox. This brings all the work that
has been done in the NaturalDocs branch back to trunk. Thanks to everyone who helped out in making this happen. (I could list people, but the list would be long, and I'm already mentally on vacation.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -3,54 +3,62 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* Handler for dragging a rectangle across the map. Drag is displayed
|
||||
* on mouse down, moves on mouse move, and is finished on mouse up.
|
||||
*
|
||||
* @class
|
||||
* @requires OpenLayers/Handler.js
|
||||
* @requires OpenLayers/Events.js
|
||||
*
|
||||
* Class: OpenLayers.Handler.Drag
|
||||
*/
|
||||
OpenLayers.Handler.Drag = OpenLayers.Class.create();
|
||||
OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler, {
|
||||
/**
|
||||
* When a mousedown event is received, we want to record it, but not set
|
||||
* 'dragging' until the mouse moves after starting.
|
||||
*
|
||||
* @type Boolean
|
||||
* Property: started
|
||||
* {Boolean} When a mousedown event is received, we want to record it, but
|
||||
* not set 'dragging' until the mouse moves after starting.
|
||||
**/
|
||||
started: false,
|
||||
|
||||
/** @type Boolean **/
|
||||
dragging: false,
|
||||
/**
|
||||
* Property: dragging
|
||||
* {Boolean}
|
||||
*/
|
||||
dragging: false,
|
||||
|
||||
/** @type OpenLayers.Pixel **/
|
||||
start: null,
|
||||
/**
|
||||
* Property: start
|
||||
* {<OpenLayers.Pixel>}
|
||||
*/
|
||||
start: null,
|
||||
|
||||
/**
|
||||
* @type Function
|
||||
* @private
|
||||
* Property: oldOnselectstart
|
||||
* *Private*. {Function}
|
||||
*/
|
||||
oldOnselectstart: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {OpenLayers.Control} control
|
||||
* @param {Object} callbacks An object containing a single function to be
|
||||
* Constructor: OpenLayers.Handler.Drag
|
||||
* Returns OpenLayers.Handler.Drag
|
||||
*
|
||||
* Parameters:
|
||||
* control - {<OpenLayers.Control>}
|
||||
* callbacks - {Object} An object containing a single function to be
|
||||
* called when the drag operation is finished.
|
||||
* The callback should expect to recieve a single
|
||||
* argument, the point geometry.
|
||||
* @param {Object} options
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(control, callbacks, options) {
|
||||
OpenLayers.Handler.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: mousedown
|
||||
* Handle mousedown events
|
||||
* @param {Event} evt
|
||||
* @type Boolean
|
||||
* @return Should the event propagate
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*
|
||||
* Return: {Boolean} Should the event propagate
|
||||
*/
|
||||
mousedown: function (evt) {
|
||||
if (this.checkModifiers(evt) && OpenLayers.Event.isLeftClick(evt)) {
|
||||
@@ -67,10 +75,13 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: mousemove
|
||||
* Handle mousemove events
|
||||
* @param {Event} evt
|
||||
* @type Boolean
|
||||
* @return Should the event propagate
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*
|
||||
* Return: {Boolean} Should the event propagate
|
||||
*/
|
||||
mousemove: function (evt) {
|
||||
if (this.started) {
|
||||
@@ -85,10 +96,13 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: mouseup
|
||||
* Handle mouseup events
|
||||
* @param {Event} evt
|
||||
* @type Boolean
|
||||
* @return Should the event propagate
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*
|
||||
* Return: {Boolean} Should the event propagate
|
||||
*/
|
||||
mouseup: function (evt) {
|
||||
if (this.started) {
|
||||
@@ -102,10 +116,13 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: mouseout
|
||||
* Handle mouseout events
|
||||
* @param {Event} evt
|
||||
* @type Boolean
|
||||
* @return Should the event propagate
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*
|
||||
* Return: {Boolean} Should the event propagate
|
||||
*/
|
||||
mouseout: function (evt) {
|
||||
if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.div)) {
|
||||
@@ -122,12 +139,15 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: click
|
||||
* The drag handler captures the click event. If something else registers
|
||||
* for clicks on the same element, its listener will not be called after a
|
||||
* drag.
|
||||
* @param {Event} evt
|
||||
* @type Boolean
|
||||
* @return Should the event propagate
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*
|
||||
* Return: {Boolean} Should the event propagate
|
||||
*/
|
||||
click: function (evt) {
|
||||
// throw away the first left click event that happens after a mouse up
|
||||
@@ -140,9 +160,11 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: activate
|
||||
* Activate the handler.
|
||||
* @type Boolean
|
||||
* @return Was activation successful. Returns false if already active.
|
||||
*
|
||||
* Return: {Boolean} Was activation successful. Returns false if already
|
||||
* active.
|
||||
*/
|
||||
activate: function() {
|
||||
if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
|
||||
@@ -154,9 +176,11 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: deactivate
|
||||
* Deactivate the handler.
|
||||
* @type Boolean
|
||||
* @return Was deactivation successful. Returns false if not already active.
|
||||
*
|
||||
* Return: {Boolean} Was deactivation successful. Returns false if already
|
||||
* active.
|
||||
*/
|
||||
deactivate: function() {
|
||||
if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
|
||||
|
||||
Reference in New Issue
Block a user