Added initial touch events to support iOS

This commit is contained in:
Sebastian Imlay 2019-11-11 20:29:58 -08:00
parent 9da6ce474c
commit e19a07d400
13 changed files with 165 additions and 47 deletions

View file

@ -1,6 +1,6 @@
//! Create choices using radio buttons.
use crate::{
input::{mouse, ButtonState},
input::{mouse, touch, ButtonState},
layout, row, text, Align, Clipboard, Element, Event, Font, Hasher,
HorizontalAlignment, Layout, Length, Point, Rectangle, Row, Text,
VerticalAlignment, Widget,
@ -121,7 +121,8 @@ where
Event::Mouse(mouse::Event::Input {
button: mouse::Button::Left,
state: ButtonState::Pressed,
}) => {
})
| Event::Touch(touch::Touch::Started { .. }) => {
if layout.bounds().contains(cursor_position) {
messages.push(self.on_click.clone());
}