Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
andynormancx

Is Draggable missing a dependency on CSSPlugin ?

Recommended Posts

I'm having fun getting Draggable and TweenMax working with RequireJS (as part of a Durandal project).

 

I think there might be a bug in Draggable, it looks to me like it is missing a dependency definition for CSSPlugin. The define for it looks like this:

_gsScope._gsDefine("utils.Draggable", ["events.EventDispatcher","TweenLite"], function(EventDispatcher, TweenLite) {
On line 1757 CSSPlugin gets referenced as a global object:
setRatio:(_isOldIE ? function() { TweenLite.set(target, tempVars); } : CSSPlugin._internals.setTransformRatio || CSSPlugin._internals.set3DTransformRatio)
This line fails with an exception when I am loading Draggable via RequireJS. I have fixed it by changing the define call to:
_gsScope._gsDefine("utils.Draggable", ["events.EventDispatcher","TweenLite", "plugins.CSSPlugin"], function(EventDispatcher, TweenLite, CSSPlugin) {

Does this look like a valid fix or am I missing some other reason why this call to CSSPlugin as a global object should be like it is ?

 

  • Like 1
Link to post
Share on other sites

Ah yes, I see what you mean - this isn't a problem in the browser since CSSPlugin is a global, but in your environment it's trickier. Yes, I'll make that change that you suggested; thanks for identifying a solution. nice work :) 

  • Like 3
Link to post
Share on other sites

My environment is still "in the browser" by the way, just using Durandal (including RequireJS) and dependency injection, the objects aren't in the global namespace.

 

Getting everything working with RequireJS has been a challenge, but I think I am finally there.

  • Like 1
Link to post
Share on other sites

Ah yes, I see what you mean - this isn't a problem in the browser since CSSPlugin is a global, but in your environment it's trickier. Yes, I'll make that change that you suggested; thanks for identifying a solution. nice work :)

 

I think this is a problem in the browser if you are setting GreenSockGlobals; then CSSPlugin ends up not being in the global space and we get the same issue. At least, that's my situation; and applying andynormancx's patch has fixed the problem.

Link to post
Share on other sites

Hello,
Using Draggable I am getting the same message in the console;

GSAP encountered missing dependency: com.greensock.plugins.CSSPlugin

Even with the changes that @andynormancx suggested (I'm using the latest version) it's still in the console.
Thanks!

Link to post
Share on other sites

Can you please provide a reduced test case in codepen or jsfiddle or something? It sounds like you're forgetting to load CSSPlugin which is a dependency for Draggable. Or you can just load TweenMax and Draggable because TweenMax has CSSPlugin inside of it. 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×