Skip to content

Commit

Permalink
Added touch event to checkbox widget
Browse files Browse the repository at this point in the history
  • Loading branch information
simlay committed Nov 19, 2019
1 parent 4bdaf02 commit 4fba2f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions native/src/widget/checkbox.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Show toggle controls using checkboxes.
use std::hash::Hash;

use crate::input::{mouse, ButtonState};
use crate::input::{mouse, touch::Touch, ButtonState};
use crate::{layout, Element, Event, Hasher, Layout, Length, Point, Widget};

pub use iced_core::Checkbox;
Expand Down Expand Up @@ -38,7 +38,8 @@ where
Event::Mouse(mouse::Event::Input {
button: mouse::Button::Left,
state: ButtonState::Pressed,
}) => {
})
| Event::Touch(Touch::Started { .. }) => {
let mouse_over = layout.bounds().contains(cursor_position);

if mouse_over {
Expand Down

0 comments on commit 4fba2f2

Please sign in to comment.