protectwise / troika

A JavaScript framework for interactive 3D and 2D visualizations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Position seems to be changing before text label update

bryaan opened this issue · comments

I am noticing that when creating a label in one render frame and then updating its position and text label in another frame, that the old text label is in the new position before changing to the new label. Can any maintainers see why this is happening?

The proper order should be:

  1. Make label invisible.
  2. Move label and update text.
  3. Make visible.

It seems internally the text is not being made invisible.

Text updates are asynchronous, meaning the change may not be complete until the next frame or later. If you call .sync(callback) and do the move/visible in that callback it should help. See the docs section on async behavior too.

Doing

text.sync(() => {
    text.visible = true
})

does not update the visibility of the text.

Can you provide a test case showing your full issue? It's hard to diagnose with isolated snippets.

Closing for now, reopen if you can provide more info for diagnosing.