desandro / draggabilly

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

Disabling this.setLeftTop(); on DragEnd #103

Closed jamielob closed 8 years ago

jamielob commented 8 years ago

Hi!

I need to disable this.setLeftTop(); on DragEnd for a couple of use cases so that I can do my own animations using just Transform. I can overwrite the DragEnd prototype, but then I don't get to use it in the other places I need it to do it's magic as normal.

Any suggestions?

Thanks,

Jamie

desandro commented 8 years ago

Duck punch it!

var _dragEnd = Draggabilly.prototype.dragEnd;
Draggabilly.prototype.dragEnd = function( event, pointer ) {
  if ( this.isSpecial ) {
    // do special stuff
  } else {
    // not special, do regular stuff
    _dragEnd.apply( this, arguments );
  }
};
jamielob commented 8 years ago

Beautiful! I'll get the monkey out.