-
-
Notifications
You must be signed in to change notification settings - Fork 291
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 #1035 : Column alignment when zoom font only settings in browser #1036
fix #1035 : Column alignment when zoom font only settings in browser #1036
Conversation
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.
It works much better, thanks!
For the other reviewers, the "zoom text only" feature is used for people with visual deficiencies, so that improves the accessibility.
Here is a preview (you must use Firefox, Chrom* browsers don't have such feature):
Without the patch
recording-orig-behavior.mp4
With the patch
recording.mp4
(apologies, I'm going to use this PR as a guinea pig to examine exactly why our machinery for deploying previews of PRs doesn't function for PRs from forks) |
app/client/components/GridView.js
Outdated
@@ -70,7 +70,8 @@ const SHORT_CLICK_IN_MS = 500; | |||
// size of the plus width () | |||
const PLUS_WIDTH = 40; | |||
// size of the row number field (we assume 4rem) | |||
const ROW_NUMBER_WIDTH = 52; | |||
const ROW_NUMBER_WIDTH_REM = 4; | |||
const ROW_NUMBER_WIDTH_PX = 3.25 * ROW_NUMBER_WIDTH_REM; // 52px when no text zoom is applied |
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.
Hi @hexaltation.
Can you extend the comment here with the math behind it? How 4 * 3.25 * root font size equals 52px ?
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.
Hello @berhalak
I pushed a more (I hope) explicit comment.
The problem is I don't know why a factor of 3.25 have to be applied, except that 52px is the working value in InitialOffset
and MiddleOffset
.
May be it's better to get rid of ROW_NUMBER_WIDTH_PX
and make the 3.25 factor appear by magic in Offsets formulas.
const initialOffset = -this.frozenWidth() - 3.25 * ROW_NUMBER_WIDTH + this.width() - revealWidth - PLUS_WIDTH;
const middleOffset = -this.frozenWidth() - 3.25 * ROW_NUMBER_WIDTH_PX + this.width() / 2;
Let me know
One note I'd like to add is to be sure to test this with frozen columns. |
If it can improve this workflow it's a pleasure :) |
Update: we know what the issue is, and making it works needs some rejiggering to the workflow that @SleepyLeslie will be looking at. |
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.
I'm still confused a little bit :). In this line:
// as 1rem=16px -> 3.25 * 4 * 16 = 52px when no text zoom is applied
- 1rem equals to 13px in Grist, not 16px
- The math is wrong, even for 16px, the expression equals to 208px
I think it will be hard to do the math here properly, as the effect you want to achieve is a mix of font-size width
and absolute width
zooming. In your video, font is made bigger, but columns widths are not changed. Only the row number div is scaled. The math used for scrolling or calculating frozen offset doesn't assume that, it looks like a coincident that it works. I think we have some sanity
checks and some values are trimmed, and it somehow works.
I think that the proper behavior is in the video below:
zoom-font.mp4
And this can be easily achived by replacing all 4rem
and 4em
sizes with 52px
in GridView.css.
91bac0b
to
3678ab2
Compare
@berhalak I've made the needed changes according to your suggestions. |
👍 |
Deployed commit |
Thanks @hexaltation ! |
fix #1035
Use rem value instead of fixed pixel where needed.
Removed inline style 52px for
.gridview_data_row_num