mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-27 03:56:50 -06:00
Status bar: clip the language label before the controls on the right
In a narrow window a long language name ("… (not checked)") painted
over the Notes and Comments buttons, and its click area covered them.
The label is now clipped where the controls begin, and only its visible
part opens Review › Language.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8212c1a805
commit
284db01d5e
@@ -22,16 +22,19 @@ pub fn status_bar(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// Left to right: slide counter, language, status message. Each starts at its usual column, or
|
||||
// after the one before it when that runs long ("Slide 100 of 120", "… (not checked)").
|
||||
let sr = p.text(pos2(rect.min.x + 14.0, rect.center().y), Align2::LEFT_CENTER, &left, theme::font(12.0), t.text_dim);
|
||||
// Where the controls on the right begin; nothing on the left paints or clicks past it.
|
||||
let right_x = rect.max.x - 560.0;
|
||||
// The selection's proofing language; a click opens Review › Language.
|
||||
let (lang, no_proof) = crate::dialogs::selected_language(app);
|
||||
let name = crate::squiggles::lang_name(&lang) + if no_proof { " (not checked)" } else { "" };
|
||||
let lx = (rect.min.x + 120.0).max(sr.max.x + 16.0);
|
||||
let lr = p.text(pos2(lx, rect.center().y), Align2::LEFT_CENTER, &name, theme::font(12.0), t.text_dim);
|
||||
if ui.interact(lr.expand(3.0), ui.id().with("status_lang"), Sense::click()).on_hover_text("Language").clicked() {
|
||||
let lclip = Rect::from_min_max(pos2(lx - 3.0, rect.min.y), pos2(right_x.max(lx - 3.0), rect.max.y));
|
||||
let lr = p.with_clip_rect(lclip).text(pos2(lx, rect.center().y), Align2::LEFT_CENTER, &name, theme::font(12.0), t.text_dim);
|
||||
let hit = lr.expand(3.0).intersect(lclip);
|
||||
if hit.is_positive() && ui.interact(hit, ui.id().with("status_lang"), Sense::click()).on_hover_text("Language").clicked() {
|
||||
app.dialog = Some(crate::dialogs::Dialog::new("language"));
|
||||
}
|
||||
// Transient status message, clipped before the controls on the right.
|
||||
let right_x = rect.max.x - 560.0;
|
||||
if let Some(msg) = app.fresh_status() {
|
||||
let mx = (rect.min.x + 290.0).max(lr.max.x + 16.0);
|
||||
let clip = Rect::from_min_max(pos2(mx, rect.min.y), pos2(right_x.max(mx), rect.max.y));
|
||||
|
||||
Reference in New Issue
Block a user