Merge vector-2.4 branch back to trunk.
svn merge sandbox/vector-2.4/@2307 sandbox/vector-2.4/@HEAD trunk/openlayers/ git-svn-id: http://svn.openlayers.org/trunk/openlayers@2803 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -2,11 +2,15 @@
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
OpenLayers.Control = OpenLayers.Class.create();
|
||||
|
||||
OpenLayers.Control.TYPE_BUTTON = 1;
|
||||
OpenLayers.Control.TYPE_TOGGLE = 2;
|
||||
OpenLayers.Control.TYPE_TOOL = 3;
|
||||
|
||||
OpenLayers.Control.prototype = {
|
||||
|
||||
/** @type String */
|
||||
@@ -19,11 +23,27 @@ OpenLayers.Control.prototype = {
|
||||
/** @type DOMElement */
|
||||
div: null,
|
||||
|
||||
/** @type OpenLayers.Pixel */
|
||||
position: null,
|
||||
/**
|
||||
* Controls can have a 'type'. The type determines the type of interactions
|
||||
* which are possible with them when they are placed into a toolbar.
|
||||
* @type OpenLayers.Control.TYPES
|
||||
*/
|
||||
type: null,
|
||||
|
||||
/** @type OpenLayers.Pixel */
|
||||
mouseDragStart: null,
|
||||
/** This property is used for CSS related to the drawing of the Control.
|
||||
* @type string
|
||||
*/
|
||||
displayClass: "",
|
||||
|
||||
/**
|
||||
* @type boolean
|
||||
*/
|
||||
active: null,
|
||||
|
||||
/**
|
||||
* @type OpenLayers.Handler
|
||||
*/
|
||||
handler: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -31,6 +51,10 @@ OpenLayers.Control.prototype = {
|
||||
* @param {Object} options
|
||||
*/
|
||||
initialize: function (options) {
|
||||
// We do this before the extend so that instances can override
|
||||
// className in options.
|
||||
this.displayClass = this.CLASS_NAME.replace("OpenLayers.", "ol").replace(".","");
|
||||
|
||||
OpenLayers.Util.extend(this, options);
|
||||
|
||||
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
||||
@@ -52,6 +76,9 @@ OpenLayers.Control.prototype = {
|
||||
*/
|
||||
setMap: function(map) {
|
||||
this.map = map;
|
||||
if (this.handler) {
|
||||
this.handler.setMap(map);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -64,7 +91,7 @@ OpenLayers.Control.prototype = {
|
||||
if (this.div == null) {
|
||||
this.div = OpenLayers.Util.createDiv();
|
||||
this.div.id = this.id;
|
||||
this.div.className = 'olControl';
|
||||
this.div.className = this.displayClass;
|
||||
}
|
||||
if (px != null) {
|
||||
this.position = px.clone();
|
||||
@@ -83,6 +110,34 @@ OpenLayers.Control.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @type boolean
|
||||
*/
|
||||
activate: function () {
|
||||
if (this.active) {
|
||||
return false;
|
||||
}
|
||||
if (this.handler) {
|
||||
this.handler.activate();
|
||||
}
|
||||
this.active = true;
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* @type boolean
|
||||
*/
|
||||
deactivate: function () {
|
||||
if (this.active) {
|
||||
if (this.handler) {
|
||||
this.handler.deactivate();
|
||||
}
|
||||
this.active = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Control"
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user