Skip to content
This repository has been archived by the owner on Dec 31, 2017. It is now read-only.

fx.js makes other file lose easing and duration kwargs definition #63

Open
wkeese opened this issue Jul 17, 2012 · 3 comments
Open

fx.js makes other file lose easing and duration kwargs definition #63

wkeese opened this issue Jul 17, 2012 · 3 comments
Milestone

Comments

@wkeese
Copy link
Collaborator

wkeese commented Jul 17, 2012

See dojox/charting/action2d/Highlight.js. It has a kwargs definition

var __HighlightCtorArgs = function(duration, easing, highlight){
    // summary:
    //      Additional arguments for highlighting actions.
    //
    // duration: Number?
    //      The amount of time in milliseconds for an animation to last.  Default is 400.
    // easing: dojo/fx/easing/*?
    //      An easing object (see dojo.fx.easing) for use in an animation.  The
    //      default is dojo.fx.easing.backOut.
    // highlight: String|dojo/_base/Color|Function?
    //      Either a color or a function that creates a color when highlighting happens.
    this.duration = 400;
    this.easing = null;
    this.highlight = null;
};
=====*/

But easing and duration don't show up in the doc.

The test (Highlight.js) can be reduced to:

define(["dojo/_base/declare", "dojo/_base/fx"],
    function(declare){

    var __HighlightCtorArgs = function(){
        // duration: String
        //      Either a color or a function that creates a color when highlighting happens.
        // foo: Number
        //      The amount of time in milliseconds for an animation to last.  Default is 400.
        // easing: Number
        //      The amount of time in milliseconds for an animation to last.  Default is 400.
     };


    return declare(null, {
        constructor: function(chart, plot, kwArgs){
            // kwArgs: __HighlightCtorArgs?
            //      Optional keyword arguments object for setting parameters.
        }
    });

});

And it turns out the thing that confuses the parser is the duration and easing parameters to basefx.anim, in fx.js:

basefx.anim = function( /*DOMNode|String*/  node,
                        /*Object*/          properties,
                        /*Integer?*/        duration,
                        /*Function?*/       easing,
                        /*Function?*/       onEnd,
                        /*Integer?*/        delay){

cc @cjolif

@wkeese
Copy link
Collaborator Author

wkeese commented Jul 17, 2012

I can work around the problem by not using a function() at all:

/*=====
var __HighlightCtorArgs = {
    // summary:
    //      Additional arguments for highlighting actions.
    // duration: Number?
    //      The amount of time in milliseconds for an animation to last.  Default is 400.
    // easing: dojo/fx/easing/*?
    //      An easing object (see dojo.fx.easing) for use in an animation.  The
    //      default is dojo.fx.easing.backOut.
    // highlight: String|dojo/_base/Color|Function?
    //      Either a color or a function that creates a color when highlighting happens.
};
=====*/

So probably we'll checkin that workaround, but you can reproduce the bug against [26295] of dojo.

@wkeese
Copy link
Collaborator Author

wkeese commented Jul 18, 2012

Probably http://bugs.dojotoolkit.org/ticket/12467 is the same problem, but we can't use the workaround above because it involves inheritance. Maybe using dojo.declare() would be a workaround.

@wkeese
Copy link
Collaborator Author

wkeese commented Jul 26, 2012

I worked around this by using declare() or a plain hash for all kwargs types.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant