pub struct PaneHitMap { /* private fields */ }Expand description
Every pane body painted this frame.
Small (one entry per visible pane, so single digits) and walked linearly — a click is a human gesture, and an index would cost more to maintain than it saves.
Implementations§
Source§impl PaneHitMap
impl PaneHitMap
pub fn new() -> Self
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Drop every recorded zone. Called at the top of each frame; a stale map would route clicks against a layout no longer painted.
Sourcepub fn set_rows(&mut self, pane_id: PaneId, rows: Vec<Option<RowOrigin>>)
pub fn set_rows(&mut self, pane_id: PaneId, rows: Vec<Option<RowOrigin>>)
Record what the compose loop painted into pane, row by row.
Called from the composer rather than from the layout pass, which
is why it is a separate call from Self::push: the zone’s rect
is known before the pane’s contents are composed, and its rows
only after.
Sourcepub fn origin_at(&self, pane_id: PaneId, row_offset: u16) -> Option<RowOrigin>
pub fn origin_at(&self, pane_id: PaneId, row_offset: u16) -> Option<RowOrigin>
The buffer origin of row_offset within pane, if it has one.
A row past the end of the buffer, or a virtual row, falls back to the last row above it that does have an origin. Clicking the blank space below a short buffer puts the cursor on its last line, which is what every editor does and what a terminal makes the common case — it reports a cell for every row on screen, not only the ones with text under them.
pub fn push(&mut self, zone: PaneHitZone)
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn hit(&self, col: u16, row: u16) -> Option<PaneHitZone>
pub fn hit(&self, col: u16, row: u16) -> Option<PaneHitZone>
The pane under (col, row), if any.
Last match wins, so a pane painted over another — a popup body above a document — takes the click. Panes are pushed in paint order, which makes later-painted mean on-top without the map needing a z-index.
Sourcepub fn resolve(&self, col: u16, row: u16) -> Option<BodyHit>
pub fn resolve(&self, col: u16, row: u16) -> Option<BodyHit>
Resolve a screen cell to a position inside a pane’s body.
None when the cell is outside every pane. A cell on the gutter
resolves to its pane with text_col: None — the pane is still
the right scroll target for a wheel event there, and a click on a
line number is a real gesture with its own meaning (fold toggle,
eventually) rather than a miss.
Trait Implementations§
Source§impl Clone for PaneHitMap
impl Clone for PaneHitMap
Source§fn clone(&self) -> PaneHitMap
fn clone(&self) -> PaneHitMap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PaneHitMap
impl Debug for PaneHitMap
Source§impl Default for PaneHitMap
impl Default for PaneHitMap
Source§fn default() -> PaneHitMap
fn default() -> PaneHitMap
Auto Trait Implementations§
impl Freeze for PaneHitMap
impl RefUnwindSafe for PaneHitMap
impl Send for PaneHitMap
impl Sync for PaneHitMap
impl Unpin for PaneHitMap
impl UnsafeUnpin for PaneHitMap
impl UnwindSafe for PaneHitMap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more