Skip to content

Commit

Permalink
fix: touch sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Dec 15, 2023
1 parent d2506ed commit 2ea35a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "graph-view"
version = "0.1.18"
version = "0.1.19"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
14 changes: 10 additions & 4 deletions src/touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub struct TouchCameraConfig {
impl Default for TouchCameraConfig {
fn default() -> Self {
Self {
drag_sensitivity: 1.,
zoom_sensitivity: 0.005,
drag_sensitivity: 0.002,
zoom_sensitivity: 0.1,
touch_time_min: 0.01,
opposites_tolerance: 0.,
}
Expand Down Expand Up @@ -143,8 +143,14 @@ fn touch_pan_zoom(
return;
}

camera.target_alpha += touches[0].distance().y.to_radians();
camera.target_beta += touches[0].distance().x.to_radians();
let Some(radius) = camera.radius else {
return;
};

camera.target_alpha +=
(-touches[0].distance().x * config.drag_sensitivity * radius).to_radians();
camera.target_beta +=
(touches[0].distance().y * config.drag_sensitivity * radius).to_radians();

// let distance = Vec3::new(touches[0].distance().x, -touches[0].distance().y, 0.);
// let Some(radius) = camera.radius else {
Expand Down

0 comments on commit 2ea35a3

Please sign in to comment.