Convert L examples to use strapless template

This commit is contained in:
Tim Schaub
2015-11-15 16:07:32 -07:00
parent 87fcca91bd
commit f88681951a
14 changed files with 99 additions and 134 deletions
+12 -5
View File
@@ -14,9 +14,11 @@ var imagery = new ol.layer.Tile({
source: new ol.source.BingMaps({key: key, imagerySet: 'Aerial'})
});
var container = document.getElementById('map');
var map = new ol.Map({
layers: [roads, imagery],
target: 'map',
target: container,
view: new ol.View({
center: ol.proj.fromLonLat([-109, 46.5]),
zoom: 6
@@ -24,22 +26,27 @@ var map = new ol.Map({
});
var radius = 75;
$(document).keydown(function(evt) {
document.addEventListener('keydown', function(evt) {
if (evt.which === 38) {
radius = Math.min(radius + 5, 150);
map.render();
evt.preventDefault();
} else if (evt.which === 40) {
radius = Math.max(radius - 5, 25);
map.render();
evt.preventDefault();
}
});
// get the pixel position with every move
var mousePosition = null;
$(map.getViewport()).on('mousemove', function(evt) {
mousePosition = map.getEventPixel(evt.originalEvent);
container.addEventListener('mousemove', function(event) {
mousePosition = map.getEventPixel(event);
map.render();
}).on('mouseout', function() {
});
container.addEventListener('mouseout', function() {
mousePosition = null;
map.render();
});