falling-fruit / falling-fruit-web

Mobile-friendly website for Falling Fruit
https://beta.fallingfruit.org
GNU General Public License v3.0
29 stars 7 forks source link

improve zoom in / out effects related to add/edit location actions #398

Open wbazant opened 3 weeks ago

wbazant commented 3 weeks ago

There's a behaviour to zoom in when adding a new location, and a reverse operation to restore the saved view. There's also similar behaviour for editing position of a location in #396.

It's implemented in the map page component with effects:

src/components/map/MapPage.js
  useEffect(() => {
    if (isAddingLocation) {
      dispatch(zoomInAndSave())
    } else {
      dispatch(restoreOldView())
    }
  }, [dispatch, isAddingLocation])

So, each time isAddingLocation goes true -> false, we restore the old view, and I'm not sure how intentional this is, and also how good the UX is, in the case of a new location being successfully added. There's no intention of going back to the previous view when clicking "submit" on the location, and it's probably more satisfying for the user to look at the just-added location in all its glory.

Another UX consideration is when a user clicks "Add Location", moves the marker, and cancels - then their effort to move the map is frustrated.

My first solution idea was to stop that zoom-out from happening after successful location add - see if restoreOldView can happen through the back button - and the next idea is to generally redefine what the reverse operation is: maybe we only zoom out, and for edit location we move back in addition to zooming out if the location being edited is still in the middle of the map.

ezwelty commented 3 weeks ago

@wbazant There were a lot more of these effects before, and I had been gradually removing them. I'm of the same opinion that the map view (bounds/zoom/etc, except for labels: on, as we've discussed) should not change when starting "add new location", nor when canceling "add new location" after having changed the map view during the process, nor on submit of add or edit location (which necessarily will be centered on the location, at least on mobile where we move the map below a center marker).

The only exception I can think of is if the user begins "add location" and the map is zoomed way out. Then what should we do?

wbazant commented 2 weeks ago

@ezwelty I quite like the effect of zooming in when adding a new location, it facilitates the marker placement and also communicates that something different is about to start happening. I'm less sure about actions that center the map on a point of interest - I added it for editing the location for #306 but not feeling very strongly that it's a good idea. Actually, it's an implementation detail: for editing the location, we place the marker in the middle and the map moves, which involves centering the map. We could also center the map after the user selects a proposed right-click tooltip action that adds a new location ( #315 ).

I think it's probably good to undo the big zoom effect after clicking the "back" button since it helps a novice user undo an unwanted interaction, but there's not much value in undoing the location, and it gets confusing when the difference is small.

I propose to limit the undoing to where it's useful:

ezwelty commented 2 weeks ago

@wbazant People tend to add a new location either at/near their current position or a place that they searched for by name. So recentering the map and zooming in to a minimum zoom level makes sense when either of these modes is evoked (as we now do). Zooming in to a minimum zoom level could similarly make sense when "add location" is evoked from a low zoom level. Arguably they'll discover it isn't useful, since they'll end up who-knows-where on the map, and then hope to be zoomed back out on "back". Either that or adding a location is greyed out (and toasted if pressed) until a certain zoom level is reached. So I agree with your assessment of where an undo is most useful. My modification to your proposal would be to not zoom in when the difference is small (rather than skipping the zoom-out on back).

Maybe relevant to this discussion is that the beta website lacks zoom buttons, which makes it almost impossible to zoom the map in/out (say after centering the map by search or GPS or manually centering the "add location" crosshair) without also panning the map. This was once the case of the mobile app until users complained and we added [+] [-] buttons to the interface. Having these makes it much easier for users to manage the zoom level themselves while preserving automatic and manual map-centering. The "optimal" zoom level will likely vary depending on basemap, local landmarks, screen size. Somewhat similarly, unlike the current interfaces (which switch to a satellite basemap when adding/editing location, but allow this to be changed), I notice that the beta website doesn't allow users to change the basemap while adding/editing (nor viewing) a location, which further frustrates users' ability to fine tune their "work environment". All that to say that I'd prioritize giving users more control over managing the map for them.