Pullup r2999:3087 for RC2.

svn merge trunk/openlayers/@2999 trunk/openlayers/@HEAD branches/openlayers/2.4/



git-svn-id: http://svn.openlayers.org/branches/openlayers/2.4@3088 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-04-20 01:10:43 +00:00
parent b6fb16153c
commit b5103eb8ce
58 changed files with 1399 additions and 503 deletions

View File

@@ -22,7 +22,7 @@ OpenLayers.Control.DrawFeature.prototype =
/**
* @type {Object} The functions that are sent to the handler for callback
*/
callbacks: {},
callbacks: null,
/**
* @type {Function} Called after each feature is added

View File

@@ -14,7 +14,7 @@ OpenLayers.Control.KeyboardDefaults.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type int */
slideFactor: 50,
slideFactor: 75,
/**
* @constructor
@@ -50,26 +50,48 @@ OpenLayers.Control.KeyboardDefaults.prototype =
defaultKeyPress: function (code) {
switch(code) {
case OpenLayers.Event.KEY_LEFT:
this.map.pan(-50, 0);
this.map.pan(-this.slideFactor, 0);
break;
case OpenLayers.Event.KEY_RIGHT:
this.map.pan(50, 0);
this.map.pan(this.slideFactor, 0);
break;
case OpenLayers.Event.KEY_UP:
this.map.pan(0, -50);
this.map.pan(0, -this.slideFactor);
break;
case OpenLayers.Event.KEY_DOWN:
this.map.pan(0, 50);
this.map.pan(0, this.slideFactor);
break;
case 33: // Page Up
case 43: // +
case 33: // Page Up
var size = this.map.getSize();
this.map.pan(0, -0.75*size.h);
break;
case 34: // Page Down
var size = this.map.getSize();
this.map.pan(0, 0.75*size.h);
break;
case 35: // End
var size = this.map.getSize();
this.map.pan(0.75*size.w, 0);
break;
case 36: // Pos1
var size = this.map.getSize();
this.map.pan(-0.75*size.w, 0);
break;
case 43: // +
this.map.zoomIn();
break;
case 45: // -
this.map.zoomOut();
break;
case 107: // + (IE only)
this.map.zoomIn();
break;
case 45: // -
case 34: // Page Down
case 109: // - (IE only)
this.map.zoomOut();
break;
}
}
},
/** @final @type String */

View File

@@ -336,7 +336,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
//configure main div
this.div.style.position = "absolute";
this.div.style.top = "10px";
this.div.style.top = "25px";
this.div.style.right = "0px";
this.div.style.left = "";
this.div.style.fontFamily = "sans-serif";

View File

@@ -181,7 +181,7 @@ OpenLayers.Control.MouseDefaults.prototype =
}
document.onselectstart=null;
this.mouseDragStart = null;
this.map.div.style.cursor = "default";
this.map.div.style.cursor = "";
},
/**

View File

@@ -239,7 +239,7 @@ OpenLayers.Control.MouseToolbar.prototype =
this.map.div.style.cursor = "crosshair";
break;
default:
this.map.div.style.cursor = "default";
this.map.div.style.cursor = "";
break;
}

View File

@@ -46,7 +46,7 @@ OpenLayers.Control.OverviewMap.prototype =
*
* @type Array(OpenLayers.Layer)
*/
layers: [],
layers: null,
/**
* The ratio of the overview map resolution to the main map resolution
@@ -68,13 +68,14 @@ OpenLayers.Control.OverviewMap.prototype =
* options that the main map was constructed with.
* @type: Object
*/
mapOptions: {},
mapOptions: null,
/**
* @constructor
* @param {Object} options Hashtable of options to set on the overview map
*/
initialize: function(options) {
this.layers = new Array();
OpenLayers.Control.prototype.initialize.apply(this, [options]);
},

View File

@@ -104,6 +104,8 @@ OpenLayers.Control.PanZoom.prototype =
this.doubleClick.bindAsEventListener(btn));
OpenLayers.Event.observe(btn, "dblclick",
this.doubleClick.bindAsEventListener(btn));
OpenLayers.Event.observe(btn, "click",
this.doubleClick.bindAsEventListener(btn));
btn.action = id;
btn.map = this.map;
btn.slideFactor = this.slideFactor;

View File

@@ -228,7 +228,7 @@ OpenLayers.Control.PanZoomBar.prototype =
zoomBarUp:function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return;
if (this.zoomStart) {
this.div.style.cursor="default";
this.div.style.cursor="";
this.map.events.unregister("mouseup", this, this.passEventToSlider);
this.map.events.unregister("mousemove", this, this.passEventToSlider);
var deltaY = this.zoomStart.y - evt.xy.y

View File

@@ -27,13 +27,13 @@ OpenLayers.Control.SelectFeature.prototype =
/**
* @type {Function} Optional function to be called when a feature is selected.
* The function should expect to be called with a geometry.
* The function should expect to be called with a feature.
*/
onSelect: function() {},
/**
* @type {Function} Optional function to be called when a feature is unselected.
* The function should expect to be called with a geometry.
* The function should expect to be called with a feature.
*/
onUnselect: function() {},
@@ -45,7 +45,7 @@ OpenLayers.Control.SelectFeature.prototype =
/**
* @type {Object} The functions that are sent to the handler for callback
*/
callbacks: {},
callbacks: null,
/**
* @type {Object} Hash of styles
@@ -76,31 +76,28 @@ OpenLayers.Control.SelectFeature.prototype =
/**
* Called when the feature handler detects a mouse-down on a feature
* @param {OpenLayers.Geometry}
* @param {OpenLayers.Vector.Feature}
*/
downFeature: function(geometry) {
downFeature: function(feature) {
if(this.hover) {
return;
}
if(geometry.parent) {
geometry = geometry.parent;
}
if (this.multiple) {
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1) {
this.unselect(geometry);
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1) {
this.unselect(feature);
} else {
this.select(geometry);
this.select(feature);
}
} else {
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1) {
this.unselect(geometry);
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1) {
this.unselect(feature);
} else {
if (this.layer.selectedFeatures) {
for (var i = 0; i < this.layer.selectedFeatures.length; i++) {
this.unselect(this.layer.selectedFeatures[i].geometry);
this.unselect(this.layer.selectedFeatures[i]);
}
}
this.select(geometry);
this.select(feature);
}
}
},
@@ -108,63 +105,57 @@ OpenLayers.Control.SelectFeature.prototype =
/**
* Called when the feature handler detects a mouse-over on a feature.
* Only responds if this.hover is true.
* @param {OpenLayers.Geometry}
* @param {OpenLayers.Feature.Vector}
*/
overFeature: function(geometry) {
overFeature: function(feature) {
if(!this.hover) {
return;
}
if(geometry.parent) {
geometry = geometry.parent;
}
if(!(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1)) {
this.select(geometry);
if(!(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1)) {
this.select(feature);
}
},
/**
* Called when the feature handler detects a mouse-out on a feature.
* Only responds if this.hover is true.
* @param {OpenLayers.Geometry}
* @param {OpenLayers.Feature.Vector}
*/
outFeature: function(geometry) {
outFeature: function(feature) {
if(!this.hover) {
return;
}
if(geometry.parent) {
geometry = geometry.parent;
}
this.unselect(geometry);
this.unselect(feature);
},
/**
* Add feature to the layer's selectedFeature array, render the feature as
* selected, and call the onSelect function.
* @param {OpenLayers.Geometry} geometry
* @param {OpenLayers.Feature.Vector} feature
*/
select: function(geometry) {
select: function(feature) {
// Store feature style for restoration later
if(geometry.feature.originalStyle == null) {
geometry.feature.originalStyle = geometry.feature.style;
if(feature.originalStyle == null) {
feature.originalStyle = feature.style;
}
this.layer.selectedFeatures.push(geometry.feature);
this.layer.renderer.drawGeometry(geometry, this.selectStyle);
this.onSelect(geometry);
this.layer.selectedFeatures.push(feature);
this.layer.drawFeature(feature, this.selectStyle);
this.onSelect(feature);
},
/**
* Remove feature from the layer's selectedFeature array, render the feature as
* normal, and call the onUnselect function.
* @param {OpenLayers.Geometry} geometry
* @param {OpenLayers.Feature.Vector} feature
*/
unselect: function(geometry) {
unselect: function(feature) {
// Store feature style for restoration later
if(geometry.feature.originalStyle == null) {
geometry.feature.originalStyle = geometry.feature.style;
if(feature.originalStyle == null) {
feature.originalStyle = feature.style;
}
this.layer.renderer.drawGeometry(geometry, geometry.feature.originalStyle);
OpenLayers.Util.removeItem(this.layer.selectedFeatures, geometry.feature);
this.onUnselect(geometry);
this.layer.drawFeature(feature, feature.originalStyle);
OpenLayers.Util.removeItem(this.layer.selectedFeatures, feature);
this.onUnselect(feature);
},
/** Set the map property for the control.