Merge branch 'master' of https://github.com/openlayers/openlayers into vendor-prefixes

This commit is contained in:
Gregers Gram Rygg
2012-06-24 02:38:05 +02:00
92 changed files with 1201 additions and 447 deletions

View File

@@ -261,8 +261,11 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
* deltaZ - {Integer}
*/
wheelChange: function(evt, deltaZ) {
if (!this.map.fractionalZoom) {
deltaZ = Math.round(deltaZ);
}
var currentZoom = this.map.getZoom();
var newZoom = this.map.getZoom() + Math.round(deltaZ);
var newZoom = this.map.getZoom() + deltaZ;
newZoom = Math.max(newZoom, 0);
newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
if (newZoom === currentZoom) {

View File

@@ -127,6 +127,20 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
*/
maximized: false,
/**
* APIProperty: maximizeTitle
* {String} This property is used for showing a tooltip over the
* maximize div. Defaults to "" (no title).
*/
maximizeTitle: "",
/**
* APIProperty: minimizeTitle
* {String} This property is used for showing a tooltip over the
* minimize div. Defaults to "" (no title).
*/
minimizeTitle: "",
/**
* Constructor: OpenLayers.Control.OverviewMap
* Create a new overview map
@@ -247,6 +261,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
'absolute');
this.maximizeDiv.style.display = 'none';
this.maximizeDiv.className = this.displayClass + 'MaximizeButton olButton';
if (this.maximizeTitle) {
this.maximizeDiv.title = this.maximizeTitle;
}
this.div.appendChild(this.maximizeDiv);
// minimize button div
@@ -259,6 +276,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
'absolute');
this.minimizeDiv.style.display = 'none';
this.minimizeDiv.className = this.displayClass + 'MinimizeButton olButton';
if (this.minimizeTitle) {
this.minimizeDiv.title = this.minimizeTitle;
}
this.div.appendChild(this.minimizeDiv);
this.minimizeControl();
} else {

View File

@@ -99,6 +99,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this.map.events.un({
"changebaselayer": this.redraw,
"updatesize": this.redraw,
scope: this
});
@@ -116,7 +117,11 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
*/
setMap: function(map) {
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);
this.map.events.register("changebaselayer", this, this.redraw);
this.map.events.on({
"changebaselayer": this.redraw,
"updatesize": this.redraw,
scope: this
});
},
/**
@@ -189,6 +194,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
_addZoomBar:function(centered) {
var imgLocation = OpenLayers.Util.getImageLocation("slider.png");
var id = this.id + "_" + this.map.id;
var minZoom = this.map.getMinZoom();
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
var slider = OpenLayers.Util.createAlphaImageDiv(id,
centered.add(-1, zoomsToEnd * this.zoomStopHeight),
@@ -211,7 +217,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
var sz = {
w: this.zoomStopWidth,
h: this.zoomStopHeight * this.map.getNumZoomLevels()
h: this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom)
};
var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png");
var div = null;
@@ -242,7 +248,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this.map.events.register("zoomend", this, this.moveZoomBar);
centered = centered.add(0,
this.zoomStopHeight * this.map.getNumZoomLevels());
this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom));
return centered;
},

View File

@@ -300,14 +300,17 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
*/
unselectAll: function(options) {
// we'll want an option to supress notification here
var layers = this.layers || [this.layer];
var layer, feature;
for(var l=0; l<layers.length; ++l) {
var layers = this.layers || [this.layer],
layer, feature, l, numExcept;
for(l=0; l<layers.length; ++l) {
layer = layers[l];
for(var i=layer.selectedFeatures.length-1; i>=0; --i) {
feature = layer.selectedFeatures[i];
numExcept = 0;
while(layer.selectedFeatures.length > numExcept) {
feature = layer.selectedFeatures[numExcept];
if(!options || options.except != feature) {
this.unselect(feature);
} else {
++numExcept;
}
}
}

View File

@@ -240,7 +240,7 @@ OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, {
var deactivated = OpenLayers.Control.prototype.deactivate.call(this);
if(deactivated) {
if(this.source && this.source.events) {
this.layer.events.un({
this.source.events.un({
sketchcomplete: this.onSketchComplete,
afterfeaturemodified: this.afterFeatureModified,
scope: this

View File

@@ -41,9 +41,17 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
/**
* APIProperty: alwaysZoom
* {Boolean} Always zoom in/out, when box drawed
* {Boolean} Always zoom in/out when box drawn, even if the zoom level does
* not change.
*/
alwaysZoom: false,
/**
* APIProperty: zoomOnClick
* {Boolean} Should we zoom when no box was dragged, i.e. the user only
* clicked? Default is true.
*/
zoomOnClick: true,
/**
* Method: draw
@@ -93,7 +101,7 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){
this.map.zoomTo(lastZoom + (this.out ? -1 : 1));
}
} else { // it's a pixel
} else if (this.zoomOnClick) { // it's a pixel
if (!this.out) {
this.map.setCenter(this.map.getLonLatFromPixel(position),
this.map.getZoom() + 1);