Merge pull request #5536 from tschaub/more-layer-extent
Update to layer-extent example
This commit is contained in:
@@ -3,7 +3,6 @@ goog.require('ol.View');
|
|||||||
goog.require('ol.layer.Tile');
|
goog.require('ol.layer.Tile');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.TileJSON');
|
goog.require('ol.source.TileJSON');
|
||||||
goog.require('ol.interaction.DragRotateAndZoom');
|
|
||||||
|
|
||||||
function transform(extent) {
|
function transform(extent) {
|
||||||
return ol.proj.transformExtent(extent, 'EPSG:4326', 'EPSG:3857');
|
return ol.proj.transformExtent(extent, 'EPSG:4326', 'EPSG:3857');
|
||||||
@@ -19,7 +18,7 @@ var extents = {
|
|||||||
var base = new ol.layer.Tile({
|
var base = new ol.layer.Tile({
|
||||||
source: new ol.source.TileJSON({
|
source: new ol.source.TileJSON({
|
||||||
url: 'http://api.tiles.mapbox.com/v3/' +
|
url: 'http://api.tiles.mapbox.com/v3/' +
|
||||||
'mapbox.world-black.json',
|
'mapbox.world-light.json',
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -28,7 +27,7 @@ var overlay = new ol.layer.Tile({
|
|||||||
extent: extents.India,
|
extent: extents.India,
|
||||||
source: new ol.source.TileJSON({
|
source: new ol.source.TileJSON({
|
||||||
url: 'http://api.tiles.mapbox.com/v3/' +
|
url: 'http://api.tiles.mapbox.com/v3/' +
|
||||||
'mapbox.world-glass.json',
|
'mapbox.world-black.json',
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -43,8 +42,6 @@ var map = new ol.Map({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
map.addInteraction(new ol.interaction.DragRotateAndZoom());
|
|
||||||
|
|
||||||
for (var key in extents) {
|
for (var key in extents) {
|
||||||
document.getElementById(key).onclick = function(event) {
|
document.getElementById(key).onclick = function(event) {
|
||||||
overlay.setExtent(extents[event.target.id]);
|
overlay.setExtent(extents[event.target.id]);
|
||||||
|
|||||||
Reference in New Issue
Block a user