feat: ellipsize text (#1132)
This commit is contained in:
parent
1f6086e5ea
commit
b9bd773940
7 changed files with 20 additions and 2 deletions
2
iced
2
iced
|
|
@ -1 +1 @@
|
||||||
Subproject commit ecc29a83982839f628e2ed1c01605c694a1fd3ac
|
Subproject commit d36e4df47f2e277fafcd3505229d53438c7f128d
|
||||||
|
|
@ -682,6 +682,7 @@ where
|
||||||
vertical_alignment: alignment::Vertical::Center,
|
vertical_alignment: alignment::Vertical::Center,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
|
ellipsize: text::Ellipsize::default(),
|
||||||
},
|
},
|
||||||
bounds.position(),
|
bounds.position(),
|
||||||
color,
|
color,
|
||||||
|
|
|
||||||
|
|
@ -594,6 +594,7 @@ where
|
||||||
vertical_alignment: alignment::Vertical::Center,
|
vertical_alignment: alignment::Vertical::Center,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
|
ellipsize: text::Ellipsize::default(),
|
||||||
},
|
},
|
||||||
bounds.position(),
|
bounds.position(),
|
||||||
color,
|
color,
|
||||||
|
|
@ -643,6 +644,7 @@ where
|
||||||
vertical_alignment: alignment::Vertical::Center,
|
vertical_alignment: alignment::Vertical::Center,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
|
ellipsize: text::Ellipsize::default(),
|
||||||
},
|
},
|
||||||
bounds.position(),
|
bounds.position(),
|
||||||
appearance.description_color,
|
appearance.description_color,
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,7 @@ pub fn layout(
|
||||||
vertical_alignment: alignment::Vertical::Top,
|
vertical_alignment: alignment::Vertical::Top,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
|
ellipsize: text::Ellipsize::default(),
|
||||||
});
|
});
|
||||||
paragraph.min_width().round()
|
paragraph.min_width().round()
|
||||||
};
|
};
|
||||||
|
|
@ -423,6 +424,7 @@ pub fn overlay<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static
|
||||||
vertical_alignment: alignment::Vertical::Top,
|
vertical_alignment: alignment::Vertical::Top,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
|
ellipsize: text::Ellipsize::default(),
|
||||||
});
|
});
|
||||||
paragraph.min_width().round()
|
paragraph.min_width().round()
|
||||||
};
|
};
|
||||||
|
|
@ -555,6 +557,7 @@ pub fn draw<'a, S, Item: Clone + PartialEq + 'static>(
|
||||||
vertical_alignment: alignment::Vertical::Center,
|
vertical_alignment: alignment::Vertical::Center,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
|
ellipsize: text::Ellipsize::default(),
|
||||||
},
|
},
|
||||||
bounds.position(),
|
bounds.position(),
|
||||||
style.text_color,
|
style.text_color,
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,7 @@ where
|
||||||
vertical_alignment: alignment::Vertical::Top,
|
vertical_alignment: alignment::Vertical::Top,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
|
ellipsize: text::Ellipsize::default(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -478,6 +479,7 @@ pub fn layout(
|
||||||
vertical_alignment: alignment::Vertical::Top,
|
vertical_alignment: alignment::Vertical::Top,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
|
ellipsize: text::Ellipsize::default(),
|
||||||
};
|
};
|
||||||
let paragraph = match paragraph {
|
let paragraph = match paragraph {
|
||||||
Some(p) => {
|
Some(p) => {
|
||||||
|
|
@ -934,6 +936,7 @@ pub fn draw<'a, S>(
|
||||||
vertical_alignment: alignment::Vertical::Center,
|
vertical_alignment: alignment::Vertical::Center,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
|
ellipsize: text::Ellipsize::default(),
|
||||||
},
|
},
|
||||||
bounds.position(),
|
bounds.position(),
|
||||||
style.text_color,
|
style.text_color,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ use iced::{
|
||||||
event, keyboard, mouse, touch, window,
|
event, keyboard, mouse, touch, window,
|
||||||
};
|
};
|
||||||
use iced_core::mouse::ScrollDelta;
|
use iced_core::mouse::ScrollDelta;
|
||||||
use iced_core::text::{LineHeight, Renderer as TextRenderer, Shaping, Wrapping};
|
use iced_core::text::{Ellipsize, LineHeight, Renderer as TextRenderer, Shaping, Wrapping};
|
||||||
use iced_core::widget::operation::Focusable;
|
use iced_core::widget::operation::Focusable;
|
||||||
use iced_core::widget::{self, operation, tree};
|
use iced_core::widget::{self, operation, tree};
|
||||||
use iced_core::{Border, Point, Renderer as IcedRenderer, Shadow, Text};
|
use iced_core::{Border, Point, Renderer as IcedRenderer, Shadow, Text};
|
||||||
|
|
@ -274,6 +274,7 @@ where
|
||||||
vertical_alignment: alignment::Vertical::Center,
|
vertical_alignment: alignment::Vertical::Center,
|
||||||
shaping: Shaping::Advanced,
|
shaping: Shaping::Advanced,
|
||||||
wrapping: Wrapping::None,
|
wrapping: Wrapping::None,
|
||||||
|
ellipsize: Ellipsize::None,
|
||||||
line_height: self.line_height,
|
line_height: self.line_height,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -602,6 +603,7 @@ where
|
||||||
vertical_alignment: alignment::Vertical::Center,
|
vertical_alignment: alignment::Vertical::Center,
|
||||||
shaping: Shaping::Advanced,
|
shaping: Shaping::Advanced,
|
||||||
wrapping: Wrapping::default(),
|
wrapping: Wrapping::default(),
|
||||||
|
ellipsize: Ellipsize::default(),
|
||||||
line_height: self.line_height,
|
line_height: self.line_height,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -728,6 +728,7 @@ where
|
||||||
line_height: text::LineHeight::default(),
|
line_height: text::LineHeight::default(),
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::None,
|
wrapping: text::Wrapping::None,
|
||||||
|
ellipsize: text::Ellipsize::None,
|
||||||
});
|
});
|
||||||
|
|
||||||
let Size { width, height } =
|
let Size { width, height } =
|
||||||
|
|
@ -1160,6 +1161,7 @@ pub fn layout<Message>(
|
||||||
line_height,
|
line_height,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::None,
|
wrapping: text::Wrapping::None,
|
||||||
|
ellipsize: text::Ellipsize::None,
|
||||||
});
|
});
|
||||||
let label_size = label_paragraph.min_bounds();
|
let label_size = label_paragraph.min_bounds();
|
||||||
|
|
||||||
|
|
@ -1297,6 +1299,7 @@ pub fn layout<Message>(
|
||||||
line_height: helper_text_line_height,
|
line_height: helper_text_line_height,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::None,
|
wrapping: text::Wrapping::None,
|
||||||
|
ellipsize: text::Ellipsize::None,
|
||||||
});
|
});
|
||||||
let helper_text_size = helper_text_paragraph.min_bounds();
|
let helper_text_size = helper_text_paragraph.min_bounds();
|
||||||
let helper_text_node = layout::Node::new(helper_text_size).translate(helper_pos);
|
let helper_text_node = layout::Node::new(helper_text_size).translate(helper_pos);
|
||||||
|
|
@ -2260,6 +2263,7 @@ pub fn draw<'a, Message>(
|
||||||
line_height,
|
line_height,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::None,
|
wrapping: text::Wrapping::None,
|
||||||
|
ellipsize: text::Ellipsize::None,
|
||||||
},
|
},
|
||||||
label_layout.bounds().position(),
|
label_layout.bounds().position(),
|
||||||
appearance.label_color,
|
appearance.label_color,
|
||||||
|
|
@ -2449,6 +2453,7 @@ pub fn draw<'a, Message>(
|
||||||
line_height: text::LineHeight::default(),
|
line_height: text::LineHeight::default(),
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::None,
|
wrapping: text::Wrapping::None,
|
||||||
|
ellipsize: text::Ellipsize::None,
|
||||||
},
|
},
|
||||||
bounds.position(),
|
bounds.position(),
|
||||||
color,
|
color,
|
||||||
|
|
@ -2497,6 +2502,7 @@ pub fn draw<'a, Message>(
|
||||||
line_height: helper_line_height,
|
line_height: helper_line_height,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::None,
|
wrapping: text::Wrapping::None,
|
||||||
|
ellipsize: text::Ellipsize::None,
|
||||||
},
|
},
|
||||||
helper_text_layout.bounds().position(),
|
helper_text_layout.bounds().position(),
|
||||||
text_color,
|
text_color,
|
||||||
|
|
@ -2877,6 +2883,7 @@ fn replace_paragraph(
|
||||||
vertical_alignment: alignment::Vertical::Top,
|
vertical_alignment: alignment::Vertical::Top,
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::None,
|
wrapping: text::Wrapping::None,
|
||||||
|
ellipsize: text::Ellipsize::None,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue