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

Improve space view tab design #2879

Merged
merged 4 commits into from
Aug 1, 2023
Merged

Improve space view tab design #2879

merged 4 commits into from
Aug 1, 2023

Conversation

abey79
Copy link
Member

@abey79 abey79 commented Jul 31, 2023

What

This PR improves the space view tab UI:

  • add the space view icon to the tab
  • Change the color of the Space View title bar to Global/Color/Grey/175
  • Change the tab design so that it looks like the design system version (no distinct active tab background)
  • Selected tab's background are now fully blue (as opposed to rounded rect.

The following changes will be subject to a follow-up PR:

  1. better look of the "dragged" widget
  2. (possibly) reuse of ReUi::selectable_label_with_icon() for the implementation (if it makes sense after (1))

Closes #2737

New design:

image

Checklist

@abey79 abey79 added the ui concerns graphical user interface label Jul 31, 2023
@abey79
Copy link
Member Author

abey79 commented Jul 31, 2023

Two open questions TBD @martenbjork

  1. Selection style. Currently:
image
  1. Drag and drop thingy style. Currently:
image

@martenbjork
Copy link
Contributor

martenbjork commented Aug 1, 2023

Slack huddle summary:

  • The selection state will be added to Figma. The tab will be square and reach the edges of its container. The tab's background will be blue.
  • The dragged tab (the thing under the cursor) should match the shape and style of the initial tab, so that it feels like you're dragging the same object.
  • The rectangle that signifies where the view will be created is a bit too blue and bright. Maybe background color rgba(255,255,255,.1) and border rgba(255,255,255,.2) could work?

@abey79 abey79 changed the title (WIP) Add space view icons to tabs Improve space view tab design Aug 1, 2023
@abey79
Copy link
Member Author

abey79 commented Aug 1, 2023

The rectangle that signifies where the view will be created is a bit too blue and bright. Maybe background color rgba(255,255,255,.1) and border rgba(255,255,255,.2) could work?

I'll make a quick, separate PR with that change, so that we can look at the result and possibly iterate.

@abey79 abey79 requested a review from martenbjork August 1, 2023 09:06
@abey79 abey79 marked this pull request as ready for review August 1, 2023 09:07
Copy link
Contributor

@martenbjork martenbjork left a comment

Choose a reason for hiding this comment

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

Looks great! Awesome improvements. Greater consistency with blueprints view + more solid and chunky click areas = :chefs_kiss:

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.

tabs look actually super nice in action (once more so good to have demo.rerun.io!)

plz fix the potential crash, otherwise good!

let space_view = self
.space_views
.get(space_view_id)
.expect("Should have been populated beforehand");
Copy link
Member

Choose a reason for hiding this comment

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

let's not crash here. We need to be super careful in the ui with any unwrap/expect calls and avoid them almost always in any viewer code.

This one for instance might easily happen with some frame delayed data - i.e. the space view got destroyed but the tabs didn't as just itself yet. Imho we should just silently ignore this case and render nothing (putting an error_once feels like the right thing, but then this may just spurious pop up with some users when it's probably not an issue after all)

Copy link
Member Author

Choose a reason for hiding this comment

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

Guilty of copy/paste :) This applies the same to fn pane_ui() a few lines above, right? I'll change both.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK fixed. I cheated in tab_ui() and delegated to the status quo, which debug_once!(). Which btw makes me think that this situation must not occur that often otherwise we'd have seen that debug output.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think debug log is printed by default

let icon = space_view.class(self.ctx.space_view_class_registry).icon();
let image = self.ctx.re_ui.icon_image(icon);
let texture_id = image.texture_id(ui.ctx());
let text_to_icon_padding = 4.0;
Copy link
Member

Choose a reason for hiding this comment

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

didn't we want to make this a constant on re_ui? guess that's a follow-up

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. This can become a constant. It'd be an improvement even against the status quo.

@abey79 abey79 merged commit 08b9e54 into main Aug 1, 2023
@abey79 abey79 deleted the antoine/better-tabs branch August 1, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui concerns graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve design implementation accuracy of viewport views
3 participants