-
Notifications
You must be signed in to change notification settings - Fork 177
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 "auto" as a value for the axis option #196
Conversation
When the `axis` option is set to “auto”, dragging will be constrained along the x *or* the y axis, depending on the dominant direction of the drag. This allows pep objects to be dragged either just vertically or just horizontally, but not both at the same time.
Looks alright to me, @briangonzalez you cool with me merging this? |
@briangonzalez Bump |
I'm pretty sure @briangonzalez has abandoned this project. I can merge the PR because it looks fine to me, but I cannot publish new versions to NPM unless he adds me as a collaborator on NPM. Since that's the case, I'd rather not merge a PR that affects the package.json version number so if you change that I'll marge it. |
package.json
Outdated
@@ -2,7 +2,7 @@ | |||
"name": "pep", | |||
"title": "jquery.pep.js", | |||
"description": "Kinetic drag for mobile & desktop", | |||
"version": "0.6.8", | |||
"version": "0.6.9", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this line since I cannot publish a new NPM version after merging this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍
@Anaphase @seanCodes I haven't abandoned the project, more so just don't have a need for it in my current work. I would love help keeping the repo up to date and I am 100% ok with you both merging and releasing to NPM at will, as long as we follow semver, etc. We don't currently push this library to npm, but I am ok doing so. Let me set that up. |
I am working on making the repo NPM ready on this PR: #197 I've asked you both a question over there. |
This PR adds a new “auto” value for the
axis
option. When set to auto, dragging will be constrainedalong the x or the y axis, depending on the direction of the
drag. This allows pep objects to be dragged either just vertically or
just horizontally. The axis to use is determined on drag—based on whether
dx
ordy
is greater—then cached until pep-stop, when it’s reset for the next drag.I’m adding this as an option because I could find no other way to do this given the tools Pep currently provides (primarily because the drag callback is called after the object has already moved). It also seemed like it could be useful for other developers.
All unit tests passed (although I had to open the test page to check them since I was getting a Phantom error when running via grunt). I’ve also updated the axis demo to include an “auto” example.