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

Add more customization for auto pan #195

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LouisBrunner
Copy link

Following the closure of #183 because of the change of the master branch to main, I recreate this PR as-is, original text follows:

Thanks a lot for this great project!

One of the issue (the only really) I ran into when integrating this in our product is around the auto-pan feature. I wanted to be able to customize the zone where auto-pan is triggered and the amount of space it shifts. So I added a bunch of properties:

  • autoPanProps.length: length of the auto pan area on each side
  • autoPanProps.width: length of the auto pan area on the left and right, overrides length
  • autoPanProps.height: length of the auto pan area on the top and bottom, overrides length
  • autoPanProps.delta: amount of pixel to shift when auto panning
  • autoPanProps.easing: easing function which must return the amount of pixel to shift given t [0, 1], 0 being the start of the panning area, 1 being the edge of the viewer, overrides delta

The default behavior is still the same and corresponds to autoPanProps={{length: 20, delta: 2}}.

Another change I included was around the action used by auto-pan, changing it from ACTION_PAN to ACTION_AUTO_PAN, which is a breaking-change, but I needed to be able to distinguish regular panning from auto-panning (as our SVG is draggable as well and I want to disable regular panning when that is going but not auto-panning).

Last but not least, I just added a prepare script to allow to use the repository with npm link or file:// in package.json.

Don't hesitate to give me a lot of feedback about any issue with these changes (especially ACTION_AUTO_PAN) as I am really keen to get these behaviors in! :)

@sonarcloud
Copy link

sonarcloud bot commented Jan 8, 2021

SonarCloud Quality Gate failed.

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 29 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

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

Successfully merging this pull request may close these issues.

None yet

1 participant