add pluggable mouse control

This commit is contained in:
Stewart Allen 2020-11-17 20:26:13 -05:00
commit ba56b36af2
2 changed files with 23 additions and 3 deletions

View file

@ -62,13 +62,26 @@ MOTO.CTRL = function (object, domElement, notify, slider) {
BOTTOM: 40
};
// Mouse buttons
this.mouseButtons = {
// default mouse buttons
this.mouseDefault = {
ORBIT: THREE.MOUSE.LEFT,
ZOOM: THREE.MOUSE.MIDDLE,
// ZOOM: THREE.MOUSE.MIDDLE,
PAN: THREE.MOUSE.RIGHT
};
// Onshape
this.mouseOnshape = {
ORBIT: THREE.MOUSE.RIGHT,
// ZOOM: THREE.MOUSE.MIDDLE,
PAN: THREE.MOUSE.MIDDLE
};
this.mouseButtons = this.mouseDefault;
this.setMouse = function(bindings) {
this.mouseButtons = bindings;
};
let scope = this,
domEl = scope.domElement,
EPS = 0.000001,

View file

@ -844,6 +844,13 @@
save: function() { return viewControl.getPosition(true) },
panTo: function(x,y,z) { tweenCamPan(x,y,z) },
setZoom: function(r,v) { viewControl.setZoom(r,v) },
setCtrl: function(name) {
if (name === 'onshape') {
viewControl.setMouse(viewControl.mouseOnshape);
} else {
viewControl.setMouse(viewControl.mouseDefault);
}
},
getFPS: function() { return fps }
},