[OpenLayers-Dev] Control outside map (re #445)
Ludwig Max Brinckmann
ludwigbrinckmann at gmail.com
Wed Jan 17 05:04:37 EST 2007
Ticket #445 promises a way of easily putting controls outside the main map
-- a great help if there is more than just very simple mouse interaction
since that seems to confuse many browsers.
The way I understand it, to utilise this one, I have to pass in the id of
the div where the control is supposed to be located when creating the
control, such as
overview = new OpenLayers.Control.OverviewMap({div : 'controls'});
map.addControl(overview);
However, when running this it gives me the following exception:
Error: this.div.appendChild is not a function
Source File:
http://localhost/javascripts/openlayers/lib/OpenLayers/Control/OverviewMap.js
Line: 117
Is there a working example (with current svn head) someone could point me
to? I am actually not that keen on this particular control, I am looking for
a working starting point for my own control, so any control would do.
Ludwig
The full script:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 80%;
height: 100%;
top: 0;
left: 0;
position: absolute;
}
#controls {
width: 20%;
position: absolute;
top: 0;
right: 0;
height: 100%;
}
</style>
<script src="/javascripts/openlayers/lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map');
boundary = new OpenLayers.Layer.WMS.Untiled('Boundary',
"http://localhost/cgi-bin/yunnanserver?", {layers: "Watersheds",
transparent: "false", format:"image/png" } );
boundary.setVisibility(true);
map.addLayers([boundary]);
overview = new OpenLayers.Control.OverviewMap({div : 'controls'});
map.addControl(overview);
bounds = new OpenLayers.Bounds(-180,-90,180,90);
map.zoomToExtent(bounds);
}
</script>
</head>
<body onload="init()">
<div id="controls"></div>
<div id="map"></div>
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20070117/e429cb11/attachment.html
More information about the Dev
mailing list