setzer22 / blackjack

A procedural, node-based modelling tool, made in rust 🦀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zoom speed on MacOS

setzer22 opened this issue · comments

Just a small improvement would be to reduce the speed of the zoom speed, it is very difficult to be precise as it is very fast to zoom and unzoom.

Originally posted by @Kerollmops in #7 (comment)

@Kerollmops Zoom speed looks fine on my end. This is probably caused by mouse events behaving slightly different on MacOS. I added a few debug prints on a new branch fix/zoom_speed_macos (https://github.com/setzer22/blackjack/tree/fix/zoom_speed_macos). If you have time, could you run that and tell me what kind of output you're getting when scrolling on both the viewport and node editor?

For reference, it looks like this on my end after scrolling a few times up and down on one viewport, then the other:

PS: Many thanks for helping me debug all these issues 😄

[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, 1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[3d viewport] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, -1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)
[Node Editor] LineDelta(0.0, 1.0)

Here are the debug logs I get when I just barely move my fingers on my trackpad i.e. no more than a distance of 0.5 cm.

[Node Editor] PixelDelta(PhysicalPosition { x: -0.0, y: 0.0 })
[Node Editor] PixelDelta(PhysicalPosition { x: -0.0, y: 0.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 0.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 4.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -2.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -2.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -4.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: 2.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: 2.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: 2.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: 4.0, y: 4.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: 2.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: 2.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: -2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -2.0, y: 0.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -2.0, y: 0.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 4.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 2.0 })
[3d viewport] PixelDelta(PhysicalPosition { x: -0.0, y: 0.0 })

BTW importing files on this specific branch makes the program crash with:

thread 'main' panicked at 'Error executing action: missing field `shown_inline`', src/application.rs:196:18

Here are the debug logs I get when I just barely move my fingers on my trackpad i.e. no more than a distance of 0.5 cm

Thanks! I can start working with that :)

BTW importing files on this specific branch makes the program crash with:

Oops, I messed up and pushed to the wrong branch. The panic happens because I added a new property to the graph struct. In general, don't expect file compatibility between versions just yet. It's too soon for that since I'm still figuring out exactly what I need to store.

But for this particular case, I think I can serde::default my way out of it 😄

For the record, the panic on deserialization has been fixed in db97e62, since keeping compatibility was easy enough for the new fields I added.

Thank you, that is a nice project I would like it to go further 😃

Just for correctness, I was not even moving 0.5cm with my fingers on my trackpad but not moving them at all, just rolling them a little bit. That's probably just 0.05 cm.

As a drive-by suggestion, in the hopes it might be a helpful pointer:

This issue has the appearance of a common issue with cross-platform "scroll-wheel" behaviour which occurs due to the difference in use of trackpad vs mouse-wheel for scrolling and the unit of the values returned.

It can be seen in the debug logs where the first log shows LineDelta (as generally reported by scroll-wheels) & while the second log shows PixelDelta (as generally reported by trackpad scrolling)--what is possibly happening is that the pixel-delta is being used as a line-delta which effectively multiplies the speed of the zoom.

The issue can also appear when an application is deployed natively vs when deployed in a web browser (and across browser engines).

I know egui has run into this (& other scrolling) issue before so it might be informative to take a look at the related issues/patches:

Hope this is helpful.


Aside: Discovered Blackjack via your recent Rust GameDev Meetup talk which was enjoyable. I particularly liked how you doubled-down on the carrots in response. :D

Hope this is helpful.

It certainly is! Many thanks 😄

Aside: Discovered Blackjack via your recent Rust GameDev Meetup talk which was enjoyable. I particularly liked how you doubled-down on the carrots in response. :D

Haha, I'm glad you enjoyed it! Extra carrots is always a safe bet 🥕