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:
@@ -4,37 +4,40 @@
|
||||
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Handler.js
|
||||
*
|
||||
* Class: OpenLayers.Handler.Feature
|
||||
* Handler to respond to mouse events related to a drawn feature.
|
||||
* Callbacks will be called for over, move, out, up, and down (corresponding
|
||||
* to the equivalent mouse events).
|
||||
*
|
||||
* @class
|
||||
* @requires OpenLayers/Handler.js
|
||||
*/
|
||||
OpenLayers.Handler.Feature = OpenLayers.Class.create();
|
||||
OpenLayers.Handler.Feature.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Handler, {
|
||||
|
||||
/**
|
||||
* @type {Int}
|
||||
* Property: layerIndex
|
||||
* {Int}
|
||||
*/
|
||||
layerIndex: null,
|
||||
|
||||
/**
|
||||
* @type {OpenLayers.Feature.Vector}
|
||||
* Property: feature
|
||||
* {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
feature: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Handler.Feature
|
||||
*
|
||||
* @param {OpenLayers.Control} control
|
||||
* @param {Array} layers List of OpenLayers.Layer.Vector
|
||||
* @param {Array} callbacks An object with a 'over' property whos value is
|
||||
* Parameters:
|
||||
* control - {<OpenLayers.Control>}
|
||||
* layers - {Array} List of OpenLayers.Layer.Vector
|
||||
* callbacks - {Array} An object with a 'over' property whos value is
|
||||
* a function to be called when the mouse is over
|
||||
* a feature. The callback should expect to recieve
|
||||
* a single argument, the feature.
|
||||
* @param {Object} options
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(control, layer, callbacks, options) {
|
||||
OpenLayers.Handler.prototype.initialize.apply(this, [control, callbacks, options]);
|
||||
@@ -42,9 +45,11 @@ OpenLayers.Handler.Feature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: mousedown
|
||||
* Handle mouse down. Call the "down" callback if down on a feature.
|
||||
*
|
||||
* @param {Event} evt
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
mousedown: function(evt) {
|
||||
var selected = this.select('down', evt);
|
||||
@@ -52,11 +57,13 @@ OpenLayers.Handler.Feature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: mousemove
|
||||
* Handle mouse moves. Call the "move" callback if moving over a feature.
|
||||
* Call the "over" callback if moving over a feature for the first time.
|
||||
* Call the "out" callback if moving off of a feature.
|
||||
*
|
||||
* @param {Event} evt
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
mousemove: function(evt) {
|
||||
this.select('move', evt);
|
||||
@@ -64,9 +71,11 @@ OpenLayers.Handler.Feature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle mouse moves. Call the "up" callback if up on a feature.
|
||||
* Method: mouseup
|
||||
* Handle mouse up. Call the "up" callback if up on a feature.
|
||||
*
|
||||
* @param {Event} evt
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
mouseup: function(evt) {
|
||||
var selected = this.select('up', evt);
|
||||
@@ -74,11 +83,13 @@ OpenLayers.Handler.Feature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: dblclick
|
||||
* Capture double-clicks. Let the event continue propagating if the
|
||||
* double-click doesn't hit a feature. Otherwise call the dblclick
|
||||
* callback.
|
||||
*
|
||||
* @param {Event} evt
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
dblclick: function(evt) {
|
||||
var selected = this.select('dblclick', evt);
|
||||
@@ -86,10 +97,14 @@ OpenLayers.Handler.Feature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: select
|
||||
* Trigger the appropriate callback if a feature is under the mouse.
|
||||
*
|
||||
* @param {String} type Callback key
|
||||
* @type {Boolean} A feature was selected
|
||||
* Parameters:
|
||||
* type - {String} Callback key
|
||||
*
|
||||
* Return:
|
||||
* {Boolean} A feature was selected
|
||||
*/
|
||||
select: function(type, evt) {
|
||||
var feature = this.layer.getFeatureFromEvent(evt);
|
||||
@@ -118,9 +133,10 @@ OpenLayers.Handler.Feature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: activate
|
||||
* Turn on the handler. Returns false if the handler was already active.
|
||||
*
|
||||
* @type {Boolean}
|
||||
* Return: {Boolean}
|
||||
*/
|
||||
activate: function() {
|
||||
if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
|
||||
@@ -133,9 +149,10 @@ OpenLayers.Handler.Feature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Turn onf the handler. Returns false if the handler was already active.
|
||||
* Method: activate
|
||||
* Turn of the handler. Returns false if the handler was already active.
|
||||
*
|
||||
* @type {Boolean}
|
||||
* Returns: {Boolean}
|
||||
*/
|
||||
deactivate: function() {
|
||||
if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
|
||||
|
||||
Reference in New Issue
Block a user