Open MeoMix opened 1 year ago
I have this working locally but it's all hacked together by combining this code with some stuff from another library. Need to spend some time figuring out how to write it all more clearly, but tested on iOS 17 and working pretty well
Cool, would be great to have touch support!
https://github.com/MeoMix/symbiants/blob/master/src/pancam.rs
Just as an FYI here is what the code looks like now. I've let some bits of my code diverge from the main branch but I'll look into making it more self-similar. It'll be easier if we can agree on the clamping bugs and get work regarding that landed.
I borrowed significant inspiration from https://docs.rs/bevy_touch_camera/latest/bevy_touch_camera/ as an FYI, but I ended up rewriting their approach to panning as it didn't seem to feel very good when I tested it on an iOS device.
It also lacks inertia when panning but hey it's better than nothing.
TODO still is to play around with all the settings exposed by pancam and make sure they play well with this + expose touch-specific settings. For example, I haven't seen what pinch to zoom does if zoom_to_cursor is false. It might fail spectacularly or potentially not even be supported.
overall though it works well, tested extensively on iOS 11 Pro
This would be a great issue to continue. I use a Magic TrackPad on an apple desktop, so this affects desktops too.
code is binding to mouse buttons but not touch interactions so it doesn't work on WASM mobile
I'll probably put up a PR for this later today, I'm fixing it right now on my local fork