Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: chrome/browser/resources/file_manager/audio_player/elements/volume_controller.js

Issue 144883002: [Files.app] Initial implementation of new audio player (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make the script/css files flattened. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 (function() {
6 'use strict';
7
8 Polymer('volume-controller', {
9 /**
10 * Initializes an element. This method is called automatically when the
11 * element is ready.
12 */
13 ready: function() {
14 this.style.width = this.width + 'px';
15 this.style.height = this.height + 'px';
16
17 this.$.rawValueInput.style.width = this.height + 'px';
18 this.$.rawValueInput.style.height = this.width + 'px';
19 this.$.rawValueInput.style.webkitTransformOrigin =
20 (this.width / 2) + 'px ' +
21 (this.width / 2 - 2) + 'px';
22
23 var barLeft = (this.width / 2 - 1);
24 this.$.bar.style.left = barLeft + 'px';
25 this.$.bar.style.right = barLeft + 'px';
26 },
27
28 /**
29 * Volume. 0 is silent, and 100 is maximum.
30 * @type {number}
31 */
32 value: 50,
33
34 /**
35 * Volume. 1000 is silent, and 0 is maximum.
36 * @type {number}
37 */
38 rawValue: 0,
39
40 /**
41 * Height of the element in pixels. Must be specified before ready() is
42 * called. Dynamic change is not supprted.
43 * @type {number}
44 */
45 height: 100,
46
47 /**
48 * Width of the element in pixels. Must be specified before ready() is
49 * called. Dynamic change is not supported.
50 * @type {number}
51 */
52 width: 32,
53
54 /**
55 * Invoked the 'value' property is changed.
56 * @param {number} oldValue Old value.
57 * @param {number} newValue New value.
58 */
59 valueChanged: function(oldValue, newValue) {
60 if (oldValue != newValue)
61 this.rawValue = 100 - newValue;
62 this.fire('changed');
63 },
64
65 /**
66 * Invoked the 'rawValue' property is changed.
67 * @param {number} oldValue Old value.
68 * @param {number} newValue New value.
69 */
70 rawValueChanged: function(oldValue, newValue) {
71 if (oldValue != newValue)
72 this.value = 100 - newValue;
73 },
74 });
75 })(); // Anonymous closure
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698