pub struct RegionSelection {
pub area: WidgetId,
pub anchor: RegionPoint,
pub extent: RegionPoint,
pub ranges: HashMap<WidgetId, (usize, usize)>,
pub all: bool,
pub bar: bool,
pub handles: bool,
pub start: Option<RegionPoint>,
pub end: Option<RegionPoint>,
}Expand description
The selection an area holds: where the press landed, where the pointer is now, and what that makes selected in each text.
Fields§
§area: WidgetIdThe area the selection belongs to: a drag never carries it into another.
anchor: RegionPointWhere the press landed.
extent: RegionPointWhere the pointer is now.
ranges: HashMap<WidgetId, (usize, usize)>The (start, end) character range selected in each text that has one.
all: boolWhether every text of the area is selected whole — Select all would do nothing.
bar: boolWhether the bar (Copy, Select all) shows over the selection: one made with a finger does, one made with a mouse does not. Put away while a handle is dragged.
handles: boolWhether the selection carries handles at its two ends, for a finger to widen or narrow it: one made with a finger does.
start: Option<RegionPoint>Where the selection begins, in reading order — whichever of anchor and extent comes
first — as the first character selected. None when nothing is.
end: Option<RegionPoint>Where it ends, in reading order, as the boundary after the last character selected.
Implementations§
Source§impl RegionSelection
impl RegionSelection
Sourcepub fn new(
area: WidgetId,
anchor: RegionPoint,
extent: RegionPoint,
stops: &[(WidgetId, usize)],
) -> Self
pub fn new( area: WidgetId, anchor: RegionPoint, extent: RegionPoint, stops: &[(WidgetId, usize)], ) -> Self
The selection from anchor to extent over stops, the area’s texts in order, each
with its length in characters.