diff --git a/lib/OpenLayers/Control/MouseDefaults.js b/lib/OpenLayers/Control/MouseDefaults.js index 493440bf3f..861c02c7ba 100644 --- a/lib/OpenLayers/Control/MouseDefaults.js +++ b/lib/OpenLayers/Control/MouseDefaults.js @@ -70,7 +70,7 @@ OpenLayers.Control.MouseDefaults.prototype = var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX, size.h / 2 + deltaY); var newCenter = this.map.getLonLatFromScreenPx( newXY ); - this.map.setCenter(newCenter); + this.map.setCenter(newCenter, null, true); this.mouseDragStart = evt.xy.copyOf(); } } @@ -95,6 +95,8 @@ OpenLayers.Control.MouseDefaults.prototype = ), zoom); this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); this.zoomBox = null; + } else { + this.map.setCenter(this.map.center); } this.mouseDragStart = null; this.map.div.style.cursor = "default"; diff --git a/lib/OpenLayers/Control/MouseToolbar.js b/lib/OpenLayers/Control/MouseToolbar.js index d2e5c50eab..efda28be2f 100644 --- a/lib/OpenLayers/Control/MouseToolbar.js +++ b/lib/OpenLayers/Control/MouseToolbar.js @@ -34,23 +34,23 @@ OpenLayers.Control.MouseToolbar.prototype = this.map.events.register( "mouseout", this, this.defaultMouseOut ); var sz = new OpenLayers.Size(28,28); var centered = this.position; - this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz); + this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz, "Shift->Drag to zoom to area"); centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); - this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz); + this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan."); centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); - this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", centered, sz); + this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", centered, sz, "Hold alt when clicking to show distance between selected points"); this.switchModeTo("pan"); this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); }); return this.div; }, - _addButton:function(id, img, activeImg, xy, sz) { + _addButton:function(id, img, activeImg, xy, sz, title) { var imgLocation = OpenLayers.Util.getImagesLocation() + img; var activeImgLocation = OpenLayers.Util.getImagesLocation() + activeImg; // var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz); var btn = OpenLayers.Util.createAlphaImageDiv( - "OpenLayers_Control_PanZoom_" + id, + "OpenLayers_Control_MouseToolbar_" + id, xy, sz, imgLocation, "absolute"); //we want to add the outer div @@ -62,6 +62,8 @@ OpenLayers.Control.MouseToolbar.prototype = btn.events.register("mousedown", this, this.buttonClick); btn.events.register("mouseup", this, this.stopAction); btn.action = id; + btn.title = title; + btn.alt = title; btn.map = this.map; //we want to remember/reference the outer div @@ -210,7 +212,7 @@ OpenLayers.Control.MouseToolbar.prototype = var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX, size.h / 2 + deltaY); var newCenter = this.map.getLonLatFromScreenPx( newXY ); - this.map.setCenter(newCenter); + this.map.setCenter(newCenter, null, true); this.mouseDragStart = evt.xy.copyOf(); } } @@ -238,6 +240,9 @@ OpenLayers.Control.MouseToolbar.prototype = this.zoomBox = null; this.leaveMode(); break; + case "pan": + this.map.setCenter(this.map.center); + } this.mouseDragStart = null; this.map.div.style.cursor = "default"; diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index b1cad1541f..33413ae29e 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -383,7 +383,7 @@ OpenLayers.Map.prototype = { * @param {OpenLayers.LonLat} lonlat * @param {int} zoom */ - setCenter: function (lonlat, zoom) { + setCenter: function (lonlat, zoom, minor) { if (this.center) { // otherwise there's nothing to move yet this.moveLayerContainer(lonlat); } @@ -395,9 +395,9 @@ OpenLayers.Map.prototype = { this.zoom = zoom; } - this.events.triggerEvent("movestart"); + if (!minor) this.events.triggerEvent("movestart"); this.moveToNewExtent(zoomChanged); - this.events.triggerEvent("moveend"); + if (!minor) this.events.triggerEvent("moveend"); }, /**