AliasIO / Raphael.FreeTransform

Free transform tool for Raphaël elements.
http://elbertf.com
363 stars 107 forks source link

adding option for handle #115

Open slowdash opened 10 years ago

slowdash commented 10 years ago

Anybody tried repositioning the handles? eg: put the handles on the sides of the box instead of just the x & y discs

AliasIO commented 10 years ago

You mean like the example on the right? It's the draw: [ 'bbox' ] option with scale: [ 'bboxSides' ].

https://raw.github.com/ElbertF/Raphael.FreeTransform/master/screenshot.png

slowdash commented 10 years ago

hi Elbert,

first, i want to say thanks for a really great script

well, im trying to use images instead of the x,y discs to seperate the functionality for dragging and resizing, the positions of the handles are on the edges of the box much like the example you gave

i basically just cloned the function for drag but cant seem to figure out how to accomodate the change of location for the handle,

already changed

var cx = dx + ft.handles[axis].disc.ox, cy = dy + ft.handles[axis].disc.oy;

to point to the handles i created instead, but cant seem to get the proper formula to compute the radian

var rad = Math.atan2(cy - ft.o.center.y - ft.o.translate.y, cx - ft.o.center.x - ft.o.translate.x);

jorozcocs commented 10 years ago

Hi Slowdash, do you have any sample code to share about how you did it? Currently I am trying to move the center-right disc to the top-left corner.

Thanks in advance.