fix widget mesh move optimiztion that prevented track.box from being set

This commit is contained in:
Stewart Allen 2022-11-13 13:36:33 -05:00
commit 41141816ba

View file

@ -440,18 +440,20 @@ class Widget {
* todo use new prototype.moveMesh() * todo use new prototype.moveMesh()
*/ */
moveMesh(x, y, z) { moveMesh(x, y, z) {
if (!(x || y || z)) { // if (!(x || y || z)) {
return; // return;
} // }
let gap = this.mesh.geometry.attributes.position, let gap = this.mesh.geometry.attributes.position,
pa = gap.array; pa = gap.array;
// center point array on 0,0,0 // center point array on 0,0,0
for (let i=0; i < pa.length; i += 3) { if (x || y || z) {
pa[i ] -= x; for (let i=0; i < pa.length; i += 3) {
pa[i + 1] -= y; pa[i ] -= x;
pa[i + 2] -= z; pa[i + 1] -= y;
pa[i + 2] -= z;
}
gap.needsUpdate = true;
} }
gap.needsUpdate = true;
let bb = this.groupBounds(); let bb = this.groupBounds();
// critical to layout and grouping // critical to layout and grouping
this.track.box = { this.track.box = {
@ -461,8 +463,10 @@ class Widget {
}; };
// for use with the packer // for use with the packer
// invalidate cached points // invalidate cached points
this.points = null; if (x || y || z) {
this.setModified(); this.points = null;
this.setModified();
}
} }
setIndexed(z) { setIndexed(z) {