remove derive_more
This commit is contained in:
parent
a725ded95e
commit
82956b618a
3 changed files with 39 additions and 47 deletions
|
@ -20,7 +20,6 @@ sum_tree = { path = "../sum_tree" }
|
|||
async-task = "4.0.3"
|
||||
backtrace = { version = "0.3", optional = true }
|
||||
ctor = "0.1"
|
||||
derive_more = "0.99.17"
|
||||
dhat = { version = "0.3", optional = true }
|
||||
env_logger = { version = "0.9", optional = true }
|
||||
etagere = "0.2"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use derive_more::Deref;
|
||||
use std::ops::Deref;
|
||||
|
||||
use crate::{geometry::vector::Vector2F, keymap::Keystroke};
|
||||
|
||||
|
@ -22,12 +22,19 @@ pub struct Modifiers {
|
|||
pub fun: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Deref)]
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct ModifiersChangedEvent {
|
||||
#[deref]
|
||||
pub modifiers: Modifiers,
|
||||
}
|
||||
|
||||
impl Deref for ModifiersChangedEvent {
|
||||
type Target = Modifiers;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.modifiers
|
||||
}
|
||||
}
|
||||
|
||||
/// The phase of a touch motion event.
|
||||
/// Based on the winit enum of the same name,
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
@ -37,17 +44,24 @@ pub enum TouchPhase {
|
|||
Ended,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Deref)]
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct ScrollWheelEvent {
|
||||
pub position: Vector2F,
|
||||
pub delta: Vector2F,
|
||||
pub precise: bool,
|
||||
#[deref]
|
||||
pub modifiers: Modifiers,
|
||||
/// If the platform supports returning the phase of a scroll wheel event, it will be stored here
|
||||
pub phase: Option<TouchPhase>,
|
||||
}
|
||||
|
||||
impl Deref for ScrollWheelEvent {
|
||||
type Target = Modifiers;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.modifiers
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Hash, PartialEq, Eq, Copy, Clone, Debug)]
|
||||
pub enum NavigationDirection {
|
||||
Back,
|
||||
|
@ -86,23 +100,37 @@ impl Default for MouseButton {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Deref)]
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct MouseButtonEvent {
|
||||
pub button: MouseButton,
|
||||
pub position: Vector2F,
|
||||
#[deref]
|
||||
pub modifiers: Modifiers,
|
||||
pub click_count: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Deref)]
|
||||
impl Deref for MouseButtonEvent {
|
||||
type Target = Modifiers;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.modifiers
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct MouseMovedEvent {
|
||||
pub position: Vector2F,
|
||||
pub pressed_button: Option<MouseButton>,
|
||||
#[deref]
|
||||
pub modifiers: Modifiers,
|
||||
}
|
||||
|
||||
impl Deref for MouseMovedEvent {
|
||||
type Target = Modifiers;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.modifiers
|
||||
}
|
||||
}
|
||||
|
||||
impl MouseMovedEvent {
|
||||
pub fn to_button_event(&self, button: MouseButton) -> MouseButtonEvent {
|
||||
MouseButtonEvent {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue