reduce edges recalculation when enabled

This commit is contained in:
Stewart Allen 2026-01-05 15:33:29 -05:00
commit 9e816dd14b
2 changed files with 19 additions and 12 deletions

View file

@ -442,12 +442,10 @@ class Widget {
}
_updateMeshPosition() {
let mesh = this.mesh,
track = this.track,
tzoff = track.tzoff,
top = track.top,
tz = -tzoff,
{ x, y, z } = track.pos;
let { cache, mesh, track } = this,
{ top, tzoff } = track,
{ x, y, z } = track.pos,
tz = -tzoff;
if (track.indexed) {
this.mesh.rotation.x = -track.indexRad;
z = top;
@ -455,8 +453,12 @@ class Widget {
this.mesh.rotation.x = 0;
z += tz;
}
mesh.position.set(x, y, z);
this._updateEdges();
let { pos } = cache;
if (!pos || pos.x !== x || pos.y !==y || pos.z !== z) {
mesh.position.set(x, y, z);
this._updateEdges();
cache.pos = { x, y, z };
}
}
_updateEdges() {