kopia lustrzana https://github.com/robhawkes/vizicities
Added live reload to build step and externalised proj4 dependency
rodzic
54e0156661
commit
b91cd9f999
Plik diff jest za duży
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -7,9 +7,16 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="world"></div>
|
<div id="world"></div>
|
||||||
|
|
||||||
|
<!-- Livereload -->
|
||||||
|
<script src='http://localhost:35729/livereload.js'></script>
|
||||||
|
|
||||||
<script src="../vendor/three.min.js"></script>
|
<script src="../vendor/three.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Include proj4 if you plan to use CRS.Proj4 -->
|
||||||
|
<!-- <script src="../vendor/proj4.js"></script> -->
|
||||||
|
|
||||||
<script src="../../dist/vizicities.min.js"></script>
|
<script src="../../dist/vizicities.min.js"></script>
|
||||||
|
|
||||||
<script src="main.js"></script>
|
<script src="main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -75,7 +75,9 @@ function build() {
|
||||||
},
|
},
|
||||||
externals: {
|
externals: {
|
||||||
// Proxy the global THREE variable to require('three')
|
// Proxy the global THREE variable to require('three')
|
||||||
'three': 'THREE'
|
'three': 'THREE',
|
||||||
|
// Proxy the global proj4 variable to require('proj4')
|
||||||
|
'proj4': 'proj4'
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
|
@ -95,7 +97,8 @@ function build() {
|
||||||
// jscs:enable
|
// jscs:enable
|
||||||
|
|
||||||
.pipe($.sourcemaps.write('./'))
|
.pipe($.sourcemaps.write('./'))
|
||||||
.pipe(gulp.dest(destinationFolder));
|
.pipe(gulp.dest(destinationFolder))
|
||||||
|
.pipe($.livereload());
|
||||||
}
|
}
|
||||||
|
|
||||||
function _mocha() {
|
function _mocha() {
|
||||||
|
@ -132,6 +135,7 @@ const watchFiles = ['src/**/*', 'test/**/*', 'package.json', '**/.eslintrc', '.j
|
||||||
|
|
||||||
// Run the headless unit tests as you make changes.
|
// Run the headless unit tests as you make changes.
|
||||||
function watch() {
|
function watch() {
|
||||||
|
$.livereload.listen();
|
||||||
gulp.watch(watchFiles, ['build']);
|
gulp.watch(watchFiles, ['build']);
|
||||||
// gulp.watch(watchFiles, ['test']);
|
// gulp.watch(watchFiles, ['test']);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +162,9 @@ function testBrowser() {
|
||||||
},
|
},
|
||||||
externals: {
|
externals: {
|
||||||
// Proxy the global THREE variable to require('three')
|
// Proxy the global THREE variable to require('three')
|
||||||
'three': 'THREE'
|
'three': 'THREE',
|
||||||
|
// Proxy the global proj4 variable to require('proj4')
|
||||||
|
'proj4': 'proj4'
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
"gulp-filter": "^3.0.0",
|
"gulp-filter": "^3.0.0",
|
||||||
"gulp-istanbul": "^0.10.0",
|
"gulp-istanbul": "^0.10.0",
|
||||||
"gulp-jscs": "^3.0.0",
|
"gulp-jscs": "^3.0.0",
|
||||||
"gulp-livereload": "^3.4.0",
|
"gulp-livereload": "^3.8.1",
|
||||||
"gulp-load-plugins": "^0.10.0",
|
"gulp-load-plugins": "^0.10.0",
|
||||||
"gulp-mocha": "^2.0.0",
|
"gulp-mocha": "^2.0.0",
|
||||||
"gulp-plumber": "^1.0.1",
|
"gulp-plumber": "^1.0.1",
|
||||||
|
@ -81,7 +81,6 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"eventemitter3": "^1.1.1",
|
"eventemitter3": "^1.1.1",
|
||||||
"lodash.assign": "^4.0.2",
|
"lodash.assign": "^4.0.2",
|
||||||
"proj4": "^2.3.12",
|
|
||||||
"three-orbit-controls": "github:robhawkes/three-orbit-controls"
|
"three-orbit-controls": "github:robhawkes/three-orbit-controls"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
src/World.js
16
src/World.js
|
@ -1,13 +1,23 @@
|
||||||
import EventEmitter from 'eventemitter3';
|
import EventEmitter from 'eventemitter3';
|
||||||
|
import extend from 'lodash.assign';
|
||||||
|
import CRS from './geo/CRS/index';
|
||||||
import Engine from './engine/Engine';
|
import Engine from './engine/Engine';
|
||||||
|
|
||||||
// Pretty much any event someone using ViziCities would need will be emitted or
|
// Pretty much any event someone using ViziCities would need will be emitted or
|
||||||
// proxied by World (eg. render events, etc)
|
// proxied by World (eg. render events, etc)
|
||||||
|
|
||||||
class World extends EventEmitter {
|
class World extends EventEmitter {
|
||||||
constructor(domId) {
|
constructor(domId, options) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
var defaults = {
|
||||||
|
crs: CRS.EPSG3857
|
||||||
|
};
|
||||||
|
|
||||||
|
this._options = extend(defaults, options);
|
||||||
|
|
||||||
|
console.log(this._options);
|
||||||
|
|
||||||
this._layers = [];
|
this._layers = [];
|
||||||
this._controls = [];
|
this._controls = [];
|
||||||
|
|
||||||
|
@ -125,6 +135,6 @@ class World extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialise without requiring new keyword
|
// Initialise without requiring new keyword
|
||||||
export default function(domId) {
|
export default function(domId, options) {
|
||||||
return new World(domId);
|
return new World(domId, options);
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<script src='http://localhost:35729/livereload.js'></script>
|
<script src='http://localhost:35729/livereload.js'></script>
|
||||||
|
|
||||||
<!-- Load dependencies -->
|
<!-- Load dependencies -->
|
||||||
|
<script src="../examples/vendor/proj4.js"></script>
|
||||||
<script src="../examples/vendor/three.min.js"></script>
|
<script src="../examples/vendor/three.min.js"></script>
|
||||||
|
|
||||||
<!-- Load the built library -->
|
<!-- Load the built library -->
|
||||||
|
|
Ładowanie…
Reference in New Issue