diff options
Diffstat (limited to 'node_modules/montage/ui/scroller.reel')
-rw-r--r-- | node_modules/montage/ui/scroller.reel/scroller.html | 55 | ||||
-rw-r--r-- | node_modules/montage/ui/scroller.reel/scroller.js | 268 |
2 files changed, 323 insertions, 0 deletions
diff --git a/node_modules/montage/ui/scroller.reel/scroller.html b/node_modules/montage/ui/scroller.reel/scroller.html new file mode 100644 index 00000000..00a85a88 --- /dev/null +++ b/node_modules/montage/ui/scroller.reel/scroller.html | |||
@@ -0,0 +1,55 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!-- <copyright> | ||
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
5 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
6 | </copyright> --> | ||
7 | <html> | ||
8 | <head> | ||
9 | <title></title> | ||
10 | <script type="text/montage-serialization"> | ||
11 | { | ||
12 | "scrollbars": { | ||
13 | "module": "montage/ui/scroll-bars.reel", | ||
14 | "name": "ScrollBars", | ||
15 | "properties": { | ||
16 | "element": { | ||
17 | "#": "scrollbars" | ||
18 | } | ||
19 | } | ||
20 | }, | ||
21 | "owner": { | ||
22 | "module": "montage/ui/scroller.reel", | ||
23 | "name": "Scroller", | ||
24 | "properties": { | ||
25 | "_content": { | ||
26 | "#": "content" | ||
27 | }, | ||
28 | "element": { | ||
29 | "#": "montage-scroller" | ||
30 | }, | ||
31 | "_scrollBars": { | ||
32 | "@": "scrollbars" | ||
33 | } | ||
34 | } | ||
35 | } | ||
36 | } | ||
37 | </script> | ||
38 | <style> | ||
39 | .montage-scroller { | ||
40 | position: relative; | ||
41 | display: block; | ||
42 | overflow: hidden; | ||
43 | } | ||
44 | .montage-scroller .content { | ||
45 | float: left; | ||
46 | } | ||
47 | </style> | ||
48 | </head> | ||
49 | <body> | ||
50 | <div id="montage-scroller" class="montage-scroller"> | ||
51 | <div id="scrollbars"></div> | ||
52 | <div id="content" class="content"></div> | ||
53 | </div> | ||
54 | </body> | ||
55 | </html> \ No newline at end of file | ||
diff --git a/node_modules/montage/ui/scroller.reel/scroller.js b/node_modules/montage/ui/scroller.reel/scroller.js new file mode 100644 index 00000000..01df7d9c --- /dev/null +++ b/node_modules/montage/ui/scroller.reel/scroller.js | |||
@@ -0,0 +1,268 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage").Montage, | ||
8 | Scroll = require("ui/scroll").Scroll, | ||
9 | Component = require("ui/component").Component; | ||
10 | |||
11 | var Scroller = exports.Scroller = Montage.create(Component, { | ||
12 | |||
13 | _scroll: { | ||
14 | enumerable: false, | ||
15 | value: null | ||
16 | }, | ||
17 | |||
18 | _scrollX: { | ||
19 | enumerable: false, | ||
20 | value: 0 | ||
21 | }, | ||
22 | |||
23 | scrollX: { | ||
24 | get: function () { | ||
25 | return this._scrollX; | ||
26 | }, | ||
27 | set: function (value) { | ||
28 | this._scrollX = value; | ||
29 | this.needsDraw = true; | ||
30 | } | ||
31 | }, | ||
32 | |||
33 | _scrollY: { | ||
34 | enumerable: false, | ||
35 | value: 0 | ||
36 | }, | ||
37 | |||
38 | scrollY: { | ||
39 | get: function () { | ||
40 | return this._scrollY; | ||
41 | }, | ||
42 | set: function (value) { | ||
43 | this._scrollY = value; | ||
44 | this.needsDraw = true; | ||
45 | } | ||
46 | }, | ||
47 | |||
48 | _axis: { | ||
49 | enumerable: false, | ||
50 | value: "auto" | ||
51 | }, | ||
52 | |||
53 | axis: { | ||
54 | get: function () { | ||
55 | return this._axis; | ||
56 | }, | ||
57 | set: function (value) { | ||
58 | this._axis = value; | ||
59 | this.needsDraw = true; | ||
60 | } | ||
61 | }, | ||
62 | |||
63 | _displayScrollbars: { | ||
64 | enumerable: false, | ||
65 | value: "auto" | ||
66 | }, | ||
67 | |||
68 | displayScrollbars: { | ||
69 | get: function () { | ||
70 | return this._displayScrollbars; | ||
71 | }, | ||
72 | set: function (value) { | ||
73 | switch (value) { | ||
74 | case "vertical": | ||
75 | case "horizontal": | ||
76 | case "both": | ||
77 | case "auto": | ||
78 | this._displayScrollbars = value; | ||
79 | break; | ||
80 | default: | ||
81 | this._displayScrollbars = "none"; | ||
82 | break; | ||
83 | } | ||
84 | this.needsDraw = true; | ||
85 | } | ||
86 | }, | ||
87 | |||
88 | _hasMomentum: { | ||
89 | enumerable: false, | ||
90 | value: true | ||
91 | }, | ||
92 | |||
93 | hasMomentum: { | ||
94 | get: function () { | ||
95 | return this._hasMomentum; | ||
96 | }, | ||
97 | set: function (value) { | ||
98 | this._hasMomentum = value; | ||
99 | } | ||
100 | }, | ||
101 | |||
102 | _hasBouncing: { | ||
103 | enumerable: false, | ||
104 | value: true | ||
105 | }, | ||
106 | |||
107 | hasBouncing: { | ||
108 | get: function () { | ||
109 | return this._hasBouncing; | ||
110 | }, | ||
111 | set: function (value) { | ||
112 | this._hasBouncing = value; | ||
113 | } | ||
114 | }, | ||
115 | |||
116 | _momentumDuration: { | ||
117 | enumerable: false, | ||
118 | value: 650 | ||
119 | }, | ||
120 | |||
121 | momentumDuration: { | ||
122 | get: function () { | ||
123 | return this._momentumDuration; | ||
124 | }, | ||
125 | set: function (value) { | ||
126 | this._momentumDuration = value; | ||
127 | } | ||
128 | }, | ||
129 | |||
130 | _bouncingDuration: { | ||
131 | enumerable: false, | ||
132 | value: 750 | ||
133 | }, | ||
134 | |||
135 | bouncingDuration: { | ||
136 | get: function () { | ||
137 | return this._bouncingDuration; | ||
138 | }, | ||
139 | set: function (value) { | ||
140 | this._bouncingDuration = value; | ||
141 | } | ||
142 | }, | ||
143 | |||
144 | _content: { | ||
145 | enumerable: false, | ||
146 | value: null | ||
147 | }, | ||
148 | |||
149 | templateDidLoad: { | ||
150 | value: function () { | ||
151 | var orphanedFragment, | ||
152 | currentContentRange = this.element.ownerDocument.createRange(); | ||
153 | |||
154 | currentContentRange.selectNodeContents(this.element); | ||
155 | orphanedFragment = currentContentRange.extractContents(); | ||
156 | this._content.appendChild(orphanedFragment); | ||
157 | } | ||
158 | }, | ||
159 | |||
160 | prepareForDraw: { | ||
161 | value: function () { | ||
162 | var self = this; | ||
163 | |||
164 | this._scroll = Montage.create(Scroll); | ||
165 | this._scroll.element = this._element; | ||
166 | this._scroll.component = this; | ||
167 | Object.defineBinding(this._scroll, "scrollX", {boundObject: this, boundObjectPropertyPath: "scrollX", oneway: false}); | ||
168 | Object.defineBinding(this._scroll, "scrollY", {boundObject: this, boundObjectPropertyPath: "scrollY", oneway: false}); | ||
169 | Object.defineBinding(this._scroll, "axis", {boundObject: this, boundObjectPropertyPath: "axis", oneway: false}); | ||
170 | Object.defineBinding(this._scroll, "hasBouncing", {boundObject: this, boundObjectPropertyPath: "hasBouncing", oneway: false}); | ||