forked from 1b-agent/opencadstudio-upstream
feat(ui): elide overflowing text, tooltip full layer name
iced has no built-in ellipsis, so long user content (file names, layer names, paths, property values) wrapped or spilled past fixed-width panels. Add an `elide` helper (char-budget truncation with a trailing ellipsis) and apply it to the layer manager, properties panel, document tabs, recent-files list and the save dialog. In the layer manager a truncated name reveals its full text in a cursor-following tooltip on hover, so the column need not be widened. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
b3aadf569e
commit
ff10f8a89a
5 files changed
+111
-32
No files matched your search
@@ -181,7 +181,7 @@ impl PropertiesPanel {
|
||||
|
||||
// ── Title bar (entity type / "No Selection") ─────────────────────
|
||||
let title_content: Element<'_, Message> = if self.selection_groups.is_empty() {
|
||||
text(&self.title).size(FONT_SZ).color(SECTION_LABEL).into()
|
||||
text(crate::ui::text_util::elide(&self.title, 34)).size(FONT_SZ).color(SECTION_LABEL).into()
|
||||
} else {
|
||||
combo_box(
|
||||
&self.selection_group_combo,
|
||||
@@ -248,7 +248,7 @@ impl PropertiesPanel {
|
||||
if self.sections.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let title = container(text(&self.title).size(FONT_SZ).color(SECTION_LABEL))
|
||||
let title = container(text(crate::ui::text_util::elide(&self.title, 34)).size(FONT_SZ).color(SECTION_LABEL))
|
||||
.style(|_: &Theme| container::Style {
|
||||
background: Some(Background::Color(SECTION_BG)),
|
||||
border: Border {
|
||||
@@ -847,7 +847,8 @@ fn render_bool_row<'a>(label: &'a str, field: &'static str, value: bool) -> Elem
|
||||
}
|
||||
|
||||
fn render_ro_row<'a>(label: &'a str, value: &'a str) -> Element<'a, Message> {
|
||||
let label_col = container(text(label).size(FONT_SZ).color(LABEL_COLOR))
|
||||
let value = crate::ui::text_util::elide(value, 22);
|
||||
let label_col = container(text(crate::ui::text_util::elide(label, 18)).size(FONT_SZ).color(LABEL_COLOR))
|
||||
.style(|_: &Theme| container::Style {
|
||||
background: Some(Background::Color(LABEL_BG)),
|
||||
..Default::default()
|
||||
@@ -890,7 +891,7 @@ fn render_ro_row<'a>(label: &'a str, value: &'a str) -> Element<'a, Message> {
|
||||
|
||||
/// Build a label | widget property row.
|
||||
fn prop_row_widget<'a>(label: &'a str, widget: Element<'a, Message>) -> Element<'a, Message> {
|
||||
let label_col = container(text(label).size(FONT_SZ).color(LABEL_COLOR))
|
||||
let label_col = container(text(crate::ui::text_util::elide(label, 18)).size(FONT_SZ).color(LABEL_COLOR))
|
||||
.style(|_: &Theme| container::Style {
|
||||
background: Some(Background::Color(LABEL_BG)),
|
||||
..Default::default()
|
||||
|
||||
Reference in new issue
Block a user