Hello Martin-
Thanks for opening http://trac.osgeo.org/openlayers/ticket/3219. Please
see my comments there and provide more detail on the ticket to describe
how you reproduce the problem. Also, please specify if this issue
exists on the trunk and in the 2.10 release or only in one.
In trying to reproduce your issue, I've come across a minor regression
that I think is a separate issue.
http://trac.osgeo.org/openlayers/ticket/3220
Tim
On 3/24/11 4:45 AM, Andreas Hocevar wrote:
Can you please provide an example that shows the problem? The best place to do
this (and attach a patch with your fixes) would be a ticket on
http://trac.osgeo.org/openlayers/.
Thanks,
Andreas.
On Mar 16, 2011, at 13:14 , Martin Saturka wrote:
Hi,
when you drag the bar at the PanZoomBar too up or down, the control
tries to zoom to levels outside the map zoom range, e.g. to -1 or 22,
...
It would be nice if we had a hook for checking / modifying that
targeted zoom number. We use some hook by now, as below at the
"zoomBarUp" method.
Together with it, the mouse click event stopping does not work
correctly (at MSIE, and OL 2.10), thus we had to put some external
dealing there (otherwise it ended up with adding new points as we have
it for mouse click events).
OpenLayers.Control.PanZoomBarMod =
OpenLayers.Class(OpenLayers.Control.PanZoomBar, {
// msie does not stops the event, and does not preserves its
properties either
divClick: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
var levels = evt.xy.y / this.zoomStopHeight;
if (this.forceFixedZoomLevel || !this.map.fractionalZoom) {
levels = Math.floor(levels);
}
var zoom = this.map.getNumZoomLevels() - 1 - levels;
zoom = Math.min(Math.max(zoom, 0), this.map.getNumZoomLevels() - 1);
this.map.zoomTo(zoom);
var stop_event = OpenLayers.Hooks.PanZoomBar.divClick(this);
if (stop_event)
{
OpenLayers.Event.stop(evt);
}
},
buttonDown: function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
OpenLayers.Hooks.PanZoomBar.buttonDown(this);
switch (this.action) {
case "panup":
this.map.pan(0, - this.getSlideFactor("h"));
break;
case "pandown":
this.map.pan(0, this.getSlideFactor("h"));
break;
case "panleft":
this.map.pan(- this.getSlideFactor("w"), 0);
break;
case "panright":
this.map.pan(this.getSlideFactor("w"), 0);
break;
case "zoomin":
this.map.zoomIn();
break;
case "zoomout":
this.map.zoomOut();
break;
case "zoomworld":
this.map.zoomToMaxExtent();
break;
default:;
}
OpenLayers.Event.stop(evt);
},
zoomBarUp: function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
if (this.mouseDragStart) {
this.div.style.cursor="";
this.map.events.un({
"mouseup": this.passEventToSlider,
"mousemove": this.passEventToSlider,
scope: this
});
var deltaY = this.zoomStart.y - evt.xy.y;
var zoomLevel = this.map.zoom;
if (!this.forceFixedZoomLevel&& this.map.fractionalZoom) {
zoomLevel += deltaY/this.zoomStopHeight;
zoomLevel = Math.min(Math.max(zoomLevel, 0),
this.map.getNumZoomLevels() - 1);
} else {
zoomLevel += Math.round(deltaY/this.zoomStopHeight);
}
var max_layer_zoom = OpenLayers.Hooks.Zooms.maxZoom(this);
var min_layer_zoom = OpenLayers.Hooks.Zooms.minZoom(this);
if ((max_layer_zoom !== undefined)&& (typeof
max_layer_zoom === "number")) {
if (max_layer_zoom< zoomLevel) {zoomLevel = max_layer_zoom;}
}
if ((min_layer_zoom !== undefined)&& (typeof
min_layer_zoom === "number")) {
if (min_layer_zoom> zoomLevel) {zoomLevel = min_layer_zoom;}
}
this.map.zoomTo(zoomLevel);
this.mouseDragStart = null;
this.zoomStart = null;
var stop_event = OpenLayers.Hooks.PanZoomBar.zoomBarUp(this);
if (stop_event) {
OpenLayers.Event.stop(evt);
}
}
},
CLASS_NAME: "OpenLayers.Control.PanZoomBar"
});
M.
--
Martin Saturka
Software Engineer, Sourcefabric
www.sourcefabric.org
_______________________________________________
Dev mailing list
d...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
--
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.
_______________________________________________
Dev mailing list
d...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev