fix: use neutral dark/light popover styling for hover tooltips
This commit is contained in:
parent
84d9c6756c
commit
bd16a9c703
1 changed files with 11 additions and 9 deletions
|
|
@ -117,7 +117,8 @@ impl UiContext {
|
||||||
if let Some((anchor, label)) = self.pending_tooltip.take() {
|
if let Some((anchor, label)) = self.pending_tooltip.take() {
|
||||||
let prev = self.set_layer(ZLayer::Titlebar);
|
let prev = self.set_layer(ZLayer::Titlebar);
|
||||||
let pad_x = 10.0;
|
let pad_x = 10.0;
|
||||||
let text_sz = self.measure_text(&label, TextStyle::medium(12.0, Color::WHITE), None);
|
let text_style = TextStyle::medium(12.0, pal.text_primary);
|
||||||
|
let text_sz = self.measure_text(&label, text_style, None);
|
||||||
let tip_w = text_sz.x + pad_x * 2.0;
|
let tip_w = text_sz.x + pad_x * 2.0;
|
||||||
let tip_h = 26.0;
|
let tip_h = 26.0;
|
||||||
let screen = self.input.screen_size;
|
let screen = self.input.screen_size;
|
||||||
|
|
@ -132,15 +133,16 @@ impl UiContext {
|
||||||
tx = tx.round();
|
tx = tx.round();
|
||||||
ty = ty.round();
|
ty = ty.round();
|
||||||
let tip_r = Rect::from_xywh(tx, ty, tip_w, tip_h);
|
let tip_r = Rect::from_xywh(tx, ty, tip_w, tip_h);
|
||||||
|
let tip_bg = if pal.is_dark {
|
||||||
|
Color::rgb(0x26, 0x26, 0x26)
|
||||||
|
} else {
|
||||||
|
Color::WHITE
|
||||||
|
};
|
||||||
self.dl()
|
self.dl()
|
||||||
.push_shadow(tip_r, 8.0, 10.0, 0.0, Vec2::new(0.0, 2.0), css_rgba(0, 0, 0, 110));
|
.push_shadow(tip_r, 8.0, 10.0, 0.0, Vec2::new(0.0, 2.0), pal.shadow_menu);
|
||||||
self.dl().push_rect(tip_r, 8.0, pal.bg_tooltip);
|
self.dl()
|
||||||
self.draw_text_ellipsis(
|
.push_rect_bordered(tip_r, 8.0, tip_bg, 1.0, pal.border_control);
|
||||||
&label,
|
self.draw_text_ellipsis(&label, text_style, tip_r, TextAlign::Center);
|
||||||
TextStyle::medium(12.0, Color::WHITE),
|
|
||||||
tip_r,
|
|
||||||
TextAlign::Center,
|
|
||||||
);
|
|
||||||
self.set_layer(prev);
|
self.set_layer(prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue