Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show preview of Image/DepthImage/SegmentationImage when selected #7147

Merged
merged 6 commits into from
Aug 12, 2024

Conversation

emilk
Copy link
Member

@emilk emilk commented Aug 12, 2024

What

When you select an entity that contains an Image, DepthImage or SegmentationImage, a preview of it will be show.

Coming later: button to copy and save/download the image.

Toolip

image

Selection panel

image

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!
  • If have noted any breaking changes to the log API in CHANGELOG.md and the migration guide

To run all checks from main, comment on the PR with @rerun-bot full-check.

@emilk emilk added ui concerns graphical user interface exclude from changelog PRs with this won't show up in CHANGELOG.md labels Aug 12, 2024
@Wumpf Wumpf self-requested a review August 12, 2024 12:39
@Wumpf
Copy link
Member

Wumpf commented Aug 12, 2024

Small images need nearest neighbor filtering (well, in generally that's probably what we should do for MAG here :))
image
Also there's a strange line in there

Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty! Debatable whether the property view preview is too large, but I like it (:

totally makes sense that these previews don't capture overrides given where they are shown, but this is probably something we'll have to address in the future 🤔

Comment on lines +29 to +33
Ok(response) => response.on_hover_ui(|ui| {
// Show larger image on hover.
let hover_size = Vec2::splat(400.0);
show_image_preview(render_ctx, ui, texture, &debug_name, hover_size).ok();
}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where would this path be active? Wasn't able to get there in the ui.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we ever show an Entity in a list-view right now, but we do show ImageEncoded in a list view:

Screenshot 2024-08-12 at 16 22 45

indicator_count == components.len()
if instance.is_all() {
let component_map = components.into_iter().collect();
preview_if_image_ui(ctx, ui, ui_layout, query, entity_path, &component_map);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish there was a more scalable way for "pan entity ui" already. But this simple special handling will probably go a long way 🤷

@@ -59,106 +70,222 @@ impl DataUi for InstancePath {
if indicator_count > 1 { "s" } else { "" }
),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the return; got removed here we're still evaluating the image preview if this is a single line. I don't know what this could break in the ui (haven't spotted anything) but this might be wrong? (could be that something down the line opts out, but I'm not seeing it in this diff at least)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is that if we put an Entity in a list view, we should see a small preview image, like we currently do for ImageEncoded blobs:

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer this way of writing it to early returns anyway

});
}

/// If this entity is an image, show it together with buttons to download and copy the image.
Copy link
Member

@Wumpf Wumpf Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those download buttons aren't there yet

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give me a couple of hours :)

@emilk emilk merged commit b1ce9b5 into main Aug 12, 2024
34 of 35 checks passed
@emilk emilk deleted the emilk/image-ui branch August 12, 2024 14:27
@emilk emilk restored the emilk/image-ui branch August 12, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog PRs with this won't show up in CHANGELOG.md ui concerns graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tiny image preview is maybe too tiny
2 participants