[fusion-commits] r1876 - trunk/widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed Jul 22 11:57:43 EDT 2009
Author: pagameba
Date: 2009-07-22 11:57:42 -0400 (Wed, 22 Jul 2009)
New Revision: 1876
Modified:
trunk/widgets/Navigator.js
Log:
closes #273 by adding support for generic tiled base layers.
Modified: trunk/widgets/Navigator.js
===================================================================
--- trunk/widgets/Navigator.js 2009-07-22 14:05:29 UTC (rev 1875)
+++ trunk/widgets/Navigator.js 2009-07-22 15:57:42 UTC (rev 1876)
@@ -166,6 +166,7 @@
this.slider = new Slider(sliderDiv, sliderHandle, {
mode: 'vertical',
steps: 81,
+ snap: true,
onComplete: OpenLayers.Function.bind(this.scaleChanged, this)
});
// precompute this for efficiency
@@ -195,7 +196,10 @@
olMap.zoomTo(olMap.getZoomForResolution(resolution));
this.bInternalChange = false;
} else {
- var res = olMap.baseLayer.resolutions;
+ var zoom = olMap.baseLayer.resolutions.length - value;
+ this.bInternalChange = true;
+ olMap.zoomTo(zoom);
+ this.bInternalChange = false;
}
}
@@ -231,6 +235,7 @@
var map = this.getMap().oMapOL;
baseLayer = map.baseLayer
if (baseLayer.singleTile) {
+ this.slider.steps = 81;
var resolution = map.getResolution() - baseLayer.minResolution;
var scale = OpenLayers.Util.getScaleFromResolution(resolution, baseLayer.units);
var position = 9*Math.log(scale)/this.LN9;
@@ -238,16 +243,11 @@
this.slider.set(position);
this.bInternalChange = false;
} else {
- var res = map.baseLayer.resolutions;
- var n = res.length;
- var max = res[0];
- var min = res[n-1];
- //this.slider.values = [];
- //this.slider.range = $R(1,91);
- for (var i=0; i<n; i++) {
- var r = res[i];
- //this.slider.values.push(parseInt((r/max)*91));
- }
+ this.slider.steps = map.baseLayer.resolutions.length;
+ var position = map.baseLayer.resolutions.length - map.getZoom();
+ this.bInternalChange = true;
+ this.slider.set(position);
+ this.bInternalChange = false;
}
},
More information about the fusion-commits
mailing list