cesium
cesium copied to clipboard
Label Backgrounds do not appear when setting label `show` to `false` and then to `true` in specific cases.
What happened?
I have an app with some labels that have a background. The labels can be hidden and shown again, and they can be updated (e.g., font size changed) while being hidden. When they are shown again, they show the updated value. This basically works.
However, there are some cases where the background is not shown again after the label was hidden.
My local case is quite specific, so I separated it into 2 issues, demonstrated in a Sandcastle each. Since both issues are about the label background not coming back properly, I think the faulty behaviour might be related, so I am only writing this one issue here.
While I have a current workaround as stated below, I am not happy with it due to its performance, and I consider this behaviour of the label backgrounds to be buggy (while well understanding that this is a very specific case that is buggy).
Sandcastle 1:
You can see 3 labels here. The first one is made as an entity, the second one as a primitive whose properties are updated, and the third one is a primitive which is removed and re-added when its properties are updated.
If you click the checkbox, the labels will be hidden, and then their font size is updated. Clicking the checkbox again will make the labels reappear.
What I expected: All 3 labels reappear with their updated font size and their background.
What actually happens: The second label (updated primitive) reappears without its background.
Current workaround: It seems that for my use case, I have to use the label either as an entity or as a primitive that is rebuilt everytime a property changes while it is hidden. Note: When the labels are updated while being shown, their background is restored.
Sandcastle 2:
You can see 2 labels here. One is an entity, and one is a primitive.
When you click anywhere, the labels are hidden for 1 frame. After that frame, they re-appear. To make this more apparent, the framerate is capped to 2fps.
What I expected: Both appear with text and background that one frame after being hidden.
What actually happens: While the primitive label works as expected, the entity label re-appears on the first frame with text only. On the second frame, the background appears, too.
Current workaround: It seems that for my use case, I have to use the label as a primitive. Combined with the issue demonstrated in Sandcastle 1, this means I have to use labels as primitives that are rebuilt everytime something is updated while they are not shown. I think that re-building them might be a performance issue, so I am not that happy about it.
Environment
Browser: Firefox, Chrome CesiumJS Version: 1.120 Operating System: Windows