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

[BUG] v6: Unable to smoothly rotate when colliding with constraints #1682

Closed
tlserver opened this issue Oct 10, 2023 · 5 comments · Fixed by #1700
Closed

[BUG] v6: Unable to smoothly rotate when colliding with constraints #1682

tlserver opened this issue Oct 10, 2023 · 5 comments · Fixed by #1700
Labels
bug This issue reports broken functionality or another error P: 2 (soon™?)

Comments

@tlserver
Copy link
Contributor

What is the bug?

User cannot zoomout or rotate by gesture if the space is not fully filled with tile.

How can we reproduce it?

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';

class MinimumExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Minimum Example'),
      ),
      body: FlutterMap(
        options: const MapOptions(
          initialCenter: LatLng(0, 0),
          initialZoom: 1,
          minZoom: 0,
          maxZoom: 19,
        ),
        children: [
          TileLayer(
            urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
            userAgentPackageName:
                'net.tlserver6y.flutter_map_location_marker.example',
            maxZoom: 19,
          ),
        ],
      ),
    );
  }
}
  1. This code set initialZoom to 1.
  2. Try to move / rotate / zoom-out by gesture, and it is not work. (Note that minZoom = 0) Only zoom-in is working in this state.
  3. Zoom in to zoom ~= 2 by gesture, and you will find that you cannot zoom it out back to zoom = 1 by gesture. (Stop at zoom ~= 1.5, which is according to your device's size)
  4. Zoom in a little bit (around +0.2). Try to rotate the map now, and you will find that you have a very limited angle to rotate.

Do you have a potential solution?

No response

Platforms

Android 13 [XiaoMi13i, MIUI Global 14.0.5]

Severity

Obtrusive: Prevents normal functioning but causes no errors in the console

@tlserver tlserver added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Oct 10, 2023
@JaffaKetchup
Copy link
Member

Hi @tlserver, thanks for reporting.

Can you try disabling the new transparent gestures feature in MapOptions?

@tlserver
Copy link
Contributor Author

Do you mean applyPointerTranslucencyToLayers option? Same behaviour if set it to false.

@JaffaKetchup JaffaKetchup added P: 3 (low) (Default priority for feature requests) and removed needs triage This new bug report needs reproducing and prioritizing labels Oct 10, 2023
@JaffaKetchup
Copy link
Member

JaffaKetchup commented Oct 10, 2023

Ah, I've got it now. I originally misunderstood this, but I can see what you mean. When zoomed out to the constraints, rotating the map does not smoothly zoom it in and out to allow for full rotation touching the bounds. Instead, it rubs against the bounds and stops gestures.

Not being able to zoom out is expected, as we've added these bounds to prevent the user from seeing the gray background.

I can't remember the behaviour in previous versions, but I suppose it's possibly the same, just rarely noticed due to the relative underuse of this feature.

Anyway, it should be able to be worked around by setting CameraConstraint.unconstrained() in the appropriate field in MapOptions. Note that this will allow the gray background to become visible outside the Earth's projection again.

@JaffaKetchup JaffaKetchup changed the title [BUG] v6 Cannot zoomout or rotate if the space is not fully filled with tile [BUG] Unable to smoothly rotate when colliding with constraints Oct 10, 2023
@tlserver
Copy link
Contributor Author

tlserver commented Oct 10, 2023

In previous version, user can zoom in or out or rotate freely when zoom = 1 but keep seeing the gray background. I think this should be the default behaviour. Since seeing background is not a big problem to the user, but non-responding gesture is. I do not think any user will expect the boundary of map will stop him/her to rotate the map.

@JaffaKetchup
Copy link
Member

You're right, the easy fix is to change this default.

However, I'm not so sure. Whilst we don't support infinite repeating Earth's, it's not great UX to let the users see these 'false' projections (as they won't be able to interact with them, because the lat/lng range is constrained to reality), let alone grey tiles.

The proper fix is to allow a rotation gesture to change the zoom level as necessary in order to comply with the constraints, then smoothly restore to the correct level as possible. But this does sound like a lot of work in an already overcomplicated system, so maybe we'll revert the change that changed this default 😂.

@JaffaKetchup JaffaKetchup added P: 2 (soon™?) and removed P: 3 (low) (Default priority for feature requests) labels Oct 11, 2023
@JaffaKetchup JaffaKetchup changed the title [BUG] Unable to smoothly rotate when colliding with constraints [BUG] v6: Unable to smoothly rotate when colliding with constraints Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error P: 2 (soon™?)
Projects
None yet
2 participants