Commit changes to include a 'minor' flag on setCenter, that indicates that a map should not call the moveend trigger.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@558 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-06-08 16:13:42 +00:00
parent 6c32dd0ff8
commit 7d0b489e42
3 changed files with 17 additions and 10 deletions

View File

@@ -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";

View File

@@ -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";

View File

@@ -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");
},
/**