Closed AlisiaNew closed 4 years ago
Hi @AlisiaNew , Sorry for the late response. I didn't have Xamarin tools installed at the moment so I wasn't able to dive into this issue earlier.
I played with the example code and I think what you are suggesting is already possible.
The SceneGestureRenderingResponder
has property TouchManipulationMode
which is either IsotropicScale
or ScaleRotate
. Default is IsotropicScale
and it indeed doesn't let you pan with 2 fingers but it also disables rotation of your scene.
The second one is ScaleRotate
. It allows you to do pan with 2 fingers but it also enables rotation which may not be what you want.
I already checked your PR #16 but I am not sure if this should be solved in TouchGestureRecognizer
class. I haven't tested it yet but I think if we want to just add this pan with 2 fingers into IsotropicScale
touch mode it should be solved in SceneGestureResponder
(parent of SceneGestureRenderingResponder
) in TouchGestureRecognizerOnPinch
method because current TouchGestureRecognizer
already sends all the info from pinch and pan gestures (even with 2 fingers) via OnPinch
event.
Please let me know if I understand it correctly and TouchManipulationMode = TouchManipulationMode.ScaleRotate
solved your issue, otherwise, I will test your PR and see if we can enable pan with 2 fingers in the IsotropicScale
mode.
Hi Ondrej, thank you for the response! I noticed that ScaleRotate is more flexible regarding pan gestures, but unfortunately, IsotropicScale is preferable for my project as my scene shouldn't have rotation enabled. And regarding my implementation, I think you're right and it should be better solved in SceneGestureResponder. I would appreciate if you could move the solution there. Thank you!
Ok, so I gave it a try via #17 and it seems like it is working. Can you please test it? I wasn't able to run the Forms sample because of some strange Xamarin errors so I would really appreciate if you can try it out in my branch - or just copy the code to your working project.
Basically you need to set SceneGestureRenderingResponder
properties to:
TouchManipulationMode = TouchManipulationMode.IsotropicScale,
EnableTwoFingersPanInIsotropicScaleMode = true,
Thank you, Ondrej! I've tested it (Forms application, run on Android device) and it works almost fine except for one thing: it seems that the 2 fingers pan "speed" is much faster than it is with 1 finger for smaller zoom values (and much slower for the larger zoom values). With a smaller zoom the scene objects disappear from the visible view area quite quickly. I would expect it to work with same pace as one finger gesture.
Thanks for your feedback! I am testing it in a native sample project but I was able to reproduce it as well. Sorry for that, I didn't play with the zoom before so it seemed fine. I will try to come up with some fix soon.
@AlisiaNew I updated the PR - now it seems it may be the desired behavior. Can you please check it again? Thanks!
Hi Ondrej! It seems it's working good. Thanks!
Great! I just merged it and published a new version to NuGet. Thanks again for your help.
Thank you for the lightweight and easy to use library! Is there any chance you add a "pan-while-pinching" feature (or, in other words, pan with 2 fingers)? This would help a lot, because now I have to use a customized TouchGestureRecognizer to handle these two gestures when they happen simultaneously. I think it would be great if it was an optional feature, something like this:
if (infos.Length == 1 || PanWhilePinching) { // ... } if (infos.Length >= 2) // without 'else' { // ... }