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

Side by Side Diff: third_party/polymer/components-chromium/paper-toggle-button/paper-toggle-button-extracted.js

Issue 592593002: Inline scripts were extracted from Polymer elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/echo ""/echo/ Created 6 years, 2 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
OLDNEW
(Empty)
1
2
3 Polymer('paper-toggle-button', {
4
5 /**
6 * Fired when the checked state changes.
7 *
8 * @event change
9 */
10
11 /**
12 * Gets or sets the state, `true` is checked and `false` is unchecked.
13 *
14 * @attribute checked
15 * @type boolean
16 * @default false
17 */
18 checked: false,
19
20 trackStart: function(e) {
21 this._w = this.$.toggleBar.offsetLeft + this.$.toggleBar.offsetWidth;
22 e.preventTap();
23 },
24
25 trackx: function(e) {
26 this._x = Math.min(this._w,
27 Math.max(0, this.checked ? this._w + e.dx : e.dx));
28 this.$.toggleRadio.classList.add('dragging');
29 var s = this.$.toggleRadio.style;
30 s.webkitTransform = s.transform = 'translate3d(' + this._x + 'px,0,0)';
31 },
32
33 trackEnd: function() {
34 var s = this.$.toggleRadio.style;
35 s.webkitTransform = s.transform = null;
36 this.$.toggleRadio.classList.remove('dragging');
37 this.checked = Math.abs(this._x) > this._w / 2;
38 },
39
40 checkedChanged: function() {
41 this.setAttribute('aria-pressed', Boolean(this.checked));
42 this.fire('change');
43 }
44
45 });
46
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698