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

[Feat] Expose props mapping to disableRotation() on the touch-zoom-rotate handler #2284

Open
mz8i opened this issue Sep 14, 2023 · 2 comments
Labels

Comments

@mz8i
Copy link

mz8i commented Sep 14, 2023

Target Use Case

Currently it's not possible to enable touch zoom but disable touch rotate.

The touch zoom+rotate handlers for both Maplibre and Mapbox expose a disableRotation() method, so that sort of granularity is allowed by the base libraries.

Proposal

There are different ways the API could look, but an example (that I believe was the case with older versions of this library) is: expose an additional touchRotate prop that, if false, will cause calling disableRotation() on the touch-zoom-rotate handler.

@mz8i mz8i added the feature label Sep 14, 2023
@mz8i
Copy link
Author

mz8i commented Sep 14, 2023

Current workaround is to use a ref function:

const mapRefFn = useCallback((refObj) => {
  refObj?.getMap()?.touchZoomRotate?.disableRotation();
}, []);

return (<Map ref={mapRefFn} touchZoomRotate={true}>
   {/* ... */}
</Map>);

@csdiehl
Copy link

csdiehl commented Oct 5, 2023

I have also run into a need for this! Happy to take this on, if help is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants