Moving more components to the new approach for non-new initialisation

master
Robin Hawkes 2016-03-01 20:51:38 +00:00
rodzic f168fae548
commit ad1388d6cd
10 zmienionych plików z 63 dodań i 51 usunięć

36
dist/vizicities.js vendored
Wyświetl plik

@ -8798,7 +8798,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_createTile',
value: function _createTile(quadcode, layer) {
return (0, _ImageTile2['default'])(quadcode, this._path, layer);
return new _ImageTile2['default'](quadcode, this._path, layer);
}
// Destroys the layer and removes it from the scene and memory
@ -8941,7 +8941,7 @@ return /******/ (function(modules) { // webpackBootstrap
this._options = (0, _lodashAssign2['default'])({}, defaults, options);
this._tileCache = (0, _TileCache2['default'])(this._options.maxCache, function (tile) {
this._tileCache = new _TileCache2['default'](this._options.maxCache, function (tile) {
_this._destroyTile(tile);
});
@ -9297,8 +9297,6 @@ return /******/ (function(modules) { // webpackBootstrap
});
}
// Initialise without requiring new keyword
// Returns true if all specified tile providers are ready to be used
// Otherwise, returns false
@ -9336,12 +9334,14 @@ return /******/ (function(modules) { // webpackBootstrap
return TileCache;
})();
exports['default'] = function (cacheLimit, onDestroyTile) {
exports['default'] = TileCache;
var noNew = function noNew(cacheLimit, onDestroyTile) {
return new TileCache(cacheLimit, onDestroyTile);
};
;
module.exports = exports['default'];
// Initialise without requiring new keyword
exports.tileCache = noNew;
/***/ },
/* 43 */
@ -11089,8 +11089,6 @@ return /******/ (function(modules) { // webpackBootstrap
_get(Object.getPrototypeOf(ImageTile.prototype), 'constructor', this).call(this, quadcode, path, layer);
}
// Initialise without requiring new keyword
// Request data for the tile
_createClass(ImageTile, [{
@ -11277,12 +11275,14 @@ return /******/ (function(modules) { // webpackBootstrap
return ImageTile;
})(_Tile3['default']);
exports['default'] = function (quadcode, path, layer) {
exports['default'] = ImageTile;
var noNew = function noNew(quadcode, path, layer) {
return new ImageTile(quadcode, path, layer);
};
;
module.exports = exports['default'];
// Initialise without requiring new keyword
exports.imageTile = noNew;
/***/ },
/* 52 */
@ -11854,7 +11854,7 @@ return /******/ (function(modules) { // webpackBootstrap
options.onClick = this._options.onClick;
}
return (0, _GeoJSONTile2['default'])(quadcode, this._path, layer, options);
return new _GeoJSONTile2['default'](quadcode, this._path, layer, options);
}
// Destroys the layer and removes it from the scene and memory
@ -11999,8 +11999,6 @@ return /******/ (function(modules) { // webpackBootstrap
}
}
// Initialise without requiring new keyword
// Request data for the tile
_createClass(GeoJSONTile, [{
@ -12558,12 +12556,14 @@ return /******/ (function(modules) { // webpackBootstrap
return GeoJSONTile;
})(_Tile3['default']);
exports['default'] = function (quadcode, path, layer, options) {
exports['default'] = GeoJSONTile;
var noNew = function noNew(quadcode, path, layer, options) {
return new GeoJSONTile(quadcode, path, layer, options);
};
;
module.exports = exports['default'];
// Initialise without requiring new keyword
exports.geoJSONTile = noNew;
/***/ },
/* 57 */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -65,23 +65,23 @@ var topoJSONTileLayer = VIZI.topoJSONTileLayer('https://vector.mapzen.com/osm/bu
// }).addTo(world);
// London Underground lines
var geoJSONLayer = VIZI.geoJSONLayer('https://rawgit.com/robhawkes/4acb9d6a6a5f00a377e2/raw/30ae704a44e10f2e13fb7e956e80c3b22e8e7e81/tfl_lines.json', {
picking: true,
style: function(feature) {
var colour = feature.properties.lines[0].colour || '#ffffff';
return {
lineColor: colour,
// lineHeight: 20,
lineWidth: 3,
// lineTransparent: true,
// lineOpacity: 0.5,
// lineBlending: THREE.AdditiveBlending,
lineRenderOrder: 2
};
},
onClick: function(feature, point2d, point3d, intersects) {
console.log('Clicked:', feature, point2d, point3d, intersects);
},
attribution: '© Transport for London.'
}).addTo(world);
// var geoJSONLayer = VIZI.geoJSONLayer('https://rawgit.com/robhawkes/4acb9d6a6a5f00a377e2/raw/30ae704a44e10f2e13fb7e956e80c3b22e8e7e81/tfl_lines.json', {
// picking: true,
// style: function(feature) {
// var colour = feature.properties.lines[0].colour || '#ffffff';
//
// return {
// lineColor: colour,
// // lineHeight: 20,
// lineWidth: 3,
// // lineTransparent: true,
// // lineOpacity: 0.5,
// // lineBlending: THREE.AdditiveBlending,
// lineRenderOrder: 2
// };
// },
// onClick: function(feature, point2d, point3d, intersects) {
// console.log('Clicked:', feature, point2d, point3d, intersects);
// },
// attribution: '© Transport for London.'
// }).addTo(world);

Wyświetl plik

@ -606,7 +606,11 @@ class GeoJSONTile extends Tile {
}
}
// Initialise without requiring new keyword
export default function(quadcode, path, layer, options) {
export default GeoJSONTile;
var noNew = function(quadcode, path, layer, options) {
return new GeoJSONTile(quadcode, path, layer, options);
};
// Initialise without requiring new keyword
export {noNew as geoJSONTile};

Wyświetl plik

@ -115,7 +115,7 @@ class GeoJSONTileLayer extends TileLayer {
options.onClick = this._options.onClick;
}
return GeoJSONTile(quadcode, this._path, layer, options);
return new GeoJSONTile(quadcode, this._path, layer, options);
}
// Destroys the layer and removes it from the scene and memory

Wyświetl plik

@ -180,7 +180,11 @@ class ImageTile extends Tile {
}
}
// Initialise without requiring new keyword
export default function(quadcode, path, layer) {
export default ImageTile;
var noNew = function(quadcode, path, layer) {
return new ImageTile(quadcode, path, layer);
};
// Initialise without requiring new keyword
export {noNew as imageTile};

Wyświetl plik

@ -128,7 +128,7 @@ class ImageTileLayer extends TileLayer {
}
_createTile(quadcode, layer) {
return ImageTile(quadcode, this._path, layer);
return new ImageTile(quadcode, this._path, layer);
}
// Destroys the layer and removes it from the scene and memory

Wyświetl plik

@ -40,7 +40,11 @@ class TileCache {
}
}
// Initialise without requiring new keyword
export default function(cacheLimit, onDestroyTile) {
export default TileCache;
var noNew = function(cacheLimit, onDestroyTile) {
return new TileCache(cacheLimit, onDestroyTile);
};
// Initialise without requiring new keyword
export {noNew as tileCache};

Wyświetl plik

@ -63,7 +63,7 @@ class TileLayer extends Layer {
this._options = extend({}, defaults, options);
this._tileCache = TileCache(this._options.maxCache, tile => {
this._tileCache = new TileCache(this._options.maxCache, tile => {
this._destroyTile(tile);
});