Skip to content

Instantly share code, notes, and snippets.

@pixelhijack
Created March 19, 2014 08:53
Show Gist options
  • Save pixelhijack/9637912 to your computer and use it in GitHub Desktop.
Save pixelhijack/9637912 to your computer and use it in GitHub Desktop.
/*
DRAGGABLE PATHS IN RAPHAEL
hint: convert the x and y deltas into translate values which the path object understands
*/
Raphael.el.draggablePath = function(){
this.attr({cursor: "move"});
this.drag(
function(dx,dy){
this.translate(dx - this.odx, dy - this.ody);
this.odx = dx;
this.ody = dy;
},
function(){
this.odx = 0;
this.ody = 0;
this.attr({opacity: 0.4});
},
function(){
this.attr({opacity: 1});
});
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment