Use identical code in compiled and standalone examples
This commit is contained in:
@@ -77,40 +77,6 @@
|
||||
<!-- Popup -->
|
||||
<div class="overlay arrow_box" id="popup"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
var layer = new ol.layer.TileLayer({
|
||||
source: new ol.source.MapQuestOpenAerial()
|
||||
});
|
||||
var map = new ol.Map({
|
||||
center: new ol.Coordinate(0, 0),
|
||||
layers: new ol.Collection([layer]),
|
||||
target: 'map',
|
||||
zoom: 2
|
||||
});
|
||||
|
||||
// Vienna label
|
||||
var vienna = new ol.overlay.Overlay({
|
||||
map: map,
|
||||
coordinate: ol.Projection.transformWithCodes(
|
||||
new ol.Coordinate(16.3725, 48.208889), 'EPSG:4326', 'EPSG:3857'),
|
||||
element: document.getElementById('vienna')
|
||||
});
|
||||
|
||||
// Popup showing the position the user clicked
|
||||
var popup = new ol.overlay.Overlay({
|
||||
element: document.getElementById('popup')
|
||||
});
|
||||
map.addEventListener('click', function(evt) {
|
||||
var coordinate = evt.getCoordinate();
|
||||
popup.getElement().innerHTML =
|
||||
'Welcome to ol3. The location you clicked was<br>' +
|
||||
ol.CoordinateFormat.hdms(ol.Projection.transformWithCodes(
|
||||
coordinate, 'EPSG:3857', 'EPSG:4326'));
|
||||
popup.setMap(evt.map);
|
||||
popup.setCoordinate(evt.getCoordinate());
|
||||
});
|
||||
|
||||
</script>
|
||||
<script src="../overlay-and-popup.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user