Remove bundling magic for Mapbox styles script

This commit is contained in:
Andreas Hocevar
2017-08-20 09:26:37 -04:00
parent 98b863604b
commit 2ef5f99599
4 changed files with 16 additions and 20 deletions

View File

@@ -1,4 +1,3 @@
/* eslint-disable openlayers-internal/no-unused-requires */
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.format.MVT');
@@ -46,7 +45,7 @@ var map = new ol.Map({
}),
tileUrlFunction: tileUrlFunction
}),
style: createMapboxStreetsV6Style()
style: createMapboxStreetsV6Style(ol.style.Style, ol.style.Fill, ol.style.Stroke, ol.style.Icon, ol.style.Text)
})
],
target: 'map',
@@ -56,6 +55,3 @@ var map = new ol.Map({
zoom: 2
})
});
// ol.style.Fill, ol.style.Icon, ol.style.Stroke, ol.style.Style and
// ol.style.Text are required for createMapboxStreetsV6Style()

View File

@@ -1,5 +1,3 @@
/* eslint-disable openlayers-internal/no-unused-requires */
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.format.MVT');
@@ -25,7 +23,7 @@ var map = new ol.Map({
url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
'{z}/{x}/{y}.vector.pbf?access_token=' + key
}),
style: createMapboxStreetsV6Style()
style: createMapboxStreetsV6Style(ol.style.Style, ol.style.Fill, ol.style.Stroke, ol.style.Icon, ol.style.Text)
})
],
target: 'map',
@@ -34,6 +32,3 @@ var map = new ol.Map({
zoom: 2
})
});
// ol.style.Fill, ol.style.Icon, ol.style.Stroke, ol.style.Style and
// ol.style.Text are required for createMapboxStreetsV6Style()

View File

@@ -1,20 +1,20 @@
// Styles for the mapbox-streets-v6 vector tile data set. Loosely based on
// http://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6.json
function createMapboxStreetsV6Style() {
var fill = new ol.style.Fill({color: ''});
var stroke = new ol.style.Stroke({color: '', width: 1});
var polygon = new ol.style.Style({fill: fill});
var strokedPolygon = new ol.style.Style({fill: fill, stroke: stroke});
var line = new ol.style.Style({stroke: stroke});
var text = new ol.style.Style({text: new ol.style.Text({
function createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, Text) {
var fill = new Fill({color: ''});
var stroke = new Stroke({color: '', width: 1});
var polygon = new Style({fill: fill});
var strokedPolygon = new Style({fill: fill, stroke: stroke});
var line = new Style({stroke: stroke});
var text = new Style({text: new Text({
text: '', fill: fill, stroke: stroke
})});
var iconCache = {};
function getIcon(iconName) {
var icon = iconCache[iconName];
if (!icon) {
icon = new ol.style.Style({image: new ol.style.Icon({
icon = new Style({image: new Icon({
src: 'https://cdn.rawgit.com/mapbox/maki/master/icons/' + iconName + '-15.svg',
imgSize: [15, 15]
})});

View File

@@ -13,7 +13,12 @@ common.getRendererFromQueryString = function(opt_default) {};
/**
* @param {function(new:ol.style.Style, olx.style.StyleOptions=)} Style Style constructor.
* @param {function(new:ol.style.Fill, olx.style.FillOptions=)} Fill Fill constructor.
* @param {function(new:ol.style.Stroke, olx.style.StrokeOptions=)} Stroke Stroke constructor.
* @param {function(new:ol.style.Icon, olx.style.IconOptions=)} Icon Icon constructor.
* @param {function(new:ol.style.Text, olx.style.TextOptions=)} Text Text constructor.
* @return {function((ol.Feature|ol.render.Feature), number):
* Array.<ol.style.Style>}
*/
var createMapboxStreetsV6Style = function() {};
var createMapboxStreetsV6Style = function(Style, Fill, Stroke, Icon, Text) {};