-
Notifications
You must be signed in to change notification settings - Fork 76
feat: Implement boardAnchorPosition and boardAnchorAlignment for boards #1438
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
Conversation
@Excellencedev is attempting to deploy a commit to the tscircuit Team on Vercel. A member of the Team first needs to authorize it. |
29487d6
to
be2ffe0
Compare
@seveibar Please review |
@seveibar Please review this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The snapshots are blank, I don't know what the change did. Make sure the tests demonstrate what the change you did
will do so now |
@imrishabh18 I have fixed that and the snapshots now represent the changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok but the tests need to make it clear that it's actually working, use silkscreen_text to indicate positions e.g. have some text say "(0,0)" or other points of interest on each diagram
also add text that indicates the anchorAlignment of the board and the board anchor position
@seveibar I have added it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont set the resistor position so that we can determine if auto positioning works (we may accept even if it doesnt)
Clarify in the silscreen by sating board.anchor , and place the text at that anchor
@seveibar done that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a test that shows what happens if you dont set width and height so we can snapshot what happens with auto sizing, you will need two resistors so that there are elements to autosize
After we document that behavior you should be good
@seveibar fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The autosizing implementation should be adjusted to include the anchor point. It wont be fully fixed but good enough to claim.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment
Suggested by seievebar Co-authored-by: Severin Ibarluzea <[email protected]>
@seveibar I committed suggestion |
@seveibar Thanks for reviewing and merging |
/claim #1371
/closes #1371
DESCRIPTION :
This PR introduces two new props for the
Board
component:boardAnchorPosition
andboardAnchorAlignment
. These props allow developers to specify the anchor point and alignment for a board, which is particularly useful for auto-sizing boards.boardAnchorPosition
: A point object{ x: number, y: number }
that specifies the anchor point.boardAnchorAlignment
: A string that specifies how the board should be aligned to the anchor point. Possible values are"center"
,"top_left"
,"top_right"
,"bottom_left"
,"bottom_right"
,"top"
,"bottom"
,"left"
, and"right"
.The implementation modifies the
doInitialPcbBoardAutoSize
method in theBoard
component to calculate the board's center based on these new props.Logs from the test:
USER@DESKTOP-1PHUG1C MINGW64 ~/3D Objects/core (issue-1371-fix)
$ bun test tests/examples/example34-board-anchor1.test.tsx tests/examples/example34-board-anchor2.test.tsx tests/examples/example34-board-anchor3.test.tsx
bun test v1.2.20 (6ad208bc)
tests\examples\example34-board-anchor1.test.tsx:
✓ Board Anchor > should anchor the board to the top-left [172.00ms]
tests\examples\example34-board-anchor2.test.tsx:
✓ Board Anchor > should anchor the board to the bottom-right [94.00ms]
tests\examples\example34-board-anchor3.test.tsx:
✓ Board Anchor > should anchor the board to the center [94.00ms]
3 pass
0 fail
3 expect() calls
Ran 3 tests across 3 files. [2.17s]