2 is: 'paper-toggle-button',
5 Polymer.PaperInkyFocusBehavior,
6 Polymer.IronCheckedElementBehavior
11 'aria-pressed': 'false',
17 * Fired when the checked state changes due to user interaction.
22 * Fired when the checked state changes.
36 // button-behavior hook
37 _buttonStateChanged: function() {
42 this.checked = this.active;
46 _ontrack: function(event) {
47 var track = event.detail;
48 if (track.state === 'start') {
49 this._trackStart(track);
50 } else if (track.state === 'track') {
51 this._trackMove(track);
52 } else if (track.state === 'end') {
53 this._trackEnd(track);
57 _trackStart: function(track) {
58 this._width = this.$.toggleBar.offsetWidth / 2;
60 * keep an track-only check state to keep the dragging behavior smooth
61 * while toggling activations
63 this._trackChecked = this.checked;
64 this.$.toggleButton.classList.add('dragging');
67 _trackMove: function(track) {
69 this._x = Math.min(this._width,
70 Math.max(0, this._trackChecked ? this._width + dx : dx));
71 this.translate3d(this._x + 'px', 0, 0, this.$.toggleButton);
72 this._userActivate(this._x > (this._width / 2));
75 _trackEnd: function(track) {
76 this.$.toggleButton.classList.remove('dragging');
77 this.transform('', this.$.toggleButton);