ieskudero / three-dxf-viewer

DXF viewer using ThreeJS
https://www.npmjs.com/package/three-dxf-viewer
MIT License
71 stars 25 forks source link

Text is not centered #11

Closed islovingness closed 5 months ago

islovingness commented 5 months ago

dxf files in cad, text can identify anchor points in the middle and lower, middle and upper. But in three-dxf-viewer it seems to always be the bottom left;

dxf zip is attached.

thank you! [Uploading test.zip…]()

islovingness commented 5 months ago

dxf files in cad, text can identify anchor points in the middle and lower, middle and upper. But in three-dxf-viewer it seems to always be the bottom left;

dxf zip is attached.

thank you! Uploading test.zip…

test.zip

islovingness commented 5 months ago

The cause of the problem should be textEntity._getPosAndRotation does not use entity.hAlign and entity.vAlign, right?

ieskudero commented 5 months ago

Could be, I will try to check it.

ieskudero commented 5 months ago

Looks like you were right! The text needed vertical and horizontal alignment, as you suggested. I created a method to align the text, _alignText, but I would need a few more examples to fix all the possible alignments. I'll close this issue until more examples arrives with specific alignments. Thanks for the help!