diff options
author | Valerio Virgillito | 2012-02-02 00:11:51 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-02 15:33:42 -0800 |
commit | a3024011a91d3941f81481dd4d600e9684eb0fd4 (patch) | |
tree | 084b4856910f1db53973dd11617f7ffa03a6dd46 /node_modules/montage/ui/progress.reel | |
parent | 97255032921178bdfbc25512ddf3e0867e353f7a (diff) | |
download | ninja-a3024011a91d3941f81481dd4d600e9684eb0fd4.tar.gz |
upgrading to Montage v0.6
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/progress.reel')
-rwxr-xr-x | node_modules/montage/ui/progress.reel/progress.html | 8 | ||||
-rwxr-xr-x | node_modules/montage/ui/progress.reel/progress.js | 23 |
2 files changed, 15 insertions, 16 deletions
diff --git a/node_modules/montage/ui/progress.reel/progress.html b/node_modules/montage/ui/progress.reel/progress.html index 7f74edc4..025847e7 100755 --- a/node_modules/montage/ui/progress.reel/progress.html +++ b/node_modules/montage/ui/progress.reel/progress.html | |||
@@ -11,11 +11,11 @@ | |||
11 | <script type="text/montage-serialization"> | 11 | <script type="text/montage-serialization"> |
12 | { | 12 | { |
13 | "owner": { | 13 | "owner": { |
14 | "module": "montage/ui/progress.reel", | 14 | "module": "montage/ui/bluemoon/progress.reel", |
15 | "name": "Progress", | 15 | "name": "Progress", |
16 | "properties": { | 16 | "properties": { |
17 | "element": {"#": "progress"}, | 17 | "element": {"#": "progress"}, |
18 | "_barEl": {"#": "bar"} | 18 | "_barElement": {"#": "bar"} |
19 | } | 19 | } |
20 | } | 20 | } |
21 | } | 21 | } |
@@ -23,10 +23,10 @@ | |||
23 | 23 | ||
24 | </head> | 24 | </head> |
25 | <body> | 25 | <body> |
26 | 26 | ||
27 | <div id="progress" class="montage-progress"> | 27 | <div id="progress" class="montage-progress"> |
28 | <div id="bar" class="bar"></div> | 28 | <div id="bar" class="bar"></div> |
29 | </div> | 29 | </div> |
30 | 30 | ||
31 | </body> | 31 | </body> |
32 | </html> | 32 | </html> |
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 | } |