pub struct TextAreaLayout {
pub area: Rect,
pub line_height: f32,
pub lines: Arc<[Range<usize>]>,
pub max_scroll: Point,
/* private fields */
}Expand description
The same visual lines drive hit testing, selection, and drawing.
Fields§
§area: Rect§line_height: f32§lines: Arc<[Range<usize>]>§max_scroll: PointImplementations§
Source§impl TextAreaLayout
impl TextAreaLayout
pub fn new( text: &str, area: Rect, line_height: f32, wrap: TextWrap, advance: impl Fn(&str) -> f32, word_break: impl Fn(&str) -> usize, ) -> Self
pub fn shaped( text: &str, area: Rect, line_height: f32, wrap: TextWrap, advance: impl Fn(&str) -> f32, word_break: impl Fn(&str) -> usize, shape: impl Fn(&str) -> VisualTextLine, ) -> Self
pub fn aligned( self, text: &str, alignment: TextAlignment, advance: impl Fn(&str) -> f32, ) -> Self
pub fn line_offset(&self, index: usize) -> f32
pub fn visual_line(&self, index: usize) -> Option<&VisualTextLine>
pub fn with_viewport(self, area: Rect) -> Self
pub fn clamp_scroll(&self, scroll: Point) -> Point
pub fn keep_visible(&self, scroll: Point, caret: Point) -> Point
pub fn visible_lines(&self, scroll: Point) -> Range<usize> ⓘ
pub fn line_index(&self, position: TextPosition) -> usize
pub fn caret_point( &self, text: &str, position: TextPosition, advance: impl Fn(&str) -> f32, ) -> Point
pub fn hit( &self, text: &str, point: Point, scroll: Point, advance: impl Fn(&str) -> f32, ) -> TextPosition
pub fn move_caret( &self, text: &str, editor: &mut TextEdit, motion: TextAreaMotion, selecting: bool, advance: impl Fn(&str) -> f32, )
Trait Implementations§
Auto Trait Implementations§
impl Forget for TextAreaLayout
impl Freeze for TextAreaLayout
impl Move for TextAreaLayout
impl RefUnwindSafe for TextAreaLayout
impl Send for TextAreaLayout
impl Sync for TextAreaLayout
impl Unpin for TextAreaLayout
impl UnsafeUnpin for TextAreaLayout
impl UnwindSafe for TextAreaLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more