fix sketch centering

This commit is contained in:
Stewart Allen 2025-06-15 18:59:59 -04:00
commit 8c9ff300dc
2 changed files with 10 additions and 2 deletions

View file

@ -293,7 +293,7 @@ const selection = {
}, },
focus() { focus() {
api.focus(selection.list()); selection.count() && api.focus(selection.list());
}, },
bounds() { bounds() {
@ -1537,7 +1537,10 @@ const api = {
if (isNaN(center.x * center.y * center.z)) { if (isNaN(center.x * center.y * center.z)) {
center = { x: 0, y: 0, z: 0 }; center = { x: 0, y: 0, z: 0 };
} }
let { normal } = Array.isArray(object) ? object[0].object : object.object; let { normal } = Array.isArray(object) && object.length ?
object[0].object :
object.object ||
{ };
let left, up; let left, up;
if (normal) { if (normal) {
let { x, y, z } = normal; let { x, y, z } = normal;

View file

@ -118,6 +118,11 @@ class MeshSketch extends meshObject {
return this.group; return this.group;
} }
get bounds() {
this.plane.geometry.computeBoundingBox();
return this.plane.geometry.boundingBox.clone();
}
get meshes() { get meshes() {
return this.group.children.filter(c => { return this.group.children.filter(c => {
return c.sketch || (c.sketch_item && c.sketch_item.selected) ? c : undefined return c.sketch || (c.sketch_item && c.sketch_item.selected) ? c : undefined