dxfjs / writer

A JavaScript dxf generator written in TypeScript.
https://dxf.vercel.app
MIT License
90 stars 17 forks source link

not able to justify the text to middle center #34

Closed DeepankarGupta13 closed 2 years ago

DeepankarGupta13 commented 2 years ago

when I am doing this function drawText() { const text = dxf.addText(point3d(20, 20, 0), 1, 'GGWP', { rotation: 30, horizontalAlignment: 1, verticalAlignment: 2, }) console.log('text: ', text); } the position of the text becomes origin image I tried second alignment point also text.secondAlignmentPoint = point3d(20, 20, 0); it is also not working pls help

tarikjabiri commented 2 years ago

Hi,

I think it's the expected behavior 🤔.

DeepankarGupta13 commented 2 years ago

Sir, if i want to add my text at (20,20) and the text justify should be middle center. How i should i do that?

tarikjabiri commented 2 years ago

Ohhhh the text is moved to the 0,0 when using alignement.

This is a bug I will fix it.

tarikjabiri commented 2 years ago

Update to v2.5.3 and try this:

import { DxfWriter, point3d, TextHorizontalAlignment, TextVerticalAlignment } from "@tarikjabiri/dxf";
const dxf = new DxfWriter();
dxf.addText(point3d(20, 20), 1, 'GGWP', {
    rotation: 30,
    horizontalAlignment: TextHorizontalAlignment.Center,
    verticalAlignment: TextVerticalAlignment.Middle,
    secondAlignmentPoint: point3d(20, 20),
});
DeepankarGupta13 commented 2 years ago

thank you sir.