source: Dev/trunk/src/client/dojox/widget/rotator/Slide.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 1.7 KB
Line 
1define([
2        "dojo/_base/lang",
3        "dojo/_base/fx",
4        "dojo/dom-style"
5], function(lang, baseFx, domStyle){
6
7        // Constants used to identify which edge the pane slides in from.
8        var DOWN = 0,
9                RIGHT = 1,
10                UP = 2,
11                LEFT = 3;
12
13        function _slide(/*int*/type, /*Object*/args){
14                // summary:
15                //              Handles the preparation of the dom node and creates the dojo.Animation object.
16                var node = args.node = args.next.node,
17                        r = args.rotatorBox,
18                        m = type % 2,
19                        s = (m ? r.w : r.h) * (type < 2 ? -1 : 1);
20
21                domStyle.set(node, {
22                        display: "",
23                        zIndex: (domStyle.get(args.current.node, "zIndex") || 1) + 1
24                });
25
26                if(!args.properties){
27                        args.properties = {};
28                }
29                args.properties[m ? "left" : "top"] = {
30                        start: s,
31                        end: 0
32                };
33
34                return baseFx.animateProperty(args); /*dojo.Animation*/
35        }
36
37        var exports = {
38                slideDown: function(/*Object*/args){
39                        // summary:
40                        //              Returns a dojo.Animation that slides in the next rotator pane from the top.
41                        return _slide(DOWN, args); /*dojo.Animation*/
42                },
43
44                slideRight: function(/*Object*/args){
45                        // summary:
46                        //              Returns a dojo.Animation that slides in the next rotator pane from the right.
47                        return _slide(RIGHT, args); /*dojo.Animation*/
48                },
49
50                slideUp: function(/*Object*/args){
51                        // summary:
52                        //              Returns a dojo.Animation that slides in the next rotator pane from the bottom.
53                        return _slide(UP, args); /*dojo.Animation*/
54                },
55
56                slideLeft: function(/*Object*/args){
57                        // summary:
58                        //              Returns a dojo.Animation that slides in the next rotator pane from the left.
59                        return _slide(LEFT, args); /*dojo.Animation*/
60                }
61        };
62
63        // back-compat, remove for 2.0
64        lang.mixin(lang.getObject("dojox.widget.rotator"), exports);
65
66        return exports;
67});
Note: See TracBrowser for help on using the repository browser.