html2canvas
html2canvas copied to clipboard
fix: correct text alignment
Summary
This PR fixes/implements the following bugs/features
- [X] #2107
Explain the motivation for making this change. What existing problem does the pull request solve?
Text in div elements was not properly aligned.
Test plan (required)
This has been tested by several users in #2107 and suggested directly by @niaodan2b and @metawebmarketing. I'm merely offering a PR to integrate the fix.
Code formatting
Please make sure that code adheres to the project code formatting. Running npm run format
will automatically format your code correctly.
Closing issues
Fixes #2107
Hey I don't believe this is the correct change. I think calculating the y position should be done with text.bounds.top + text.bounds.height - baseline
y = top of the text + the height of the text - the baseline for the font
Thanks, I made the change and did a manual test on a text box.
Oh I noticed you created #2938 , should I close this PR @haztheo ?
I actually checked again and the previous setting worked better on mobile. Otherwise text would be at the top of my div.
all text is still displacement in the new version of 1.4.1
I tested this solution, it does not work, it moves text vertically up for half of the text height.
1.4.1新版本中所有文字依然是位移
+1
not working on links
Should be closed for #2938