[OpenLayers-Users] Invisible ZoomBox

acangi aca at ngi.be
Thu Nov 12 03:34:55 EST 2009


Problem finally solved :
1. The NavToolbar not appearing was due to the missing default style.css. 
2. To make my own buttons, I prefered using directly ZoomBox and Navigation,
but removing the controls from the map object to switch between both didn't
work. I had to deactivate them instead of removing them.


acangi wrote:
> 
> Hi list,
> 
> I'm trying to use the controls Navigation and ZoomBox separately : using
> my other (non-openlayers) controls, I'd like to switch between Navigation
> and ZoomBox, like it's done here : 
> http://openlayers.org/dev/examples/navtoolbar-alwaysZoom.html
> http://openlayers.org/dev/examples/navtoolbar-alwaysZoom.html , but with
> my own switchers.
> 
> The problem is : I can't see the control switchers like on the example (to
> select one or the other), I have to use SHIFT to create a zoombox, and I
> can't see the zoombox I'm drawing.
> 
> I copy/pasted the class CustomNavToolbar from the example, and this is my
> map :
> 
> function createMap(){
>         var bounds = new OpenLayers.Bounds(500000, 500000, 810000,
> 800000);
>         map = new OpenLayers.Map('map', {
>                 controls: [new OpenLayers.Control.CustomNavToolbar(),
>                            //new
> OpenLayers.Control.ZoomBox({alwaysZoom:true}),
>                            //new OpenLayers.Control.Navigation(),
>                            new OpenLayers.Control.PanZoomBar()],
>                 theme: null,
>                 maxExtent: bounds,
>                 maxResolution: 1210.9375,
>                 numZoomLevels: 11,
>                 projection: PROJECTION,
>                 units: 'm'
>         });
>         // Create an invisible and light layer to display before the user
> chooses the baselayer
>         // Openlayers always needs one baselayer
>         var clearBaseLayer = new OpenLayers.Layer.Image(
>                         "None",
>                         "/PrintOnDemand/img/clear.gif",
>                         bounds,
>                         new OpenLayers.Size(8, 8),
>                         {isBaseLayer: true}
>                 );
>         map.addLayer(clearBaseLayer);
>         map.baseLayer = clearBaseLayer;
> }
> 
> Also, there are several WMS layers, a vector layer and I'm adding a
> DragFeature(vectorLayer) later on.
> 
> How comes I don't see the switches to choose between Navigation and
> ZoomBox ? The fact I don't see the box I'm drawing makes me think of a
> z-index problem, but linking the panel to a div and changing that div's
> z-index doesn't change anything.
> 
> Any idea ?
> 
> OpenLayers 2.7, Firefox 3.5 
> 

-- 
View this message in context: http://n2.nabble.com/Invisible-ZoomBox-tp3267845p3991402.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list