mouse speed multiplier
This commit is contained in:
parent
d0a458b450
commit
6d466c65a4
1 changed files with 6 additions and 4 deletions
|
|
@ -20,6 +20,8 @@ const FLING_START_THRESHOLD_VELOCITY: f64 = 500.0;
|
||||||
const FLING_STOP_THRESHOLD_VELOCITY: f64 = 100.0;
|
const FLING_STOP_THRESHOLD_VELOCITY: f64 = 100.0;
|
||||||
const FLING_DAMPENING: f64 = 0.98;
|
const FLING_DAMPENING: f64 = 0.98;
|
||||||
|
|
||||||
|
const CURSOR_SPEED_MULTIPLIER: f64 = 1.5;
|
||||||
|
|
||||||
pub struct PointerRegistryData {
|
pub struct PointerRegistryData {
|
||||||
initial_position: Point2D<f64, ElementSpace>,
|
initial_position: Point2D<f64, ElementSpace>,
|
||||||
|
|
||||||
|
|
@ -61,8 +63,8 @@ pub fn MouseArea(onevent: EventHandler<ClientEvent>) -> Element {
|
||||||
|
|
||||||
if registry.pointers.len() == 1 {
|
if registry.pointers.len() == 1 {
|
||||||
onevent.call(ClientEvent::MouseMove {
|
onevent.call(ClientEvent::MouseMove {
|
||||||
dx: delta.x,
|
dx: delta.x * CURSOR_SPEED_MULTIPLIER,
|
||||||
dy: delta.y,
|
dy: delta.y * CURSOR_SPEED_MULTIPLIER,
|
||||||
});
|
});
|
||||||
} else if registry.pointers.len() == 2 {
|
} else if registry.pointers.len() == 2 {
|
||||||
onevent.call(ClientEvent::MouseScroll {
|
onevent.call(ClientEvent::MouseScroll {
|
||||||
|
|
@ -145,8 +147,8 @@ pub fn MouseArea(onevent: EventHandler<ClientEvent>) -> Element {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
onevent.call(ClientEvent::MouseMove {
|
onevent.call(ClientEvent::MouseMove {
|
||||||
dx: flinger.velocity.x * delta_seconds,
|
dx: flinger.velocity.x * delta_seconds * CURSOR_SPEED_MULTIPLIER,
|
||||||
dy: flinger.velocity.y * delta_seconds,
|
dy: flinger.velocity.y * delta_seconds * CURSOR_SPEED_MULTIPLIER,
|
||||||
});
|
});
|
||||||
|
|
||||||
//tracing::info!("Fling: {:?}", flinger.velocity);
|
//tracing::info!("Fling: {:?}", flinger.velocity);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue