html2canvas icon indicating copy to clipboard operation
html2canvas copied to clipboard

fix: correct text alignment

Open borisdayma opened this issue 2 years ago • 9 comments

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

borisdayma avatar Aug 17 '22 21:08 borisdayma

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

haztheo avatar Aug 18 '22 16:08 haztheo

Thanks, I made the change and did a manual test on a text box.

borisdayma avatar Aug 24 '22 21:08 borisdayma

Oh I noticed you created #2938 , should I close this PR @haztheo ?

borisdayma avatar Aug 24 '22 21:08 borisdayma

I actually checked again and the previous setting worked better on mobile. Otherwise text would be at the top of my div.

borisdayma avatar Aug 26 '22 01:08 borisdayma

all text is still displacement in the new version of 1.4.1

happychen666 avatar Feb 16 '23 03:02 happychen666

I tested this solution, it does not work, it moves text vertically up for half of the text height.

zlac avatar Mar 12 '23 14:03 zlac

1.4.1新版本中所有文字依然是位移

+1

niuweili avatar Apr 19 '23 08:04 niuweili

not working on links

marcsoeropen2bizz avatar Jun 20 '23 12:06 marcsoeropen2bizz

Should be closed for #2938

Sharcoux avatar Aug 31 '23 02:08 Sharcoux