Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing line stroke width shifts it to the right #2187

Closed
DanieleSassoli opened this issue May 12, 2015 · 2 comments · Fixed by #2206
Closed

Changing line stroke width shifts it to the right #2187

DanieleSassoli opened this issue May 12, 2015 · 2 comments · Fixed by #2206
Labels

Comments

@DanieleSassoli
Copy link
Contributor

Hi,
I'm trying to make a line thicker, as per my understanding I have to change the strokeWidth of the line.
If I change the strokeWidth property thel ine actually gets bigger but also shifts to the right.
I prepared a jsfiddle, try fiddleing around with the strokeWidth value and you will se that the origin point of the line moves right together with the strokeWidth. This is the fiddle: http://jsfiddle.net/3mqgp08m/1/ , the rectangle is there just to give you a point to compare with the line starting point.

@asturur
Copy link
Member

asturur commented May 12, 2015

Hi Daniele,
this bug as been discussed here:

#2177

we are aware of that, and we will take care of that with bounding box fixes.
The line, has strokewidth just on one "side", the lenght side, and things get more complicated when we have strange angles ( triangles for example ).

As a temp fix you can search for the translating functions int the code ( getCenterPoint and so on.. ) and change the use of strokewidth with something like that:

vLine = target.type === 'line' && target.width === 0,
hLine = target.type === 'line' && target.height === 0,
strokeWidthX = hLine ? 0 : target.strokeWidth,
strokeWidthY = vLine ? 0 : target.strokeWidth;

And use separate strokedithX and Y for the width and height.
I know that this is not accurate explanation, but the problem lies here, i hope this give you enough information to go on, After 1.5.1 release we will work on that.

@DanieleSassoli
Copy link
Contributor Author

Hi,
I saw the issue you referred to, I tought they weren't connected, sorry for the extra work then and thank's for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants