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

Support a pan min offset / distance #441

Open
mattnathan opened this issue Jan 14, 2020 · 7 comments
Open

Support a pan min offset / distance #441

mattnathan opened this issue Jan 14, 2020 · 7 comments
Labels

Comments

@mattnathan
Copy link

Subject of the issue

I'd like to be able to configure an offset or distance within which a pan doesn't start. Typically when dragging there is a margin of error to distinguish between a press (with wiggle) and a drag which tends to be implemented as a minimum distance a drag must move before recognising the event as a drag instead of a blurry press.

Your environment

  • Version of panzoom: 4.0
  • Browser and browser version: Google Chrome | 79.0.3945.117 (Official Build) (64-bit) (cohort: Stable)

Expected behaviour

  1. Configure panzoom with an option like minPanDistance: 5
  2. When panning, don't start the pan action until the mouse/pointer has moved by 5 pixels
  3. After the 5px threshold distance has been passed continue the pan as if the threshold didn't exist - i.e. if the distance is 6px then the pan should be 6px and not 1px (6px - 5px)

Actual behaviour

No option exists, the pan begins immediately. This can cause UX issue when clicking or tapping on buttons/elements that are within the pan area as they can move unintentionally.

Steps to reproduce

This is a new feature, it can always be reproduced.

@timmywil timmywil added feature votes needed Feature requests are closed at first, but will be implemented with enough upvotes labels Jan 14, 2020
@timmywil
Copy link
Owner

Thanks for opening an issue, and the feature request. I'd like to see more interest in this before implementing it. I've added this to the feature request list.

@mattnathan
Copy link
Author

Thanks, is there an alternative or work around that can be used instead to accomplish this without the feature being added to the library?

@timmywil
Copy link
Owner

@mattnathan I missed your question. There is not currently a way to do this in the library. You'd probably need your own pointer events. That's a point in this feature's favor.

@mattnathan
Copy link
Author

@timmywil I don't suppose there's any information on how long the 'collecting interest' phase lasts?

I'm approaching a release date for the project I'm working on that requires this feature and need to plan whether I'm going to fork and fix or wait for it to be released as part of this library.

No pressure, just for planning

@timmywil
Copy link
Owner

timmywil commented Feb 5, 2020

Sorry I didn't get back right away. There's not really a set time on how long a feature can be collecting interest. That said, while this feature only has 2 votes, it has the most of the 3 features in the list so far. I'm not opposed to doing it, but I probably won't have time in the near future. If you want to fork and fix, that could be the start of a PR! :)

@mattnathan
Copy link
Author

@timmywil I forked and applied the change I needed. I've created a PR which works for my application, whether it's the correct way to do it for this project I don't know. Hopefully it'll help get the feature landed here anyway.

@timmywil timmywil reopened this Feb 7, 2020
@timmywil timmywil removed the votes needed Feature requests are closed at first, but will be implemented with enough upvotes label Feb 7, 2020
@djfariel
Copy link

Any plan to incorporate this in the near future, or a workaround implemented since this was opened three years ago?

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

3 participants