This commit is contained in:
Nathan Sobo
2023-04-11 21:56:37 -06:00
parent e6cc132b19
commit d9e4136b02
14 changed files with 235 additions and 150 deletions
+7 -1
View File
@@ -11,7 +11,7 @@ use collections::HashMap;
use pathfinder_geometry::rect::RectF;
use smallvec::SmallVec;
use crate::{platform::MouseButton, window::WindowContext, View, ViewContext};
use crate::{platform::MouseButton, window::WindowContext, ReadView, View, ViewContext};
use super::{
mouse_event::{
@@ -234,6 +234,12 @@ impl<V: View> DerefMut for EventContext<'_, '_, '_, '_, V> {
}
}
impl<V: View> ReadView for EventContext<'_, '_, '_, '_, V> {
fn read_view<W: View>(&self, handle: &crate::ViewHandle<W>) -> &W {
self.view_context.read_view(handle)
}
}
pub type HandlerCallback = Rc<dyn Fn(MouseEvent, &mut dyn Any, &mut WindowContext, usize) -> bool>;
#[derive(Clone, PartialEq, Eq, Hash)]