playcanvas / playcanvas/engine

Text Element AABB is not calculated when disabled

Open
#2,141 2 comments 0 reactions 1 assignee View on GitHub

@jpauloruschel is already working on this.

Since Jan 4, 2022.

area: ui
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

Text Element, if initially disabled, does not calculates AABB. Only calculates on first enable.
Although for Model component, mesh instances AABBs are calculated, and updated, regardless of enable state of mesh instance, model component or entity.

This leads to couple of issues, when AABBs are desired by developer before enabling an entity.
Also in Editor, AABBs will be wrong due to that.

Here is a project with issue replication: https://playcanvas.com/project/692477/overview/disabled-text-element-aabb-issue

  1. Select "2D Screen"
  2. Note AABBs gizmo is including Origin (that is where "Text" element AABB is as default, not calculated, because it is disabled).
  3. Hit "F" to Focus
  4. Note focusing is wrong also.

When enabling "Text" entity, issue goes away, but then disabling again and moving, leads to issue of wrong AABB again:

  1. Select "Text" entity
  2. Enable it
  3. Disable it
  4. Move 2D Screen
  5. Note how AABB again is wrong, especially, due to not updated "Text" element AABB.

Solution: calculate AABB for Text Element, same way as it is calculated for Image Element and for other components with AABBs, regardless of being enabled.

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.