I've got a simple example running here: http://pynchon.hul.harvard.edu/index3.html
When switching between Base Layers the custom controls go away. Can anyone explain why this happens, or even better how I can fix it? Thanks --- SOURCE --- <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> #map {width: 450px;height: 257px;border: 1px solid black;}.olControlPanel div { display:block; width: 24px; height: 24px; margin: 5px;background-color:white;}.olControlPanel .olControlMouseDefaultsItemActive { background-color: blue; background-image: url("OpenLayers-2.10/theme/default/img/pan_on.png");}.olControlPanel .olControlMouseDefaultsItemInactive { background-color: white; background-image: url("OpenLayers-2.10/theme/default/img/pan_off.png"); } .olControlPanel .olControlDrawFeatureItemActive { width: 22px; height: 22px;background-image: url("OpenLayers-2.10/theme/default/img/draw_line_on.png");}.olControlPanel .olControlDrawFeatureItemInactive { width: 22px; height: 22px; background-image: url("OpenLayers-2.10/theme/default/img/draw_line_off.png"); }.olControlPanel .olControlZoomBoxItemInactive { width: 22px; height: 22px; background-color: orange; background-image: url("OpenLayers-2.10/img/drag-rectangle-off.png"); } .olControlPanel .olControlZoomBoxItemActive { width: 22px; height: 22px; background-color: blue; background-image: url("OpenLayers-2.10/img/drag-rectangle-on.png"); }.olControlPanel .olControlZoomToMaxExtentItemInactive { width: 22px; height: 22px; background-image: url("OpenLayers-2.10/img/zoom-world-mini.png"); } div.olControlMousePosition { font-family: Verdana; font-size: 4em; color: black; } </style> <script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"> </script> <script type="text/javascript" src=" OpenLayers-2.10/lib/OpenLayers.js<http://pynchon.hul.harvard.edu/OpenLayers-2.10/lib/OpenLayers.js> "></script> <script type="text/javascript"> <!-- var map, layer, dynamic; function init(){ var options = { projection: new OpenLayers.Projection("EPSG:900913"), displayProjection: new OpenLayers.Projection("EPSG:4326"), units: "m", maxResolution: 156543.0339,maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34), controls: [new OpenLayers.Control.LayerSwitcher({'ascending':false}), new OpenLayers.Control.MousePosition()] }; map = new OpenLayers.Map('map', options); // Yahoo layer var yahoo = new OpenLayers.Layer.Yahoo( "Yahoo Street", {'sphericalMercator': true, isBaseLayer: true, visibility: true,wrapDateLine: true}); var mapnik = new OpenLayers.Layer.TMS( "Open Street Map", " http://tile.openstreetmap.org/",{ type: 'png', getURL: osm_getTileURL,displayOutsideMaxExtent: true}); layer = new OpenLayers.Layer.WMS( "Countries", " http://pynchon.hul.harvard.edu/cgi-bin/tilecache/tilecache.cgi?", {layers: 'sigma', format: 'image/png', transparent: 'true'},{ isBaseLayer: false,visibility: false,wrapDateLine: true}); map.addLayers([ mapnik, yahoo, layer]); vlayer = new OpenLayers.Layer.Vector( "Editable" );map.addLayer(vlayer); zb = new OpenLayers.Control.ZoomBox( {title:"Zoom box: Selecting it you can zoom on an area by clicking and dragging."}); var panel = new OpenLayers.Control.Panel({defaultControl: zb}); panel.addControls([ new OpenLayers.Control.MouseDefaults( {title:'You can use the default mouse configuration'}), zb, new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Path, {title:'Draw a feature'}), new OpenLayers.Control.ZoomToMaxExtent({title:"Zoom to the max extent"}) ]); nav = new OpenLayers.Control.NavigationHistory(); // parent control must be added to the map map.addControl(nav); panel.addControls([nav.next, nav.previous]); map.addControl(panel); if (!map.getCenter()) map.zoomToMaxExtent(); } function osm_getTileURL(bounds) { var res = this.map.getResolution(); var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w)); var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h)); var z = this.map.getZoom(); var limit = Math.pow(2, z); if (y < 0 || y >= limit) { return OpenLayers.Util.getImagesLocation() + "404.png"; } else { x = ((x % limit) + limit) % limit; return this.url + z + "/" + x + "/" + y + "." + this.type; } } // --> </script> </head> <body onload="init()"> <h1 id="title ">Custom Control Panels</h1> <div id="map"></div> </body> </html>
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
