diff options
author | Valerio Virgillito | 2012-02-02 00:11:51 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-02 00:11:51 -0800 |
commit | 5a305ec44b2bd5198a248357439aae8ebbd75fee (patch) | |
tree | ec3b756beab7105841353ef79d4e8059b2b6a91c /node_modules/montage/ui/progress.reel/progress.js | |
parent | dbe9c7705860fb3551321e23e7eab763f622241c (diff) | |
download | ninja-5a305ec44b2bd5198a248357439aae8ebbd75fee.tar.gz |
upgrading to Montage v0.6
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/progress.reel/progress.js')
-rwxr-xr-x | node_modules/montage/ui/progress.reel/progress.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/node_modules/montage/ui/progress.reel/progress.js b/node_modules/montage/ui/progress.reel/progress.js index 656e38ec..8bc68b05 100755 --- a/node_modules/montage/ui/progress.reel/progress.js +++ b/node_modules/montage/ui/progress.reel/progress.js | |||
@@ -4,7 +4,7 @@ | |||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | /** | 6 | /** |
7 | @module "montage/ui/progress.reel" | 7 | @module "montage/ui/bluemoon/progress.reel" |
8 | @requires montage/core/core | 8 | @requires montage/core/core |
9 | @requires montage/ui/component | 9 | @requires montage/ui/component |
10 | */ | 10 | */ |
@@ -14,12 +14,12 @@ var Montage = require("montage").Montage, | |||
14 | @class module:montage/ui/progress.Progress | 14 | @class module:montage/ui/progress.Progress |
15 | @extends module:montage/ui/component.Component | 15 | @extends module:montage/ui/component.Component |
16 | */ | 16 | */ |
17 | exports.Progress = Montage.create(Component,/** @lends module:"montage/ui/progress.reel".Progress# */ { | 17 | exports.Progress = Montage.create(Component,/** @lends module:"montage/ui/bluemoon/progress.reel".Progress# */ { |
18 | /** | 18 | /** |
19 | Description TODO | 19 | Description TODO |
20 | @private | 20 | @private |
21 | */ | 21 | */ |
22 | _barEl: { | 22 | _barElement: { |
23 | enumerable: false, | 23 | enumerable: false, |
24 | value: null | 24 | value: null |
25 | }, | 25 | }, |
@@ -120,18 +120,17 @@ exports.Progress = Montage.create(Component,/** @lends module:"montage/ui/progre | |||
120 | draw: { | 120 | draw: { |
121 | enumerable: false, | 121 | enumerable: false, |
122 | value: function() { | 122 | value: function() { |
123 | var percentage = (this._value / this._maximumValue) * 100; | 123 | var ratio = this._value / this._maximumValue; |
124 | if(percentage > 100) { | 124 | // constrain to interval [0, 1] |
125 | this._barEl.style.width = "100%"; | 125 | ratio = Math.min(Math.max(ratio, 0), 1); |
126 | } else { | 126 | // map into [0, 100] |
127 | this._barEl.style.width = percentage + '%'; | 127 | var percentage = ratio * 100; |
128 | } | 128 | this._barElement.style.width = percentage + '%'; |
129 | |||
130 | if(this._scrollingChanged) { | 129 | if(this._scrollingChanged) { |
131 | if(this._scrolling) { | 130 | if(this._scrolling) { |
132 | this._barEl.classList.add("scrolling"); | 131 | this._barElement.classList.add("scrolling"); |
133 | } else { | 132 | } else { |
134 | this._barEl.classList.remove("scrolling"); | 133 | this._barElement.classList.remove("scrolling"); |
135 | } | 134 | } |
136 | this._scrollingChanged = false; | 135 | this._scrollingChanged = false; |
137 | } | 136 | } |