Skip to content

Conversation

althea28
Copy link
Contributor

@althea28 althea28 commented Aug 20, 2025

This PR aims to add billboards to Locations to display the Location Tags present at that location.
image

When there are no Location Tags present, or the Location only contains Workcell tags, an empty icon will appear instead.
image

Functionality:

  • Billboards will always rotate to face the camera.
  • Billboards show a tooltip of the name of the location tag when the cursor hovers over it.
  • The anchor and location can be dragged by clicking and dragging the corresponding billboards.
  • Selecting a billboard shows the corresponding Location in the Inspector.

Changed implementation of the canvas tooltip:
The existing canvas tooltip implementation causes some of the text to be pushed into the next line.
image

Hence, part of the canvas tooltips implementation has been modified from this:

        let text = self.tips.join("\n");

        egui::Area::new("canvas_tooltip_area".into()).show(ctx, |ui| {
            egui::containers::popup::show_tooltip_text(
                ctx,
                ui.layer_id(),
                "cursor_tooltip".into(),
                text,
            );
        });

To this:

        let pointer_pos = ctx.input(|i| i.pointer.hover_pos());

        if let Some(pos) = pointer_pos {
            egui::Area::new("canvas_tooltip_area".into())
                .fixed_pos(pos + egui::vec2(16.0, 16.0))
                .show(ctx, |ui| {
                    egui::containers::Frame::popup(ui.style()).show(ui, |ui| {
                        ui.set_max_width(300.0);
                        for tip in &self.tips {
                            ui.label(tip.as_ref());
                        }
                    });
                });
        }

From what I have attempted, setting the max_width directly in the egui::containers::popup or egui::Area did not seem to be able to resolve this problem, hence I rewrote the implementation. However, if there is a better way to resolve this, please let me know! From what I can tell, there are no other usages of this Canvas Tooltips, hence as far as I can tell, this new implementation does not appear to affect anything else.

Known bug:
When the billboard is selected, the inspector temporarily shows <Unknown Type> (unsaved).

Steps to recreate the initial bug:

  1. Select a billboard.
  2. In the Inspector, delete the corresponding billboard tag. (e.g. if the Parking billboard was selected, delete the Parking tag).
  3. The inspector shows <Unknown Type> (unsaved) as the selected billboard was despawned.
Screen.recording.2025-08-20.4.33.40.PM.mp4

The above bug was temporarily resolved by changing the selected object to the corresponding Location under update_location_for_changed_location_tags.

    for (e, tags, mut billboard_meshes, mut hovered, mut selected) in &mut locations {
        select.write(Select::new(Some(e)));
        …

However, there is still a lag when the selected object is changed from the Billboard to the Location. For 1 frame, the <Unknown Type> (unsaved) appears again, before the Inspector displays the Location Inspector again. If there is a way to resolve this, please let me know!

Screen.recording.2025-08-20.4.38.40.PM.mp4

Signed-off-by: Althea <[email protected]>
@mxgrey
Copy link
Collaborator

mxgrey commented Aug 21, 2025

However, there is still a lag when the selected object is changed from the Billboard to the Location. For 1 frame, the (unsaved) appears again, before the Inspector displays the Location Inspector again.

I've pushed a fix for this: e276513! We just needed to explicitly set some system ordering.

@mxgrey mxgrey moved this from Inbox to In Review in PMC Board Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

2 participants