Fix missing dependencies in IE

feature/threejs-update
Robin Hawkes 2016-12-21 11:47:51 +00:00
rodzic 808d8fa194
commit bcf21a0227
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 1EC4C2D6765FA8CF
14 zmienionych plików z 60 dodań i 22 usunięć

Wyświetl plik

@ -12,9 +12,9 @@ VIZI.Controls.orbit().addTo(world);
// CartoDB basemap
VIZI.imageTileLayer('http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
}).addTo(world).then(() => {
}).addTo(world).then(function() {
console.log('Added image tile layer to world');
});;
});
// Buildings from Mapzen
VIZI.topoJSONTileLayer('https://tile.mapzen.com/mapzen/vector/v1/buildings/{z}/{x}/{y}.topojson?api_key=vector-tiles-NT5Emiw', {
@ -37,6 +37,6 @@ VIZI.topoJSONTileLayer('https://tile.mapzen.com/mapzen/vector/v1/buildings/{z}/{
return feature.geometry.type !== 'Point';
},
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://whosonfirst.mapzen.com#License">Who\'s On First</a>.'
}).addTo(world).then(() => {
}).addTo(world).then(function() {
console.log('Added TopoJSON layer to world');
});

Wyświetl plik

@ -14,12 +14,12 @@ var imageTiles = VIZI.imageTileLayer('http://{s}.basemaps.cartocdn.com/light_nol
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
});
imageTiles.addTo(world).then(() => {
imageTiles.addTo(world).then(function() {
console.log('Added image tile layer to world');
});
// Will be emitted every time the image layer updates the tile list
// All tiles in view are sent with each update
imageTiles.on('tilesList', (tiles) => {
imageTiles.on('tilesList', function(tiles) {
console.log(tiles);
});

Wyświetl plik

@ -13,7 +13,7 @@ world._environment._skybox.setInclination(0.3);
VIZI.Controls.orbit().addTo(world);
// Leave a single CPU for the main browser thread
world.createWorkers(7).then(() => {
world.createWorkers(7).then(function() {
console.log('Workers ready');
// CartoDB basemap

Wyświetl plik

@ -14,7 +14,7 @@ postMessage({
});
// Recieve message from main thread
onmessage = (event) => {
onmessage = function(event) {
if (!event.data.method) {
postMessage({
type: 'error',
@ -49,7 +49,7 @@ onmessage = (event) => {
}
// Call method with given arguments
_method.apply(this, event.data.args).then((result) => {
_method.apply(this, event.data.args).then(function(result) {
if (DEBUG) { console.log('Message sent from worker', Date.now()); }
// Return results

Wyświetl plik

@ -10,13 +10,13 @@ var world = VIZI.world('world', {
VIZI.Controls.orbit().addTo(world);
// Leave a single CPU for the main browser thread
world.createWorkers(7).then(() => {
world.createWorkers(7).then(function() {
console.log('Workers ready');
// CartoDB basemap
VIZI.imageTileLayer('http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
}).addTo(world).then(() => {
}).addTo(world).then(function() {
console.log('Added image tile layer to world');
});;
@ -42,7 +42,7 @@ world.createWorkers(7).then(() => {
return feature.geometry.type !== 'Point';
},
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://whosonfirst.mapzen.com#License">Who\'s On First</a>.'
}).addTo(world).then(() => {
}).addTo(world).then(function() {
console.log('Added TopoJSON layer to world');
});
});

Wyświetl plik

@ -14,7 +14,7 @@ postMessage({
});
// Recieve message from main thread
onmessage = (event) => {
onmessage = function(event) {
if (!event.data.method) {
postMessage({
type: 'error',
@ -49,7 +49,7 @@ onmessage = (event) => {
}
// Call method with given arguments
_method.apply(this, event.data.args).then((result) => {
_method.apply(this, event.data.args).then(function(result) {
if (DEBUG) { console.log('Message sent from worker', Date.now()); }
// Return results

Wyświetl plik

@ -10,7 +10,7 @@ var world = VIZI.world('world', {
VIZI.Controls.orbit().addTo(world);
// Leave a single CPU for the main browser thread
world.createWorkers(7).then(() => {
world.createWorkers(7).then(function() {
console.log('Workers ready');
// CartoDB basemap

Wyświetl plik

@ -14,7 +14,7 @@ postMessage({
});
// Recieve message from main thread
onmessage = (event) => {
onmessage = function(event) {
if (!event.data.method) {
postMessage({
type: 'error',
@ -49,7 +49,7 @@ onmessage = (event) => {
}
// Call method with given arguments
_method.apply(this, event.data.args).then((result) => {
_method.apply(this, event.data.args).then(function(result) {
if (DEBUG) { console.log('Message sent from worker', Date.now()); }
// Return results

Wyświetl plik

@ -10,13 +10,13 @@ var world = VIZI.world('world', {
VIZI.Controls.orbit().addTo(world);
// Leave a single CPU for the main browser thread
world.createWorkers(7).then(() => {
world.createWorkers(7).then(function() {
console.log('Workers ready');
// CartoDB basemap
VIZI.imageTileLayer('http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
}).addTo(world).then(() => {
}).addTo(world).then(function() {
console.log('Added image tile layer to world');
});
@ -43,7 +43,7 @@ world.createWorkers(7).then(() => {
return feature.geometry.type !== 'Point';
},
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://whosonfirst.mapzen.com#License">Who\'s On First</a>.'
}).addTo(world).then(() => {
}).addTo(world).then(function() {
console.log('Added TopoJSON layer to world');
});
});

Wyświetl plik

@ -14,7 +14,7 @@ postMessage({
});
// Recieve message from main thread
onmessage = (event) => {
onmessage = function(event) {
if (!event.data.method) {
postMessage({
type: 'error',
@ -49,7 +49,7 @@ onmessage = (event) => {
}
// Call method with given arguments
_method.apply(this, event.data.args).then((result) => {
_method.apply(this, event.data.args).then(function(result) {
if (DEBUG) { console.log('Message sent from worker', Date.now()); }
// Return results

Wyświetl plik

@ -92,6 +92,11 @@ function build() {
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }
]
},
plugins: [
new webpack.ProvidePlugin({
Promise: 'promise-polyfill'
})
],
devtool: 'source-map'
}))
.pipe(gulp.dest(destinationFolder))
@ -138,6 +143,11 @@ function buildWorker() {
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
]
},
plugins: [
new webpack.ProvidePlugin({
Promise: 'promise-polyfill'
})
],
devtool: 'source-map'
}))
.pipe(gulp.dest(destinationFolder))

Wyświetl plik

@ -87,6 +87,7 @@
"lodash.assign": "^4.0.2",
"lodash.throttle": "^4.0.0",
"lru-cache": "^4.0.0",
"promise-polyfill": "^6.0.2",
"reqwest": "^2.0.5",
"shortid": "^2.2.6",
"text-encoding": "^0.6.1",

Wyświetl plik

@ -212,7 +212,7 @@ class TileLayer extends Layer {
// Get list of tiles that were in the previous update but not the
// current one (for aborting requests, etc)
var missingTiles = this._tileList.filter((item) => {
return !tileList.includes(item);
return tileList.indexOf(item) < 0;
});
// Abort tiles that are no longer in view

Wyświetl plik

@ -2,6 +2,33 @@ import WorkerPoolWorker from './WorkerPoolWorker';
const DEBUG = false;
// Polyfill for Array.find
if (!Array.prototype.find) {
Object.defineProperty(Array.prototype, 'find', {
value: function(predicate) {
'use strict';
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
}
return undefined;
}
});
}
class WorkerPool {
constructor(options) {
this.numThreads = options.numThreads || 2;