[Mapbender-commits] r5175 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Sat Dec 12 08:27:17 EST 2009
Author: christoph
Date: 2009-12-12 08:27:17 -0500 (Sat, 12 Dec 2009)
New Revision: 5175
Modified:
trunk/mapbender/http/javascripts/mod_mousewheelZoom.js
Log:
Modified: trunk/mapbender/http/javascripts/mod_mousewheelZoom.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_mousewheelZoom.js 2009-12-12 13:26:54 UTC (rev 5174)
+++ trunk/mapbender/http/javascripts/mod_mousewheelZoom.js 2009-12-12 13:27:17 UTC (rev 5175)
@@ -66,18 +66,39 @@
var pos = mapObject.convertPixelToReal(lastScrollPosition);
if (sum_delta > 0) {
- this.zoom(true, Math.pow(zoomMousewheel, sum_delta), pos.x, pos.y);
+ var extentAfterZoom = mapObject.calculateExtentAfterZoom(
+ true,
+ Math.pow(zoomMousewheel, sum_delta),
+ pos.x,
+ pos.y
+ );
}
else {
- this.zoom(false, Math.pow(zoomMousewheel, -sum_delta), pos.x, pos.y);
+ var extentAfterZoom = mapObject.calculateExtentAfterZoom(
+ false,
+ Math.pow(zoomMousewheel, -sum_delta),
+ pos.x,
+ pos.y
+ );
}
+
+ var newPos = mapObject.convertRealToPixel(
+ pos,
+ extentAfterZoom
+ );
+ var diff = newPos.minus(lastScrollPosition);
- var newPos = new Point();
- newPos.x = this.width - lastScrollPosition.x;
- newPos.y = this.height - lastScrollPosition.y;
-
- var posAfterZoom = this.convertPixelToReal(newPos);
- this.zoom(false, 1.0, posAfterZoom.x, posAfterZoom.y);
+ var newSouthEast = mapObject.convertPixelToReal(
+ (new Point(0, mapObject.getHeight())).plus(diff),
+ extentAfterZoom
+ );
+ var newNorthWest = mapObject.convertPixelToReal(
+ (new Point(mapObject.getWidth(), 0)).plus(diff),
+ extentAfterZoom
+ );
+ var newExtent = new Mapbender.Extent(newSouthEast, newNorthWest);
+ mapObject.setExtent(newExtent);
+ mapObject.setMapRequest();
}
sum_delta = 0;
clearTimeout(mapTimeout);
More information about the Mapbender_commits
mailing list