Skip to content

Commit acc1966

Browse files
committed
Set annotation mesh rotation from begin
1 parent 35d00c5 commit acc1966

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

modules/draw/TAnnotation3DPainter.mjs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@ class TAnnotation3DPainter extends TTextPainter {
2121

2222
if (fp?.mode3d && !this.use_2d) {
2323
const mesh = build3dlatex(text, '', this, fp);
24-
2524
mesh.traverse(o => o.geometry?.rotateX(Math.PI / 2));
26-
mesh.position.x = fp.grx(text.fX);
27-
mesh.position.y = fp.gry(text.fY);
28-
mesh.position.z = fp.grz(text.fZ);
29-
mesh.rotation.z = getRotation(fp.camera, mesh);
30-
25+
mesh.position.set(fp.grx(text.fX), fp.gry(text.fY), fp.grz(text.fZ));
26+
mesh.rotation.set(0, 0, getRotation(fp.camera, mesh));
3127
fp.processRender3D = true;
3228
fp.add3DMesh(mesh, this, true);
3329
fp.render3D(100);
@@ -60,7 +56,9 @@ class TAnnotation3DPainter extends TTextPainter {
6056
new_y = this.axisToSvg('y', pos.y, true);
6157
makeTranslate(this.getG(), new_x - this.pos_x, new_y - this.pos_y);
6258
} else
63-
fp.get3DMeshes(this).forEach(mesh => { mesh.rotation.z = getRotation(fp.camera, mesh); });
59+
fp.get3DMeshes(this).forEach(mesh => {
60+
mesh.rotation.set(0, 0, getRotation(fp.camera, mesh));
61+
});
6462
}
6563

6664
/** @summary draw TAnnotation3D object */

0 commit comments

Comments
 (0)