add pluggable mouse control
This commit is contained in:
parent
7b0a85b9a2
commit
ba56b36af2
2 changed files with 23 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue