diff options
author | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:10 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:18 +0400 |
commit | 1354d17270961fff662d40f90521223f8fd0d73b (patch) | |
tree | e9266be71587e47c800303446e968a6d3565e2cf /lib/dojo/fx/Toggler.js.uncompressed.js | |
parent | d04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff) |
update dojo to 1.7.3
Diffstat (limited to 'lib/dojo/fx/Toggler.js.uncompressed.js')
-rw-r--r-- | lib/dojo/fx/Toggler.js.uncompressed.js | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/lib/dojo/fx/Toggler.js.uncompressed.js b/lib/dojo/fx/Toggler.js.uncompressed.js new file mode 100644 index 000000000..3e4891af2 --- /dev/null +++ b/lib/dojo/fx/Toggler.js.uncompressed.js @@ -0,0 +1,103 @@ +define("dojo/fx/Toggler", ["../_base/lang","../_base/declare","../_base/fx", "../_base/connect"], + function(lang, declare, baseFx, connectUtil) { + // module: + // dojo/fx/Toggler + // summary: + // TODOC + +return declare("dojo.fx.Toggler", null, { + // summary: + // A simple `dojo.Animation` toggler API. + // + // description: + // class constructor for an animation toggler. It accepts a packed + // set of arguments about what type of animation to use in each + // direction, duration, etc. All available members are mixed into + // these animations from the constructor (for example, `node`, + // `showDuration`, `hideDuration`). + // + // example: + // | var t = new dojo.fx.Toggler({ + // | node: "nodeId", + // | showDuration: 500, + // | // hideDuration will default to "200" + // | showFunc: dojo.fx.wipeIn, + // | // hideFunc will default to "fadeOut" + // | }); + // | t.show(100); // delay showing for 100ms + // | // ...time passes... + // | t.hide(); + + // node: DomNode + // the node to target for the showing and hiding animations + node: null, + + // showFunc: Function + // The function that returns the `dojo.Animation` to show the node + showFunc: baseFx.fadeIn, + + // hideFunc: Function + // The function that returns the `dojo.Animation` to hide the node + hideFunc: baseFx.fadeOut, + + // showDuration: + // Time in milliseconds to run the show Animation + showDuration: 200, + + // hideDuration: + // Time in milliseconds to run the hide Animation + hideDuration: 200, + + // FIXME: need a policy for where the toggler should "be" the next + // time show/hide are called if we're stopped somewhere in the + // middle. + // FIXME: also would be nice to specify individual showArgs/hideArgs mixed into + // each animation individually. + // FIXME: also would be nice to have events from the animations exposed/bridged + + /*===== + _showArgs: null, + _showAnim: null, + + _hideArgs: null, + _hideAnim: null, + + _isShowing: false, + _isHiding: false, + =====*/ + + constructor: function(args){ + var _t = this; + + lang.mixin(_t, args); + _t.node = args.node; + _t._showArgs = lang.mixin({}, args); + _t._showArgs.node = _t.node; + _t._showArgs.duration = _t.showDuration; + _t.showAnim = _t.showFunc(_t._showArgs); + + _t._hideArgs = lang.mixin({}, args); + _t._hideArgs.node = _t.node; + _t._hideArgs.duration = _t.hideDuration; + _t.hideAnim = _t.hideFunc(_t._hideArgs); + + connectUtil.connect(_t.showAnim, "beforeBegin", lang.hitch(_t.hideAnim, "stop", true)); + connectUtil.connect(_t.hideAnim, "beforeBegin", lang.hitch(_t.showAnim, "stop", true)); + }, + + show: function(delay){ + // summary: Toggle the node to showing + // delay: Integer? + // Ammount of time to stall playing the show animation + return this.showAnim.play(delay || 0); + }, + + hide: function(delay){ + // summary: Toggle the node to hidden + // delay: Integer? + // Ammount of time to stall playing the hide animation + return this.hideAnim.play(delay || 0); + } +}); + +}); |