Coordinate alignment issues when sibling elements are invalidated

12 views
Skip to first unread message

Guillermo Rodriguez Garcia

unread,
Nov 24, 2020, 7:58:48 AM11/24/20
to PlayN
Hi all,

I am seeing an issue in tripleplay in the following situation.

1. A parent has multiple children whose logical boundaries do not align with physical pixel boundaries (for example, they could be located at non-integer coordinates). Let's assume there are two such children, A and B.

2. Child element A is invalidated (for example because it was an interactive element that was clicked). This invalidates A and all its parents, but NOT the sibling elements (i.e. not B).

3. When the hierarchy is revalidated, validate() will be called for both A and B, but this is a no-op for B (because B is still valid). In particular this means that the code that aligns logical boundaries to physical pixel boundaries will not run for B: https://github.com/threerings/tripleplay/blob/45701dd68d4ff79159f802b684928d16811e4fbf/core/src/main/java/tripleplay/ui/Element.java#L420

4. However because the parent was also invalidated, the parent's layout() method may have updated the layer boundaries for B. Thus B is now being rendered at non-aligned coordinates.

The symptoms for this is that clicking on an interactive element in a scene seems to "blur" other elements in the same scene.

I am working on a fix for this.

BR,

Guillermo
Message has been deleted

Guillermo Rodriguez Garcia

unread,
Nov 24, 2020, 8:16:19 AM11/24/20
to PlayN
(I am reposting this because Google Groups removed the images from my original post)

Here's the problem in action.

Initial rendering of the scene:

Captura de pantalla 2020-11-24 a las 14.14.03.png

This is after clicking on Button 1 (see how Button 2 is now blurry):

Captura de pantalla 2020-11-24 a las 14.15.03.png

Guillermo

Guillermo Rodriguez Garcia

unread,
Nov 24, 2020, 9:56:46 AM11/24/20
to PlayN
I have created a PR that fixes this (https://github.com/threerings/tripleplay/pull/89).

The PR simply makes sure that element boundaries are aligned to physical pixels every time validate() is called, even if the element itself was not invalidated.

I have also added a test case.

Guillermo
Reply all
Reply to author
Forward
0 new messages