Your Digital Media Has Never Looked So Good

Topic Author
Posts: 2
Joined: Thu Nov 01, 2018 2:38 pm

Issues With Scaling Label Nodes And Solutions

Thu Nov 01, 2018 2:57 pm

I recently created a custom component that extends from Rectangle. It had a single child that was a Label node with horiz and vert align fields set to center the text. I created another component that extended from this base component. In this new component, the rectangle would be scaled when a field was set. This should have also scaled the Label without issue. However, this is Roku we're talking about here. When I ran this on my Roku Ultra (4640X), it worked as intended. When I ran it on my Roku Express (3700X), the Label would no longer be centered after scaling. I found that explicitly setting the width and height of the label node to that of the boundingRect of the Rectangle, it fixed this issue on the Express. However, it introduced the same bug when I ran this change on my Ultra. After many hours of debugging, I found there is no ideal solution to this problem that works on both devices. I decided to make the base component extend from Group and separate the Rectangle and Label nodes. Then, I scaled the Rectangle without issue. For the Label node, I adjusted the size of the font. I attempted to scale the Label node as well but there seems to be some issue internally with the Express that prevents it from scaling Label nodes properly. Just wanted to share this in case someone else has run into similar issues. Feel free to comment if you have a better solution.

Who is online

Users browsing this forum: No registered users and 6 guests