fix click to focus and lay flaat
This commit is contained in:
parent
d947963c28
commit
56faa5cee1
2 changed files with 7 additions and 9 deletions
|
|
@ -374,7 +374,7 @@ function space_init(data) {
|
|||
let obj = int?.object;
|
||||
if (obj) api.selection.drag({ start: int.object });
|
||||
if (obj) obj.sketch_item?.sketch.drag({ start: int.object });
|
||||
return selection.count() ? api.objects(true) : undefined;
|
||||
return selection.count() && !event.altKey ? api.objects(true) : undefined;
|
||||
});
|
||||
|
||||
// called two ways:
|
||||
|
|
@ -402,7 +402,7 @@ function space_init(data) {
|
|||
// rotate normal using group's matrix
|
||||
const normal = shiftKey ? int.face.normal.applyQuaternion(q) : undefined;
|
||||
// y,z swap due to world rotation for orbit controls
|
||||
api.focus({center: { x, y:-z, z:y }, normal});
|
||||
api.focus({ center: { x, y:-z, z:y }, normal });
|
||||
let one = api.sketch.selected.one;
|
||||
if (one && confirm('attach sketch to face?')) {
|
||||
one.center = {
|
||||
|
|
@ -415,7 +415,7 @@ function space_init(data) {
|
|||
};
|
||||
one.render();
|
||||
}
|
||||
} else if (ctrlKey) {
|
||||
} else if (ctrlKey && selection.contains(model)) {
|
||||
// rotate selected face towawrd z "floor"
|
||||
group.rotateTowardZ(int.face.normal);
|
||||
selection.update();
|
||||
|
|
|
|||
|
|
@ -1530,17 +1530,15 @@ const api = {
|
|||
}
|
||||
},
|
||||
|
||||
// @param object {MeshObject | MeshObject[]}
|
||||
// @param object {MeshObject | MeshObject[] | Object}
|
||||
focus(object) {
|
||||
let { center } = meshUtil.bounds(object);
|
||||
console.log({ focus: object });
|
||||
let { center } = object.center ? object : meshUtil.bounds(object);
|
||||
// when no valid objects supplied, set origin
|
||||
if (isNaN(center.x * center.y * center.z)) {
|
||||
center = { x: 0, y: 0, z: 0 };
|
||||
}
|
||||
let { normal } = Array.isArray(object) && object.length ?
|
||||
object[0].object :
|
||||
object.object ||
|
||||
{ };
|
||||
let { normal } = object;
|
||||
let left, up;
|
||||
if (normal) {
|
||||
let { x, y, z } = normal;
|
||||
|
|
|
|||
Loading…
Reference in a new issue