fix widget edges updated on mesh move
This commit is contained in:
parent
88be756703
commit
ce79edbf93
1 changed files with 12 additions and 9 deletions
|
|
@ -70,7 +70,8 @@ class Widget {
|
||||||
},
|
},
|
||||||
top: 0, // z top
|
top: 0, // z top
|
||||||
mirror: false,
|
mirror: false,
|
||||||
indexed: false
|
indexed: false,
|
||||||
|
indexRad: 0
|
||||||
},
|
},
|
||||||
// used to cache shadow geo
|
// used to cache shadow geo
|
||||||
this.cache = {};
|
this.cache = {};
|
||||||
|
|
@ -446,14 +447,20 @@ class Widget {
|
||||||
tz = -tzoff,
|
tz = -tzoff,
|
||||||
{ x, y, z } = track.pos;
|
{ x, y, z } = track.pos;
|
||||||
if (track.indexed) {
|
if (track.indexed) {
|
||||||
let rad = track.indexRad;
|
this.mesh.rotation.x = -track.indexRad;
|
||||||
this.mesh.rotation.x = -rad;
|
|
||||||
z = top;
|
z = top;
|
||||||
} else {
|
} else {
|
||||||
this.mesh.rotation.x = 0;
|
this.mesh.rotation.x = 0;
|
||||||
z += tz;
|
z += tz;
|
||||||
}
|
}
|
||||||
mesh.position.set(x, y, z);
|
mesh.position.set(x, y, z);
|
||||||
|
this._updateEdges();
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateEdges() {
|
||||||
|
if (this.outline && this.setEdges) {
|
||||||
|
this.setEdges(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scale(x, y, z) {
|
scale(x, y, z) {
|
||||||
|
|
@ -473,9 +480,7 @@ class Widget {
|
||||||
if (this.setWireframe) this.setWireframe(false);
|
if (this.setWireframe) this.setWireframe(false);
|
||||||
this.clearSlices();
|
this.clearSlices();
|
||||||
mesh.geometry.applyMatrix4(new THREE.Matrix4().makeScale(x, y, z));
|
mesh.geometry.applyMatrix4(new THREE.Matrix4().makeScale(x, y, z));
|
||||||
if (this.outline && this.setEdges) {
|
this._updateEdges();
|
||||||
this.setEdges(true);
|
|
||||||
}
|
|
||||||
scale.x *= (x || 1.0);
|
scale.x *= (x || 1.0);
|
||||||
scale.y *= (y || 1.0);
|
scale.y *= (y || 1.0);
|
||||||
scale.z *= (z || 1.0);
|
scale.z *= (z || 1.0);
|
||||||
|
|
@ -489,9 +494,7 @@ class Widget {
|
||||||
if (center) {
|
if (center) {
|
||||||
this.center(false);
|
this.center(false);
|
||||||
}
|
}
|
||||||
if (this.outline && this.setEdges) {
|
this._updateEdges();
|
||||||
this.setEdges(true);
|
|
||||||
}
|
|
||||||
if ((x || y || z) && this.api && this.api.event) {
|
if ((x || y || z) && this.api && this.api.event) {
|
||||||
this.api.event.emit('widget.rotate', {widget: this, x, y, z});
|
this.api.event.emit('widget.rotate', {widget: this, x, y, z});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue