No longer touching internal GMaps DOM elements.

Simple and effective: As soon as a map has a Google layer, the whole map viewport is added as control to the GMap. As soon as no Google layer is visible on the map any more, the map viewport is appended to the map container again. With this change, OpenLayers strictly limits its GMaps integration to the GMaps API.

Also note that there are no css overrides for the attribution any more. Instead, controls can now be conditionally positioned differently for Google layer by using the .olForeignContainer selector.
This commit is contained in:
ahocevar
2012-07-20 17:43:05 +02:00
parent 6075b599f3
commit 00d9664b95
7 changed files with 92 additions and 260 deletions

View File

@@ -6,7 +6,6 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers Google (v3) Layer Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
@@ -30,21 +29,6 @@
spherical mercator projection. See the
<a href="google-v3.js" target="_blank">google-v3.js source</a>
to see how this is done.
<p>
In order to position the Google attribution div in the default
location, you must include the extra theme/default/google.css
stylesheet.
</p>
<p>
<strong>Note on Google Maps API versioning:</strong>
This example uses the "nightly" version of Google Maps
API. This is specified by using <code>v=3</code> in the
the Google Maps API URL. Production applications should use the
"release" or "frozen" versions of Google Maps
API. See the <code>OpenLayers.Layer.Google.v3</code> API
docs, and the
<a href="https://developers.google.com/maps/documentation/javascript/basics#Versioning">Versioning Section</a>
of the Google Maps API docs, for more details.
</p>
</div>
</body>