Skip to content

Commit ddc11d4

Browse files
committed
docs: add docs for text selection
Still really minimal, but text selection is not obvious, so this is a lot better than nothing.
1 parent 1764cef commit ddc11d4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

common/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ pub use geometry::{Affine, Point, Rect, Size, Vec2};
5555
pub enum Role {
5656
#[default]
5757
Unknown,
58+
59+
/// Should be used for selectable Text. For each line of text one `TextRun` should be used.
60+
/// Each one of them should be added as a child to a `Label`, `TextInput`, `MultiLineTextInput`
61+
/// or similar [`Node`]. The selection can be specified with [`Node::set_text_selection`].
5862
TextRun,
5963
Cell,
6064
Label,
@@ -1989,6 +1993,9 @@ property_methods! {
19891993
/// [`transform`]: Node::transform
19901994
(Bounds, bounds, get_rect_property, Option<Rect>, set_bounds, set_rect_property, Rect, clear_bounds),
19911995

1996+
/// Text selection should be added to the parent [`Node`] of the `TextRun` nodes.
1997+
/// In [`TextSelection`] the line of selected text is specified by setting the [`NodeId`]
1998+
/// to the `TextRun` that holds the selected line.
19921999
(TextSelection, text_selection, get_text_selection_property, Option<&TextSelection>, set_text_selection, set_text_selection_property, impl Into<Box<TextSelection>>, clear_text_selection)
19932000
}
19942001

0 commit comments

Comments
 (0)