Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration option to disable two-finger map rotation, as well as 3D view activation via map rotation button #3022

Closed
demsjf8 opened this issue Jul 6, 2021 · 15 comments

Comments

@demsjf8
Copy link

demsjf8 commented Jul 6, 2021

Use case

I am rarely using map rotation, if at all. However, I frequently use two-finger pinching to zoom into and out of the map. Almost as frequently as I use that, this results in a slight map rotation, which I then need to undo again by tapping on the respective map rotation icon. So the map rotation icon is almost the button I use most frequently in the app, but only to undo a map rotation that was not intended in the first place.

Sometimes, I am not sure whether I caused an unwanted rotation, and hit the map rotation icon just to be sure. If the map in fact was not rotated, this results in the 3D view being activated. Then, I have to hit the map rotation icon a second time, to undo the 3D view.

Proposed Solution

Add a configuration option that gives the user the choice to disable map rotation (as consequence of two finger interaction with the map) as well as 3D view (as consequence of "pressing" the map rotation button), respectively.

@rhhsm
Copy link

rhhsm commented Jul 6, 2021

I would welcome this. I only use map rotation to select areas for downloading quests. There are people who need to physically rotate a map to be able to orient themselves, but I guess that the selection of humanity that is so interested in maps to be a SC user are mostly of the kind that prefer mental rotation. I never use the 3D view: I find it annoying that it's possible and would prefer if it wasn't there.

@westnordost
Copy link
Member

westnordost commented Jul 6, 2021

I don't think this is worth an option in the setting. Maybe it is possible to disable rotating while pinching to zoom and the other way round. Depends on tangram-es.

@FloEdelmann
Copy link
Member

Alternatively, you could resort to only using the zoom buttons or the one-finger zoom gesture (double tap, but keep the finger on the screen after the second tap, then swipe up or down to zoom). Then there's no way to accidentally rotate the map.

@smichel17
Copy link
Member

Huh. Rotating the map is probably my most-used feature, or close to it. I like to keep the map orientation aligned with the physical terrain, but I prefer not to tilt or lock the map (more detail in #2191). So I'm constantly rotating and panning the map. It helps me keep my bearings and make sure I'm answering quests about the right buildings.

@demsjf8
Copy link
Author

demsjf8 commented Jul 6, 2021

@smichel17, my proposal was NOT to remove this feature. Just to give the user the choice whether to have it enabled or not.
@FloEdelmann, thanks for the hints, will give it a try. However, the underlying challenge is that interactions with the display while on the road at least for me are inherently less precise than when sitting in my armchair at home (just to give an example). So it is not that there wouldn't be a way to pinch without changing the orientation, but that factually, with a certain likelihood, it will have those side effects.
@westnordost, if decoupling those two actions would be possible, that might indeed be a helpful step. I am not sufficiently familiar with what is going on behind the scenes. I.e. not sure whether my interactions were misunderstood as (currently supported) combined zoom and rotate action. Or whether those interactions are detected independently, but my gestures were simply not clear enough so that a slight rotation at the end/as part of the zoom gesture was then interpreted as rotation request.

@smichel17
Copy link
Member

smichel17 commented Jul 6, 2021

Maybe it is possible to disable rotating while pinching to zoom and the other way round. Depends on tangram-es.

The map fragment can respond to various gestures:

override fun onScaleBegin(): Boolean { return false }
override fun onScale(x: Float, y: Float, scale: Float, velocity: Float): Boolean { return false }
override fun onScaleEnd(): Boolean { return false }
override fun onShoveBegin(): Boolean { return false }
override fun onShove(distance: Float): Boolean { return false }
override fun onShoveEnd(): Boolean { return false }
override fun onRotateBegin(): Boolean { return false }
override fun onRotate(x: Float, y: Float, rotation: Float): Boolean { return false }
override fun onRotateEnd(): Boolean { return false }

According to the tangram docs (direct link), these functions should return "True if the event is consumed, false if the event should continue to propagate". I'm not sure if returning true will prevent the map from rotating, or just prevent other listeners from being triggered. If it does prevent rotation, we could track the state and make the two actions mutually exclusive.

@westnordost
Copy link
Member

Nice. Care to try it out?

@smichel17
Copy link
Member

I'll check tonight. I've spent too much time here instead of working already today 😆

@smichel17
Copy link
Member

s/tonight/tomorrow morning/. Anyway I've done it now. Good news and bad news.

Good news first: you can indeed prevent the map from rotating by returning false in the onRotateBegin callback.

Bad news: onScaleBegin is called as soon as you touch down with two fingers. So if you naively block rotation after onScaleBegin has been called, then you will never be able to do gestures other than zoom.

I think it is probably possible to have the desired behavior here, but I'll need to play around with it a little more.

@smichel17
Copy link
Member

Okay, a little more playing, more good and bad news:

  • Good: tilting the map is already exclusive with other gestures — once you start tilting, you can no longer zoom or rotate, and once you start those, you can no longer tilt — so there's nothing to do there.
  • Bad: onScale is also called a bunch of times immediately after you touch down. Damn touchscreens are too sensitive. Not physically possible to prevent this. So, in order to implement, we'd need to pick some zoom distance after which rotation should be locked out.
  • Good: There is already some amount of "accidental rotation prevention". When you start zooming, it's "sticky" in the current direction, and a very small amount of rotation will not actually start rotating. Once you rotate a little bit more than that, it will "snap" to catch up and start rotating exactly in sync with your fingers.
    • It might be a better solution to increase the rotation threshold, rather than making rotation and zoom mutually exclusive. I am not sure whether this is something we can do with the current callbacks, or whether it is configurable somewhere else in Tangram, or whether we'd need to put in a feature request.

Anyway, that's all the time I want to put in this morning, so I'll continue to dig whenever I get around to it, or someone else can look into it more.

@mnalis
Copy link
Member

mnalis commented Jul 7, 2021

I was going to suggest adding "snap" so rotating doesn't happen immediately but only after some threshold, nice to see there is already support for it - I didn't feel it before in practice, so had to try it now, and it is indeed there; good find @smichel17 !

While increasing it further (if easily possible) might be OK, it might also become problematic (from the feeling, it currently seems to not rotate until it is moved about 10-15 degrees, which is unobtrusive so far. If changed, it should probably be kept below 30 degrees or so, or it might become quite hard to do the rotation when one does want it (and I'm also in the group of people using manual rotation in 2D mode all the time, as auto-3D does not feel that good/practical for me, and having "in front of me" on the "upper side of screen" is still most understandable and error-free for me).

@smichel17
Copy link
Member

I tried playing around with the "snap" a tiny bit more this morning (no code this time, just qualitative observation). I have a guess that I would appreciate help verifying.

It seems like the "snap" might be based on the angle of rotation only — not the distance of travel. That is, I think it might be easier to accidentally trigger rotation when your fingers are close together, at the end of a pinch or the beginning of a spread, because you only have to move them a very small distance to pass the 10-15° threshold.

I had a really hard time telling if this was actually the case, though. It might need to be verified by checking the code. But it would be nice if this issue could be resolved by tweaking the parameters of the accidental rotation prevention upstream in Tangram, without the need to add an additional setting.

@westnordost
Copy link
Member

I think it is not worth the time to try to tweak, maybe with hacks, the default UX behavior of the library that takes care of the map rendering. Anyone is welcome to work on it (I'd merge it only if it does not involve hacks or a lot of code) but I'll close this as an issue.

Also, for whoever would like to work on it, I'd like to suggest to contribute any enhancements directly to upstream (tangram-es), it's also easier than trying to achieve this through hacks here.

@mnalis
Copy link
Member

mnalis commented Aug 22, 2021

Also, for whoever would like to work on it, I'd like to suggest to contribute any enhancements directly to upstream (tangram-es),

(or, in order not to waste effort needlessly, wait to see if SC perhaps migrates to some other map rendering library, like #3123)

@matkoniecz
Copy link
Member

I don't think this is worth an option in the setting. Maybe it is possible to disable rotating while pinching to zoom and the other way round. Depends on tangram-es.

I would be against it, while I am not using it often it is sometimes useful when GPS refuses to work properly (typically in urban or natural canyons).

westnordost added a commit to Helium314/SCEE that referenced this issue Apr 15, 2024
…treetcomplete#3022)

and if they really want to, they just need to first start rotating, then start zooming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants