Move reusable mouse types to iced_core
This commit is contained in:
parent
20d79a43cc
commit
56dbd68326
10 changed files with 23 additions and 12 deletions
|
|
@ -15,9 +15,11 @@
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
#![forbid(rust_2018_idioms)]
|
#![forbid(rust_2018_idioms)]
|
||||||
pub mod keyboard;
|
pub mod keyboard;
|
||||||
|
pub mod mouse;
|
||||||
|
|
||||||
mod align;
|
mod align;
|
||||||
mod background;
|
mod background;
|
||||||
|
mod button_state;
|
||||||
mod color;
|
mod color;
|
||||||
mod font;
|
mod font;
|
||||||
mod length;
|
mod length;
|
||||||
|
|
@ -28,6 +30,7 @@ mod vector;
|
||||||
|
|
||||||
pub use align::{Align, HorizontalAlignment, VerticalAlignment};
|
pub use align::{Align, HorizontalAlignment, VerticalAlignment};
|
||||||
pub use background::Background;
|
pub use background::Background;
|
||||||
|
pub use button_state::ButtonState;
|
||||||
pub use color::Color;
|
pub use color::Color;
|
||||||
pub use font::Font;
|
pub use font::Font;
|
||||||
pub use length::Length;
|
pub use length::Length;
|
||||||
|
|
|
||||||
6
core/src/mouse.rs
Normal file
6
core/src/mouse.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
//! Reuse basic mouse types.
|
||||||
|
mod button;
|
||||||
|
mod event;
|
||||||
|
|
||||||
|
pub use button::Button;
|
||||||
|
pub use event::{Event, ScrollDelta};
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use super::Button;
|
use super::Button;
|
||||||
use crate::input::ButtonState;
|
use crate::ButtonState;
|
||||||
|
|
||||||
/// A mouse event.
|
/// A mouse event.
|
||||||
///
|
///
|
||||||
|
|
@ -26,11 +26,11 @@ pub enum Event {
|
||||||
|
|
||||||
/// A mouse button was pressed or released.
|
/// A mouse button was pressed or released.
|
||||||
Input {
|
Input {
|
||||||
/// The state of the button
|
|
||||||
state: ButtonState,
|
|
||||||
|
|
||||||
/// The button identifier
|
/// The button identifier
|
||||||
button: Button,
|
button: Button,
|
||||||
|
|
||||||
|
/// The state of the button
|
||||||
|
state: ButtonState,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// The mouse wheel was scrolled.
|
/// The mouse wheel was scrolled.
|
||||||
|
|
@ -2,6 +2,4 @@
|
||||||
pub mod keyboard;
|
pub mod keyboard;
|
||||||
pub mod mouse;
|
pub mod mouse;
|
||||||
|
|
||||||
mod button_state;
|
pub use iced_core::ButtonState;
|
||||||
|
|
||||||
pub use button_state::ButtonState;
|
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
mod event;
|
mod event;
|
||||||
|
|
||||||
pub use event::Event;
|
pub use event::Event;
|
||||||
pub use iced_core::keyboard::{KeyCode, ModifiersState};
|
pub use iced_core::keyboard::*;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
//! Build mouse events.
|
//! Build mouse events.
|
||||||
mod button;
|
|
||||||
mod event;
|
|
||||||
|
|
||||||
pub mod click;
|
pub mod click;
|
||||||
|
|
||||||
pub use button::Button;
|
|
||||||
pub use click::Click;
|
pub use click::Click;
|
||||||
pub use event::{Event, ScrollDelta};
|
pub use iced_core::mouse::*;
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,7 @@ mod sandbox;
|
||||||
|
|
||||||
pub mod executor;
|
pub mod executor;
|
||||||
pub mod keyboard;
|
pub mod keyboard;
|
||||||
|
pub mod mouse;
|
||||||
pub mod settings;
|
pub mod settings;
|
||||||
pub mod widget;
|
pub mod widget;
|
||||||
pub mod window;
|
pub mod window;
|
||||||
|
|
@ -208,3 +209,6 @@ pub use runtime::{
|
||||||
futures, Align, Background, Color, Command, Font, HorizontalAlignment,
|
futures, Align, Background, Color, Command, Font, HorizontalAlignment,
|
||||||
Length, Point, Size, Subscription, Vector, VerticalAlignment,
|
Length, Point, Size, Subscription, Vector, VerticalAlignment,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
pub use runtime::input::ButtonState;
|
||||||
|
|
|
||||||
3
src/mouse.rs
Normal file
3
src/mouse.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
//! Listen and react to mouse events.
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
pub use iced_winit::input::mouse::{Button, Event, ScrollDelta};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue