circles punch: touchscreen support
This commit is contained in:
parent
292dfb8ee3
commit
92ceea208f
@ -21,8 +21,8 @@ pub struct Simulation {
|
||||
impl Default for Simulation {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
circles: Vec::new(),
|
||||
circles_count: 2,
|
||||
circles: Vec::new(),
|
||||
colors: Vec::new(),
|
||||
}
|
||||
}
|
||||
@ -122,10 +122,11 @@ impl eframe::App for Simulation {
|
||||
);
|
||||
}
|
||||
|
||||
let (hover_pos, any_down, any_released) = ctx.input(|input| (
|
||||
let (hover_pos, any_down, any_released, any_pressed) = ctx.input(|input| (
|
||||
input.pointer.hover_pos(),
|
||||
input.pointer.any_down(),
|
||||
input.pointer.any_released()
|
||||
input.pointer.any_released(),
|
||||
input.pointer.any_pressed()
|
||||
));
|
||||
|
||||
if let Some(mousepos) = hover_pos {
|
||||
@ -138,7 +139,7 @@ impl eframe::App for Simulation {
|
||||
Stroke{width: 1.5, color: Color32::from_rgb(255, 0, 0)});
|
||||
}
|
||||
|
||||
if any_released {
|
||||
if any_released || any_pressed {
|
||||
circle.v += d.normalized() * (d.length() / circle.r) * 8.0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user