Store generic mouse regions on window that contain their event type id

This commit is contained in:
Nathan Sobo 2023-08-17 08:37:55 -06:00
parent 812d3f6af6
commit b95b2af3e0
8 changed files with 130 additions and 57 deletions

View file

@ -1,4 +1,4 @@
use crate::element::{Element, ElementMetadata, IntoElement};
use crate::element::{Element, ElementMetadata, EventHandler, IntoElement};
use gpui::{geometry::Size, text_layout::LineLayout, RenderContext};
use parking_lot::Mutex;
use std::sync::Arc;
@ -26,10 +26,6 @@ impl<V: 'static> Element<V> for Text<V> {
&mut self.metadata.style
}
fn handlers_mut(&mut self) -> &mut crate::element::ElementHandlers<V> {
&mut self.metadata.handlers
}
fn layout(
&mut self,
view: &mut V,
@ -95,6 +91,10 @@ impl<V: 'static> Element<V> for Text<V> {
);
Ok(())
}
fn handlers_mut(&mut self) -> &mut Vec<EventHandler<V>> {
&mut self.metadata.handlers
}
}
pub struct TextLayout {