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,64 +4,77 @@
|
||||
|
||||
|
||||
/**
|
||||
* Draws features on a vector layer when active.
|
||||
*
|
||||
* @class
|
||||
* @requires OpenLayers/Control.js
|
||||
* @requires OpenLayers/Feature/Vector.js
|
||||
*
|
||||
* Class: OpenLayers.Control.SelectFeature
|
||||
* Draws features on a vector layer when active.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Control>
|
||||
*/
|
||||
OpenLayers.Control.SelectFeature = OpenLayers.Class.create();
|
||||
OpenLayers.Control.SelectFeature.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* @type {Boolean} Allow selection of multiple geometries
|
||||
* APIProperty: multiple
|
||||
* {Boolean} Allow selection of multiple geometries
|
||||
*/
|
||||
multiple: false,
|
||||
|
||||
/**
|
||||
* @type {Boolean} Select on mouse over and deselect on mouse out. If
|
||||
* true, this ignores clicks and only listens to mouse moves.
|
||||
* APIProperty: hover
|
||||
* {Boolean} Select on mouse over and deselect on mouse out. If true, this
|
||||
* ignores clicks and only listens to mouse moves.
|
||||
*/
|
||||
hover: false,
|
||||
|
||||
/**
|
||||
* @type {Function} Optional function to be called when a feature is selected.
|
||||
* The function should expect to be called with a feature.
|
||||
* APIProperty: onSelect
|
||||
* {Function} Optional function to be called when a feature is selected.
|
||||
* The function should expect to be called with a feature.
|
||||
*/
|
||||
onSelect: function() {},
|
||||
|
||||
/**
|
||||
* @type {Function} Optional function to be called when a feature is unselected.
|
||||
* APIProperty: onUnselect
|
||||
* {Function} Optional function to be called when a feature is unselected.
|
||||
* The function should expect to be called with a feature.
|
||||
*/
|
||||
onUnselect: function() {},
|
||||
|
||||
/**
|
||||
* @type {OpenLayers.Layer.Vector}
|
||||
* Property: layer
|
||||
* {<OpenLayers.Layer.Vector>}
|
||||
*/
|
||||
layer: null,
|
||||
|
||||
/**
|
||||
* @type {Object} The functions that are sent to the handler for callback
|
||||
* APIProperty: callbacks
|
||||
* {Object} The functions that are sent to the handler for callback
|
||||
*/
|
||||
callbacks: null,
|
||||
|
||||
/**
|
||||
* @type {Object} Hash of styles
|
||||
* APIProperty: selectStyle
|
||||
* {Object} Hash of styles
|
||||
*/
|
||||
selectStyle: OpenLayers.Feature.Vector.style['select'],
|
||||
|
||||
/**
|
||||
* @type {OpenLayers.Handler.Feature}
|
||||
* @private
|
||||
* Property: handler
|
||||
* {<OpenLayers.Handler.Feature>}
|
||||
*/
|
||||
handler: null,
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Layer.Vector} layer
|
||||
* @param {OpenLayers.Handler} handler
|
||||
* @param {Object} options
|
||||
* Constructor: <OpenLayers.Control.SelectFeature>
|
||||
*
|
||||
* Parameters:
|
||||
* layer - {<OpenLayers.Layer.Vector>}
|
||||
* handler - {<OpenLayers.Handler>}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(layer, options) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
@@ -75,8 +88,11 @@ OpenLayers.Control.SelectFeature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: downFeature
|
||||
* Called when the feature handler detects a mouse-down on a feature
|
||||
* @param {OpenLayers.Vector.Feature}
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Vector.Feature>}
|
||||
*/
|
||||
downFeature: function(feature) {
|
||||
if(this.hover) {
|
||||
@@ -103,9 +119,12 @@ OpenLayers.Control.SelectFeature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: overFeature
|
||||
* Called when the feature handler detects a mouse-over on a feature.
|
||||
* Only responds if this.hover is true.
|
||||
* @param {OpenLayers.Feature.Vector}
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
overFeature: function(feature) {
|
||||
if(!this.hover) {
|
||||
@@ -117,9 +136,12 @@ OpenLayers.Control.SelectFeature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: outFeature
|
||||
* Called when the feature handler detects a mouse-out on a feature.
|
||||
* Only responds if this.hover is true.
|
||||
* @param {OpenLayers.Feature.Vector}
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
outFeature: function(feature) {
|
||||
if(!this.hover) {
|
||||
@@ -129,9 +151,12 @@ OpenLayers.Control.SelectFeature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: select
|
||||
* Add feature to the layer's selectedFeature array, render the feature as
|
||||
* selected, and call the onSelect function.
|
||||
* @param {OpenLayers.Feature.Vector} feature
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
select: function(feature) {
|
||||
// Store feature style for restoration later
|
||||
@@ -144,9 +169,12 @@ OpenLayers.Control.SelectFeature.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: unselect
|
||||
* Remove feature from the layer's selectedFeature array, render the feature as
|
||||
* normal, and call the onUnselect function.
|
||||
* @param {OpenLayers.Feature.Vector} feature
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
unselect: function(feature) {
|
||||
// Store feature style for restoration later
|
||||
@@ -158,9 +186,12 @@ OpenLayers.Control.SelectFeature.prototype =
|
||||
this.onUnselect(feature);
|
||||
},
|
||||
|
||||
/** Set the map property for the control.
|
||||
/**
|
||||
* Method: setMap
|
||||
* Set the map property for the control.
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
this.handler.setMap(map);
|
||||
|
||||
Reference in New Issue
Block a user