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 issues with these changes (especially ACTION_AUTO_PAN) as I am really keen to get these behaviors in! :)
Hi, since I selected "main" branch as the new default branch (instead of master), GH closed this PR. Feel free to submit a new PR on the "main" branch.
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 sideautoPanProps.width
: length of the auto pan area on the left and right, overrideslength
autoPanProps.height
: length of the auto pan area on the top and bottom, overrideslength
autoPanProps.delta
: amount of pixel to shift when auto panningautoPanProps.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, overridesdelta
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
toACTION_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 withnpm link
orfile://
in package.json.Don't hesitate to give me a lot of feedback about issues with these changes (especially
ACTION_AUTO_PAN
) as I am really keen to get these behaviors in! :)