-
Notifications
You must be signed in to change notification settings - Fork 406
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
Better image rotation on Javascript #2631
Comments
Can you fill out your test case to reproduce it? I have the following and it seems to work ok. Rotation is identical in both js and simulator.
|
Full example code: Main class:
WaitingButton.java
Result of the web-app installed on the iPhone home (the rotating arrows slightly moves up and down during the rotation, this thing doesn't happen on the native apps): |
This is specific to font images and is related to calculating font widths, heights, and ascents which has been particularly tricky. It is closely related to the following issues: Unfortunately the techniques that I am using for font size calculations are still approximate - and this is exposed when you are rotating an image of a glyph where you assume that the glyph is centered in the image, but, in fact, may not be exactly centered. The current state of font sizing and alignment is at a "local maximum" state. It yields "pretty good" results across all browsers for the test cases in #2527 and #2540. I have taken a few stabs at improving things, but have not yet been able to improve on it. I have been able to resolve this particular issue at times, but at the expense of making other cases worse. Anyways, that's the state of things. I'm going to attempt to deal with material fonts as a special case to see if I can improve this particular issue without negatively impacting the others. |
Can we provide a hint about this as a temporary workaround? |
That's the sort of thing I'm going to attempt. The tricky part is the rasterization step. Making sure that the glyph is rendered exactly in the center of the image, when the font width/height calculations aren't 100% accurate. |
I feel dirty. I put in a special case for font size calculation and rendering of the material design font. This appears to fix the issue in my tests. So far I've tested Chrome, Firefox, Safari on Mac (both retina and non-retina), Chrome on Android, Safari iOS, Chrome/Edge/Firefox on Windows 10. This will be included in the next update on Friday. |
Thank you! |
I've just tested the new image rotation (with the same code): it's a lot better! |
A code similar to the following, produces a strange rotation in Javascript, because the image is not only rotated, but also slightly moved during the moving (test with Chrome on Android and on iOS):
The text was updated successfully, but these errors were encountered: