-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix position of overflowing annotations by refactoring VisCanvas
#1467
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
axelboc
force-pushed
the
fix-annoations
branch
from
August 10, 2023 11:07
6ce0207
to
02ce0ba
Compare
axelboc
commented
Aug 10, 2023
axelboc
force-pushed
the
fix-annoations
branch
from
August 10, 2023 11:25
02ce0ba
to
8190136
Compare
/approve |
axelboc
commented
Aug 10, 2023
axelboc
force-pushed
the
fix-annoations
branch
from
August 11, 2023 07:07
f73f938
to
7094462
Compare
This was referenced Aug 11, 2023
loichuder
approved these changes
Aug 21, 2023
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.
👍
axelboc
force-pushed
the
fix-annoations
branch
from
August 21, 2023 13:23
851d010
to
6ccecfc
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As mentioned in #1466, annotations with
overflowCanvas
do not work as expected: they are positioned in relation tocanvasWrapper
, the root element rendered byVisCanvas
, which defines padding for the axes.In this PR, I remedy this problem by refactoring
VisCanvas
once again in order to have acanvasWrapper
element with the same size as thecanvas
that, unliker3fRoot
, does not hide overflow.The root element rendered by
VisCanvas
is now calledvisCanvas
(this may change in later refactors) and no longer has any padding. Instead, it takes on the role ofaxisSystem
by setting up the CSS grid that lays everything out:canvasWrapper
is now a child ofvisCanvas
and positioned withgrid-area
.visCanvas
and also positioned withgrid-area
.So instead of:
... we now have:
I had tried similar refactors before but always ran into overflow issues. The key that unlocked it this time is the use of
minmax(0, 1fr)
instead of1fr
for sizing the grid area reserved for the canvas. This has a similar effect tomin-width: 0
andmin-height: 0
when using Flexbox. See https://css-tricks.com/preventing-a-grid-blowout/Another important reason this layout works is because CSS Grid allows positioning multiple grid items into the same grid area. The items then behave as if they were positioned absolutely on top of one another. In our case, the axis grids are positioned in the same CSS Grid area as
canvasWrapper
. I feel like this will enable further refactors.