-
1. Re: Scaled symbol throws out draggable symbol.
heathrowe Jan 29, 2014 5:47 PM (in response to rossfranks)Any reason for the scaling to occur in the first place?
When its removed, the draggable/droppable works.
Darrell
-
2. Re: Scaled symbol throws out draggable symbol.
rossfranks Jan 29, 2014 8:44 PM (in response to heathrowe)Yeah the reason is because the main symbol will hold a image of a table with seperate symbols of chemistry equipment on it (like up to 20 items) and it's easier to scale one symbol rather than many.
The user is then meant to drop and drag items onto other items on the table. But the animation starts as a long shot showing the whole table and some characters around it.
ie from this...
to this...
-
3. Re: Scaled symbol throws out draggable symbol.
rossfranks Jan 30, 2014 3:35 PM (in response to rossfranks)Actually it does the exact same thing if you turn on Responsive Scaling???
Any work around for this?
-
4. Re: Scaled symbol throws out draggable symbol.
sarhunt Jan 30, 2014 6:47 PM (in response to rossfranks)Unfortunately this is a known issue with jQuery UI where drag and drop doesn't properly calculate the dimensions of scaled elements, and one they don't seem intent on fixing. I tried a bunch of hacks to get jQuery UI to work and each fell short
The good news is there is another solution using Greensock draggable.
It's pretty simple to use too -- here's all the code I needed for compositionReady
var rect = sym.$("rect"); // Reference the object you want to drag Draggable.create(rect, {type:"x,y", }); // Drag it!You do need to be a member of the ShockinglyGreen club to get access to the draggable script, but could be worth the investment if this is a method you'll get a lot of use from. There's lots of other cool things you can do like give momentum to objects, "throw" them around, lock dragged object to coordinates, create spinners and other goodies.
Sarah
-
5. Re: Scaled symbol throws out draggable symbol.
rossfranks Jan 30, 2014 6:54 PM (in response to sarhunt)Ok thanks for that Sarah and looks good, so I can make another object droppable then?
ie if it drops on an object then that will kick off another action?
-
6. Re: Scaled symbol throws out draggable symbol.
sarhunt Jan 30, 2014 7:07 PM (in response to rossfranks)Yep, GSAP has an onDragEnd event which acts similarily to jQuery UI's drop method.
Uploaded another example where when the object is "dropped" it plays the symbol.
var rect = sym.$("rect"); // Get the element we want to drag Draggable.create(rect, {type:"x,y", onDragEnd : function(){ sym.getSymbol("rect").play(); // Play the symbol when the drag ends - can be any event }, });Sarah
-
7. Re: Scaled symbol throws out draggable symbol.
rossfranks Jan 30, 2014 7:14 PM (in response to sarhunt)Ok sweet, thanks Sarah.
Lets hope the jQuery UI guys fix this as well
-
8. Re: Scaled symbol throws out draggable symbol.
rossfranks Feb 2, 2014 7:52 PM (in response to rossfranks)Sorry to bring this up again Sarah,
in your example you have a draggable square but what if you wanted that square to drag onto a circle then an action fires off.
ie like jQuery UI's droppable code?
-
9. Re: Scaled symbol throws out draggable symbol.
paoloiammarino Mar 7, 2014 8:49 AM (in response to rossfranks)really helpful for drag with gs library. but how can i intercept mouse direction? example: go R direction = PLAY symbol. go L direction = PLAYREVERSE direction. tnx






