desandro / draggabilly

:point_down: Make that shiz draggable
https://draggabilly.desandro.com
MIT License
3.86k stars 387 forks source link

When disabled. preventDefault still runs on touch devices. #141

Closed etoxin closed 8 years ago

etoxin commented 8 years ago

I found that when you disabled .disable(); Draggabilly you could not scroll on touch devices. I added this duck punch. Thought I'd open an issue before I started the PR.

/**
 * Duck Punching Unidragger in Draggabilly.
 */
Draggabilly.prototype._dragPointerDown = function( event, pointer ) {
  // track to see when dragging starts
  this.pointerDownPoint = window.Unipointer.getPointerPoint( pointer );

  var canPreventDefault = this.canPreventDefaultOnPointerDown( event, pointer );
  if ( canPreventDefault && this.isEnabled ) {
    event.preventDefault();
  }
};
desandro commented 8 years ago

Good call! I've added a fix to check for isEnabled for preventDefault. This fix will be in the next release.

If you like stickers, Email me yo@metafizzy.co so I can send some your way.

etoxin commented 7 years ago

Awesome.