add rotate to face with meta/ctrl on selected object
This commit is contained in:
parent
e7b1af60a4
commit
63be296463
3 changed files with 24 additions and 7 deletions
|
|
@ -367,7 +367,7 @@ var gs_kiri_init = exports;
|
|||
return;
|
||||
}
|
||||
let coord = prompt("Enter X,Y,Z degrees of rotation").split(','),
|
||||
prod = Math.PI / 360,
|
||||
prod = Math.PI / 180,
|
||||
x = parseFloat(coord[0] || 0.0) * prod,
|
||||
y = parseFloat(coord[1] || 0.0) * prod,
|
||||
z = parseFloat(coord[2] || 0.0) * prod;
|
||||
|
|
@ -1549,7 +1549,13 @@ var gs_kiri_init = exports;
|
|||
SPACE.platform.setGrid(25, 5);
|
||||
SPACE.platform.opacity(0.2);
|
||||
|
||||
SPACE.mouse.downSelect(function() {
|
||||
SPACE.mouse.downSelect(function(int,event) {
|
||||
// lay flat with meta or ctrl clicking a selected face
|
||||
if (int && (event.ctrlKey || event.metaKey)) {
|
||||
let q = new THREE.Quaternion();
|
||||
q.setFromUnitVectors(int.face.normal, new THREE.Vector3(0,0,-1));
|
||||
API.selection.rotate(q);
|
||||
}
|
||||
if (API.view.get() !== VIEWS.ARRANGE) return null;
|
||||
return API.selection.meshes();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -450,12 +450,21 @@ var gs_kiri_widget = exports;
|
|||
this.bounds = null;
|
||||
this.setWireframe(false);
|
||||
this.clearSlices();
|
||||
this.mesh.geometry.applyMatrix4(new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0)));
|
||||
let m4 = new THREE.Matrix4();
|
||||
let euler = typeof(x) === 'number';
|
||||
if (euler) {
|
||||
m4 = m4.makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0));
|
||||
} else {
|
||||
m4 = m4.makeRotationFromQuaternion(x);
|
||||
}
|
||||
this.mesh.geometry.applyMatrix4(m4);
|
||||
this.center();
|
||||
let rot = this.orient.rot;
|
||||
rot.x += (x || 0);
|
||||
rot.y += (y || 0);
|
||||
rot.z += (z || 0);
|
||||
if (euler) {
|
||||
let rot = this.orient.rot;
|
||||
rot.x += (x || 0);
|
||||
rot.y += (y || 0);
|
||||
rot.z += (z || 0);
|
||||
}
|
||||
};
|
||||
|
||||
PRO.mirror = function() {
|
||||
|
|
|
|||
|
|
@ -440,6 +440,8 @@ var MOTO = window.moto = window.moto || {};
|
|||
mouseDragPoint = trackInt.point.clone();
|
||||
mouseDragStart = mouseDragPoint;
|
||||
viewControl.enabled = false;
|
||||
}
|
||||
if (selectInt) {
|
||||
mouseDownSelect(selectInt, event);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue