-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Style tweaks #450
Merged
Merged
Style tweaks #450
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emilk
force-pushed
the
style-tweaks
branch
2 times, most recently
from
June 3, 2021 17:29
8e6faa9
to
9c151fc
Compare
I think this branch looks even more amazing with this scroll bar tweak. 😉 diff --git a/egui/src/containers/scroll_area.rs b/egui/src/containers/scroll_area.rs
index a54c402..ba41233 100644
--- a/egui/src/containers/scroll_area.rs
+++ b/egui/src/containers/scroll_area.rs
@@ -259,7 +259,6 @@ impl Prepared {
let margin = animation_t * ui.spacing().item_spacing.x;
let left = inner_rect.right() + margin;
let right = outer_rect.right();
- let corner_radius = (right - left) / 2.0;
let top = inner_rect.top();
let bottom = inner_rect.bottom();
@@ -312,7 +311,7 @@ impl Prepared {
pos2(left, from_content(state.offset.y)),
pos2(right, from_content(state.offset.y + inner_rect.height())),
);
- let min_handle_height = (2.0 * corner_radius).max(8.0);
+ let min_handle_height = max_scroll_bar_width;
if handle_rect.size().y < min_handle_height {
handle_rect = Rect::from_center_size(
handle_rect.center(),
@@ -324,18 +323,16 @@ impl Prepared {
ui.painter().add(epaint::Shape::Rect {
rect: outer_scroll_rect,
- corner_radius,
+ corner_radius: visuals.corner_radius,
fill: ui.visuals().extreme_bg_color,
stroke: Default::default(),
- // fill: visuals.bg_fill,
- // stroke: visuals.bg_stroke,
});
ui.painter().add(epaint::Shape::Rect {
- rect: handle_rect.expand(-2.0),
- corner_radius,
+ rect: handle_rect,
+ corner_radius: visuals.corner_radius,
fill: visuals.bg_fill,
- stroke: visuals.bg_stroke,
+ stroke: Default::default(),
});
}
@@ -358,5 +355,5 @@ impl Prepared {
}
fn max_scroll_bar_width_with_margin(ui: &Ui) -> f32 {
- ui.spacing().item_spacing.x + 16.0
+ ui.spacing().item_spacing.x + 8.0
} |
emilk
force-pushed
the
style-tweaks
branch
3 times, most recently
from
June 7, 2021 19:05
40d5ec0
to
24fa6d8
Compare
More compact, less round, less noisy * Button text is now same size as body text * The rounder corners are now less rounded * Collapsing headers no longer have a frame around them * Combo-boxes looks better when opened * Slightly more muted colors * Remove extra line spacing after `\n` (i.e. between paragraphs)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've tweaked the visual style of egui a bit, making it more compact and less noisy.
\n
(i.e. between paragraphs)Before:
After: