Use full screen control in full screen example

This commit is contained in:
Tom Payne
2013-04-09 22:02:10 +02:00
parent cef6fe4930
commit 0bd11d0a70
2 changed files with 68 additions and 23 deletions

View File

@@ -4,24 +4,63 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>Full-Screen example</title>
<style type="text/css">
html, body, .map {
margin: 0;
padding: 0;
width: 100%;
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<style>
.map:-moz-full-screen {
height: 100%;
}
.map:-webkit-full-screen {
height: 100%;
}
.map:full-screen {
height: 100%;
}
</style>
<title>Full screen control example</title>
</head>
<body>
<div id="map" class="map"></div>
<script src="loader.js?id=full-screen" type="text/javascript"></script>
<div style="display: none;">
<div id="title">Full-screen example</div>
<div id="shortdesc">Example of a full-screen map.</div>
<div id="tags">fullscreen, mapquest, openaerial, tile, tilelayer</div>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<h4 id="title">Full screen control example</h4>
<p id="shortdesc">Example of a full screen control. Click the control in the top right corner to go full screen. Click it again to exit full screen.</p>
<div id="docs">
<p>See the <a href="full-screen.js" target="_blank">full-screen.js source</a> to see how this is done.</p>
</div>
<div id="tags">full-screen, bing, bing-maps</div>
</div>
</div>
</div>
<script src="loader.js?id=full-screen" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,24 +1,30 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.control.FullScreen');
goog.require('ol.control.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.source.BingMaps');
var layer = new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
var view = new ol.View2D({
center: [-9101767, 2822912],
zoom: 14
});
var view = new ol.View2D();
var map = new ol.Map({
layers: [layer],
controls: ol.control.defaults({}, [
new ol.control.FullScreen()
]),
layers: [
new ol.layer.TileLayer({
source: new ol.source.BingMaps({
key: 'AgtFlPYDnymLEe9zJ5PCkghbNiFZE9aAtTy3mPaEnEBXqLHtFuTcKoZ-miMC3w7R',
style: 'Aerial'
})
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: view
});
var mapSize = map.getSize();
if (mapSize) {
view.fitExtent(view.getProjection().getExtent(), mapSize);
}