Fixed controls to x/y plane

master
Robin Hawkes 2016-02-12 21:51:41 +00:00
rodzic 946bc2dbfb
commit 4e78610365
5 zmienionych plików z 27 dodań i 37 usunięć

48
dist/vizicities.js vendored
Wyświetl plik

@ -799,17 +799,6 @@ return /******/ (function(modules) { // webpackBootstrap
key: '_flyTo',
value: function _flyTo(point, noZoom) {}
// Internal methods called when before, during and after control updates
}, {
key: '_onStart',
value: function _onStart() {}
}, {
key: '_onChange',
value: function _onChange() {}
}, {
key: '_onEnd',
value: function _onEnd() {}
// Proxy to OrbitControls.update()
}, {
key: 'update',
@ -835,6 +824,11 @@ return /******/ (function(modules) { // webpackBootstrap
// See: http://stackoverflow.com/a/26188674/997339
this._controls = new _OrbitControls(world._engine._camera, world._container);
this._controls.maxPolarAngle = Math.PI / 2;
this._controls.enableDamping = true;
this._controls.dampingFactor = 0.25;
this._initEvents();
this.emit('added');
@ -949,17 +943,15 @@ return /******/ (function(modules) { // webpackBootstrap
var v = new THREE.Vector3();
return function panLeft ( distance ) {
return function panLeft(distance) {
var te = this.object.matrix.elements;
var adjDist = distance / Math.cos(phi);
var te = this.object.matrix.elements;
v.set(te[ 0 ], 0, te[ 2 ]).normalize();
v.multiplyScalar(-adjDist);
// get X column of matrix
v.set( te[ 0 ], te[ 1 ], te[ 2 ] );
v.multiplyScalar( - distance );
panOffset.add( v );
};
panOffset.add(v);
};
}();
@ -968,17 +960,15 @@ return /******/ (function(modules) { // webpackBootstrap
var v = new THREE.Vector3();
return function panUp ( distance ) {
return function panUp(distance) {
var te = this.object.matrix.elements;
var adjDist = distance / Math.cos(phi);
var te = this.object.matrix.elements;
v.set(te[ 8 ], 0, te[ 10 ]).normalize();
v.multiplyScalar(-adjDist);
// get Y column of matrix
v.set( te[ 4 ], te[ 5 ], te[ 6 ] );
v.multiplyScalar( distance );
panOffset.add( v );
};
panOffset.add(v);
};
}();

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

@ -80,6 +80,6 @@
},
"dependencies": {
"eventemitter3": "^1.1.1",
"three-orbit-controls": "^72.0.0"
"three-orbit-controls": "github:robhawkes/three-orbit-controls"
}
}

Wyświetl plik

@ -54,11 +54,6 @@ class Orbit extends EventEmitter {
// has got to
_flyTo(point, noZoom) {}
// Internal methods called when before, during and after control updates
_onStart() {}
_onChange() {}
_onEnd() {}
// Proxy to OrbitControls.update()
update() {
this._controls.update();
@ -78,6 +73,11 @@ class Orbit extends EventEmitter {
// See: http://stackoverflow.com/a/26188674/997339
this._controls = new _OrbitControls(world._engine._camera, world._container);
this._controls.maxPolarAngle = Math.PI / 2;
this._controls.enableDamping = true;
this._controls.dampingFactor = 0.25;
this._initEvents();
this.emit('added');