diff options
author | Valerio Virgillito | 2012-03-08 13:56:09 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-03-08 13:56:09 -0800 |
commit | 22a66cb6e243a3f1c867b62e3942fd2e828019d9 (patch) | |
tree | 4b2f8bf0d8306964f35435dac3d1f6592b3dee19 /node_modules/montage/ui/scroller.reel | |
parent | cef07085443b7c31e878daaad083b7408c57e104 (diff) | |
download | ninja-22a66cb6e243a3f1c867b62e3942fd2e828019d9.tar.gz |
integrating v0.7 montage into ninja
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/scroller.reel')
-rw-r--r-- | node_modules/montage/ui/scroller.reel/scroller.html | 1 | ||||
-rw-r--r-- | node_modules/montage/ui/scroller.reel/scroller.js | 36 |
2 files changed, 16 insertions, 21 deletions
diff --git a/node_modules/montage/ui/scroller.reel/scroller.html b/node_modules/montage/ui/scroller.reel/scroller.html index 34e4bc0a..656db110 100644 --- a/node_modules/montage/ui/scroller.reel/scroller.html +++ b/node_modules/montage/ui/scroller.reel/scroller.html | |||
@@ -100,6 +100,7 @@ | |||
100 | } | 100 | } |
101 | .montage-scroller .content { | 101 | .montage-scroller .content { |
102 | float: left; | 102 | float: left; |
103 | width: 100%; | ||
103 | } | 104 | } |
104 | </style> | 105 | </style> |
105 | </head> | 106 | </head> |
diff --git a/node_modules/montage/ui/scroller.reel/scroller.js b/node_modules/montage/ui/scroller.reel/scroller.js index 2dfff059..b578807e 100644 --- a/node_modules/montage/ui/scroller.reel/scroller.js +++ b/node_modules/montage/ui/scroller.reel/scroller.js | |||
@@ -126,7 +126,10 @@ exports.Scroller = Montage.create(Component, { | |||
126 | return this._momentumDuration; | 126 | return this._momentumDuration; |
127 | }, | 127 | }, |
128 | set: function (value) { | 128 | set: function (value) { |
129 | this._momentumDuration = value; | 129 | this._momentumDuration = isNaN(parseInt(value, 10)) ? 1 : parseInt(value, 10); |
130 | if (this._momentumDuration < 1) { | ||
131 | this._momentumDuration = 1; | ||
132 | } | ||
130 | } | 133 | } |
131 | }, | 134 | }, |
132 | 135 | ||
@@ -140,7 +143,10 @@ exports.Scroller = Montage.create(Component, { | |||
140 | return this._bouncingDuration; | 143 | return this._bouncingDuration; |
141 | }, | 144 | }, |
142 | set: function (value) { | 145 | set: function (value) { |
143 | this._bouncingDuration = value; | 146 | this._bouncingDuration = isNaN(parseInt(value, 10)) ? 1 : parseInt(value, 10); |
147 | if (this._bouncingDuration < 1) { | ||
148 | this._bouncingDuration = 1; | ||
149 | } | ||
144 | } | 150 | } |
145 | }, | 151 | }, |
146 | 152 | ||
@@ -162,7 +168,7 @@ exports.Scroller = Montage.create(Component, { | |||
162 | 168 | ||
163 | handleTranslateStart: { | 169 | handleTranslateStart: { |
164 | value: function(event) { | 170 | value: function(event) { |
165 | this._scrollBars.opacity = .5; | 171 | this._scrollBars.opacity = 0.5; |
166 | } | 172 | } |
167 | }, | 173 | }, |
168 | 174 | ||
@@ -179,9 +185,10 @@ exports.Scroller = Montage.create(Component, { | |||
179 | this._top = this._element.offsetTop; | 185 | this._top = this._element.offsetTop; |
180 | this._width = this._element.offsetWidth; | 186 | this._width = this._element.offsetWidth; |
181 | this._height = this._element.offsetHeight; | 187 | this._height = this._element.offsetHeight; |
188 | |||
182 | this._maxTranslateX = this._content.scrollWidth - this._width; | 189 | this._maxTranslateX = this._content.scrollWidth - this._width; |
183 | if (this._maxTranslateX < 0) { | 190 | if (this._maxTranslateX < 0) { |
184 | this._.maxTranslateX = 0; | 191 | this._maxTranslateX = 0; |
185 | } | 192 | } |
186 | this._maxTranslateY = this._content.offsetHeight - this._height; | 193 | this._maxTranslateY = this._content.offsetHeight - this._height; |
187 | if (this._maxTranslateY < 0) { | 194 | if (this._maxTranslateY < 0) { |
@@ -192,6 +199,7 @@ exports.Scroller = Montage.create(Component, { | |||
192 | this._maxTranslateX = delegateValue.x; | 199 | this._maxTranslateX = delegateValue.x; |
193 | this._maxTranslateY = delegateValue.y; | 200 | this._maxTranslateY = delegateValue.y; |
194 | } | 201 | } |
202 | |||
195 | switch (this._displayScrollbars) { | 203 | switch (this._displayScrollbars) { |
196 | case "horizontal": | 204 | case "horizontal": |
197 | this._scrollBars.displayHorizontal = true; | 205 | this._scrollBars.displayHorizontal = true; |
@@ -206,23 +214,9 @@ exports.Scroller = Montage.create(Component, { | |||
206 | this._scrollBars.displayVertical = true; | 214 | this._scrollBars.displayVertical = true; |
207 | break; | 215 | break; |
208 | case "auto": | 216 | case "auto": |
209 | if (this._maxTranslateX && this._maxTranslateY) { | 217 | // Only display the scroll bars if we can scroll in that direction |
210 | this._scrollBars.displayHorizontal = true; | 218 | this._scrollBars.displayHorizontal = !!this._maxTranslateX; |
211 | this._scrollBars.displayVertical = true; | 219 | this._scrollBars.displayVertical = !!this._maxTranslateY; |
212 | } else { | ||
213 | if (this._maxTranslateX) { | ||
214 | this._scrollBars.displayHorizontal = true; | ||
215 | this._scrollBars.displayVertical = false; | ||
216 | } else { | ||
217 | if (this._maxTranslateY) { | ||
218 | this._scrollBars.displayHorizontal = false; | ||
219 | this._scrollBars.displayVertical = true; | ||
220 | } else { | ||
221 | this._scrollBars.displayHorizontal = false; | ||
222 | this._scrollBars.displayVertical = false; | ||
223 | } | ||
224 | } | ||
225 | } | ||
226 | break; | 220 | break; |
227 | case "none": | 221 | case "none": |
228 | this._scrollBars.displayHorizontal = false; | 222 | this._scrollBars.displayHorizontal = false; |