-
Notifications
You must be signed in to change notification settings - Fork 6k
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
SubtitleView custom layout measurement #4788
Comments
Not sure this is correct. The text is positioned relative to the bottom edge of the parent. Thus we subtract the height of the text and the padding from the bottom edge to get the top of the text. This is independent of the top of the parent and it may mean that the position "overflows" the top. Could it be that your SubtitleView is just too small to fit the text? Try changing the bottom padding fraction ( |
Let me try to explain how views actually look:
|
I think I understand your problem. Please try to change the padding or text size as suggested above. |
I tried to manipulate with paddings, fractions and text sizes - there's no difference at all. So, I prepared a small test (based on your demo) to show in practice:
|
Thanks for demo (and sorry for the delay!). I now understand the issue and it seems indeed to be a bug in our code. We'll provide a fix for that soon. |
SubtitleView forwards the cue box position to SubtitlePainter. This should be the position relative to the canvas of the SubtitleView. Currently, however, we forward the position relative to the parent of SubtitleView. That causes problems if SubtitleView has a non-zero offset position to its parent. Issue:#4788 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=215535281
Closing because the issue is fixed by the commit above. |
SubtitleView forwards the cue box position to SubtitlePainter. This should be the position relative to the canvas of the SubtitleView. Currently, however, we forward the position relative to the parent of SubtitleView. That causes problems if SubtitleView has a non-zero offset position to its parent. Issue:#4788 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=215535281
When you have a
SubtitleView
with custom layout measurement (Parent view has match_parent for both dims andSubtitleView
has smaller size and positioned in center)SubtitlePainter
will draw cues somewhere outside ofSubtitleView
's viewport and you'll see nothing.Bug is probably located in
SubtitlePainter
in methodsetupTextLayout()
on the line 346textTop = parentBottom - textHeight - (int) (parentHeight * bottomPaddingFraction);
it's necessary to decrement
parentTop
as well.Should be:
textTop = parentBottom - parentTop - textHeight - (int) (parentHeight * bottomPaddingFraction);
Version 2.8.4
Thanks
The text was updated successfully, but these errors were encountered: