ComputedNodeTarget
improvements
#17929
Open
+143
−111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Couple of things need improving with
ComputedNodeTarget
:camera
field should be optional with absent cameras represented byNone
instead ofEntity::PLACEHOLDER
.inverse_scale_factor
field should be removed fromComputedNode
,ComputedNodeTarget
should be the single source of truth for scale factor.ComputedNodeTarget
is updated inPrepare
and thenComputedNode
isn't updated untilLayout
. So it could cause errors if any systems useComputedNode
'sinverse_scale_factor
afterupdate_ui_context_system
inPrepare
but beforeui_layout_system
inLayout
.update_ui_context_system
is misnamed, intiallyComputedNodeTarget
was calledUiContext
and this system should have been renamed to match the new component name.ComputedNode
s should be marked as changed on changes to theirComputedNodeTarget
to make certain everything is recomputed.Solution
ComputedNodeTarget
.ComputedNode
'sinverse_scale_factor
field.camera
field ofComputedNodeTarget
optional.update_ui_context_system
tocompute_node_targets_system
.Add a query for
ComputedNodeTargetto
text_systemand remove the
inverse_scale_factorparameter from
queue_text` function.ComputedNodeTarget
.ui_layout_system
callset_changed
on every descendent'sComputedNode
if a root node'sComputedNodeTarget
is changed.Testing
If you change your desktop's scale factor with any of the UI examples running you can that the layout and text is recomputed correctly in response.
The
multiple_windows
andsplit_screen
demonstrate camera target propagation still works correctly.