Move reusable mouse types to iced_core

This commit is contained in:
Héctor Ramón Jiménez 2020-04-28 03:11:01 +02:00
parent 20d79a43cc
commit 56dbd68326
10 changed files with 23 additions and 12 deletions

View File

@ -15,9 +15,11 @@
#![forbid(unsafe_code)]
#![forbid(rust_2018_idioms)]
pub mod keyboard;
pub mod mouse;
mod align;
mod background;
mod button_state;
mod color;
mod font;
mod length;
@ -28,6 +30,7 @@ mod vector;
pub use align::{Align, HorizontalAlignment, VerticalAlignment};
pub use background::Background;
pub use button_state::ButtonState;
pub use color::Color;
pub use font::Font;
pub use length::Length;

6
core/src/mouse.rs Normal file
View File

@ -0,0 +1,6 @@
//! Reuse basic mouse types.
mod button;
mod event;
pub use button::Button;
pub use event::{Event, ScrollDelta};

View File

@ -1,5 +1,5 @@
use super::Button;
use crate::input::ButtonState;
use crate::ButtonState;
/// A mouse event.
///
@ -26,11 +26,11 @@ pub enum Event {
/// A mouse button was pressed or released.
Input {
/// The state of the button
state: ButtonState,
/// The button identifier
button: Button,
/// The state of the button
state: ButtonState,
},
/// The mouse wheel was scrolled.

View File

@ -2,6 +2,4 @@
pub mod keyboard;
pub mod mouse;
mod button_state;
pub use button_state::ButtonState;
pub use iced_core::ButtonState;

View File

@ -2,4 +2,4 @@
mod event;
pub use event::Event;
pub use iced_core::keyboard::{KeyCode, ModifiersState};
pub use iced_core::keyboard::*;

View File

@ -1,9 +1,6 @@
//! Build mouse events.
mod button;
mod event;
pub mod click;
pub use button::Button;
pub use click::Click;
pub use event::{Event, ScrollDelta};
pub use iced_core::mouse::*;

View File

@ -185,6 +185,7 @@ mod sandbox;
pub mod executor;
pub mod keyboard;
pub mod mouse;
pub mod settings;
pub mod widget;
pub mod window;
@ -208,3 +209,6 @@ pub use runtime::{
futures, Align, Background, Color, Command, Font, HorizontalAlignment,
Length, Point, Size, Subscription, Vector, VerticalAlignment,
};
#[cfg(not(target_arch = "wasm32"))]
pub use runtime::input::ButtonState;

3
src/mouse.rs Normal file
View 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};