-
Notifications
You must be signed in to change notification settings - Fork 279
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
Module placement not showing correct angle #561
Comments
@danmarshall |
Hi @Gautam2010 I tried taking a look but ran out of time as it was a somewhat complicated scenario. I do remember in the code that there were 3 chains found. Knowing that the layout is based on chainToPoints I tried to just get the points then see that using ConnectTheDots. I spent a bit of time with your example code but spent much time with the React / updating loop in CodeSandbox. Can you simplify the repro without using React? |
@danmarshall |
Hi @danmarshall I was working on the issue and noticed that the way the angles are calculated for the rotation are dependent on the position of points with respect to the other position points which works but only when children on chain are closely placed. maker.js/packages/maker.js/src/core/layout.ts Line 154 in fb569bc
In this case the points are far apart from each other hence the issue. |
There could be multiple ways of updating
I guess best would be to use the path segment for the placement point to get the angle. |
@noobd3v thanks for working on the issue 👍🏽 and you are correct that is the method for layout. I agree that the method you suggest may also be useful. There's scenarios where each style might be appropriate, so this could be a new option. |
Hi @danmarshall I tried updating the existing function and added the extra parameter to take as flag for rotation along the placed path.
Here are the changes for your reference that I have done to achieve the functionality. Can you please look into it let me know where I am wrong about my approach. |
I might be providing more than enough information in the callback but I thought it might be useful in some cases. |
Created PR for feature. |
I am trying to draw model on chains using
layout.childrenOnChain
but some of modules are not placed correctly.Any idea on this?
Code reproduced here
https://codesandbox.io/s/makerjs-module-placement-angle-are-incorrect-mrrrwv
The text was updated successfully, but these errors were encountered: