replace sliders
This commit is contained in:
parent
09d4af3357
commit
1b74dbdfbf
13 changed files with 1359 additions and 1439 deletions
|
@ -16368,7 +16368,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
|
|||
</script>
|
||||
<dom-module id="paper-slider" assetpath="bower_components/paper-slider/">
|
||||
|
||||
<style>
|
||||
<style>
|
||||
/**
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
|
@ -16629,414 +16629,414 @@ paper-ripple {
|
|||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div id="sliderContainer" class$="[[_getClassNames(disabled, pin, snaps, immediateValue, min, expand, dragging, transiting, editable)]]">
|
||||
<template>
|
||||
<div id="sliderContainer" class$="[[_getClassNames(disabled, pin, snaps, immediateValue, min, expand, dragging, transiting, editable)]]">
|
||||
|
||||
<div class="bar-container">
|
||||
<paper-progress id="sliderBar" aria-hidden="true" min="[[min]]" max="[[max]]" step="[[step]]" value="[[immediateValue]]" secondary-progress="[[secondaryProgress]]" on-down="_bardown" on-up="_resetKnob" on-track="_onTrack">
|
||||
</paper-progress>
|
||||
</div>
|
||||
<div class="bar-container">
|
||||
<paper-progress id="sliderBar" aria-hidden="true" min="[[min]]" max="[[max]]" step="[[step]]" value="[[immediateValue]]" secondary-progress="[[secondaryProgress]]" on-down="_bardown" on-up="_resetKnob" on-track="_onTrack">
|
||||
</paper-progress>
|
||||
</div>
|
||||
|
||||
<template is="dom-if" if="[[snaps]]">
|
||||
<div class="slider-markers horizontal layout">
|
||||
<template is="dom-repeat" items="[[markers]]">
|
||||
<div class="slider-marker flex"></div>
|
||||
</template>
|
||||
<template is="dom-if" if="[[snaps]]">
|
||||
<div class="slider-markers horizontal layout">
|
||||
<template is="dom-repeat" items="[[markers]]">
|
||||
<div class="slider-marker flex"></div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div id="sliderKnob" class="center-justified center horizontal layout" on-down="_knobdown" on-up="_resetKnob" on-track="_onTrack" on-transitionend="_knobTransitionEnd">
|
||||
<paper-ripple id="ink" class="circle" center="" hidden$="[[!receivedFocusFromKeyboard]]"></paper-ripple>
|
||||
<div id="sliderKnobInner" value$="[[pinValue]]"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div id="sliderKnob" class="center-justified center horizontal layout" on-down="_knobdown" on-up="_resetKnob" on-track="_onTrack" on-transitionend="_knobTransitionEnd">
|
||||
<paper-ripple id="ink" class="circle" center="" hidden$="[[!receivedFocusFromKeyboard]]"></paper-ripple>
|
||||
<div id="sliderKnobInner" value$="[[pinValue]]"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template is="dom-if" if="[[editable]]">
|
||||
<paper-input id="input" class="slider-input" disabled$="[[disabled]]" on-change="_inputChange">
|
||||
</paper-input>
|
||||
<template is="dom-if" if="[[editable]]">
|
||||
<paper-input id="input" class="slider-input" disabled$="[[disabled]]" on-change="_inputChange">
|
||||
</paper-input>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
|
||||
Polymer({
|
||||
is: 'paper-slider',
|
||||
Polymer({
|
||||
is: 'paper-slider',
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronA11yKeysBehavior,
|
||||
Polymer.PaperInkyFocusBehavior,
|
||||
Polymer.IronFormElementBehavior,
|
||||
Polymer.IronRangeBehavior
|
||||
],
|
||||
behaviors: [
|
||||
Polymer.IronA11yKeysBehavior,
|
||||
Polymer.PaperInkyFocusBehavior,
|
||||
Polymer.IronFormElementBehavior,
|
||||
Polymer.IronRangeBehavior
|
||||
],
|
||||
|
||||
properties: {
|
||||
properties: {
|
||||
|
||||
/**
|
||||
* If true, the slider thumb snaps to tick marks evenly spaced based
|
||||
* on the `step` property value.
|
||||
*/
|
||||
snaps: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
notify: true
|
||||
},
|
||||
/**
|
||||
* If true, the slider thumb snaps to tick marks evenly spaced based
|
||||
* on the `step` property value.
|
||||
*/
|
||||
snaps: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
notify: true
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, a pin with numeric value label is shown when the slider thumb
|
||||
* is pressed. Use for settings for which users need to know the exact
|
||||
* value of the setting.
|
||||
*/
|
||||
pin: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
notify: true
|
||||
},
|
||||
/**
|
||||
* If true, a pin with numeric value label is shown when the slider thumb
|
||||
* is pressed. Use for settings for which users need to know the exact
|
||||
* value of the setting.
|
||||
*/
|
||||
pin: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
notify: true
|
||||
},
|
||||
|
||||
/**
|
||||
* The number that represents the current secondary progress.
|
||||
*/
|
||||
secondaryProgress: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
notify: true,
|
||||
observer: '_secondaryProgressChanged'
|
||||
},
|
||||
/**
|
||||
* The number that represents the current secondary progress.
|
||||
*/
|
||||
secondaryProgress: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
notify: true,
|
||||
observer: '_secondaryProgressChanged'
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, an input is shown and user can use it to set the slider value.
|
||||
*/
|
||||
editable: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
/**
|
||||
* If true, an input is shown and user can use it to set the slider value.
|
||||
*/
|
||||
editable: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* The immediate value of the slider. This value is updated while the user
|
||||
* is dragging the slider.
|
||||
*/
|
||||
immediateValue: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
readOnly: true
|
||||
},
|
||||
/**
|
||||
* The immediate value of the slider. This value is updated while the user
|
||||
* is dragging the slider.
|
||||
*/
|
||||
immediateValue: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
readOnly: true
|
||||
},
|
||||
|
||||
/**
|
||||
* The maximum number of markers
|
||||
*/
|
||||
maxMarkers: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
notify: true,
|
||||
observer: '_maxMarkersChanged'
|
||||
},
|
||||
/**
|
||||
* The maximum number of markers
|
||||
*/
|
||||
maxMarkers: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
notify: true,
|
||||
observer: '_maxMarkersChanged'
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, the knob is expanded
|
||||
*/
|
||||
expand: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
readOnly: true
|
||||
},
|
||||
/**
|
||||
* If true, the knob is expanded
|
||||
*/
|
||||
expand: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
readOnly: true
|
||||
},
|
||||
|
||||
/**
|
||||
* True when the user is dragging the slider.
|
||||
*/
|
||||
dragging: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
readOnly: true
|
||||
},
|
||||
/**
|
||||
* True when the user is dragging the slider.
|
||||
*/
|
||||
dragging: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
readOnly: true
|
||||
},
|
||||
|
||||
transiting: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
readOnly: true
|
||||
},
|
||||
transiting: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
readOnly: true
|
||||
},
|
||||
|
||||
markers: {
|
||||
type: Array,
|
||||
readOnly: true,
|
||||
value: []
|
||||
},
|
||||
},
|
||||
markers: {
|
||||
type: Array,
|
||||
readOnly: true,
|
||||
value: []
|
||||
},
|
||||
},
|
||||
|
||||
observers: [
|
||||
'_updateKnob(value, min, max, snaps, step)',
|
||||
'_minChanged(min)',
|
||||
'_maxChanged(max)',
|
||||
'_valueChanged(value)',
|
||||
'_immediateValueChanged(immediateValue)'
|
||||
],
|
||||
observers: [
|
||||
'_updateKnob(value, min, max, snaps, step)',
|
||||
'_minChanged(min)',
|
||||
'_maxChanged(max)',
|
||||
'_valueChanged(value)',
|
||||
'_immediateValueChanged(immediateValue)'
|
||||
],
|
||||
|
||||
hostAttributes: {
|
||||
role: 'slider',
|
||||
tabindex: 0
|
||||
},
|
||||
hostAttributes: {
|
||||
role: 'slider',
|
||||
tabindex: 0
|
||||
},
|
||||
|
||||
keyBindings: {
|
||||
'left down pagedown home': '_decrementKey',
|
||||
'right up pageup end': '_incrementKey'
|
||||
},
|
||||
keyBindings: {
|
||||
'left down pagedown home': '_decrementKey',
|
||||
'right up pageup end': '_incrementKey'
|
||||
},
|
||||
|
||||
ready: function() {
|
||||
// issue polymer/polymer#1305
|
||||
this.async(function() {
|
||||
this._updateKnob(this.value);
|
||||
this._updateInputValue();
|
||||
}, 1);
|
||||
},
|
||||
ready: function () {
|
||||
// issue polymer/polymer#1305
|
||||
this.async(function () {
|
||||
this._updateKnob(this.value);
|
||||
this._updateInputValue();
|
||||
}, 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Increases value by `step` but not above `max`.
|
||||
* @method increment
|
||||
*/
|
||||
increment: function () {
|
||||
this.value = this._clampValue(this.value + this.step);
|
||||
},
|
||||
|
||||
/**
|
||||
* Decreases value by `step` but not below `min`.
|
||||
* @method decrement
|
||||
*/
|
||||
decrement: function () {
|
||||
this.value = this._clampValue(this.value - this.step);
|
||||
},
|
||||
|
||||
_updateKnob: function (value) {
|
||||
this._positionKnob(this._calcRatio(value));
|
||||
},
|
||||
|
||||
_minChanged: function () {
|
||||
this.setAttribute('aria-valuemin', this.min);
|
||||
},
|
||||
|
||||
_maxChanged: function () {
|
||||
this.setAttribute('aria-valuemax', this.max);
|
||||
},
|
||||
|
||||
_valueChanged: function () {
|
||||
this.setAttribute('aria-valuenow', this.value);
|
||||
this.fire('value-change');
|
||||
},
|
||||
|
||||
_immediateValueChanged: function () {
|
||||
if (this.dragging) {
|
||||
this.fire('immediate-value-change');
|
||||
} else {
|
||||
this.value = this.immediateValue;
|
||||
}
|
||||
this._updateInputValue();
|
||||
},
|
||||
|
||||
_secondaryProgressChanged: function () {
|
||||
this.secondaryProgress = this._clampValue(this.secondaryProgress);
|
||||
},
|
||||
|
||||
_updateInputValue: function () {
|
||||
if (this.editable) {
|
||||
this.$$('#input').value = this.immediateValue.toString();
|
||||
}
|
||||
},
|
||||
|
||||
_expandKnob: function () {
|
||||
this._setExpand(true);
|
||||
},
|
||||
|
||||
_resetKnob: function () {
|
||||
this.cancelDebouncer('expandKnob');
|
||||
this._setExpand(false);
|
||||
},
|
||||
|
||||
_positionKnob: function (ratio) {
|
||||
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
|
||||
this._setPinValue(this.immediateValue);
|
||||
|
||||
this._setRatio(this._calcRatio(this.immediateValue));
|
||||
|
||||
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
|
||||
},
|
||||
|
||||
_inputChange: function () {
|
||||
this.value = this.$$('#input').value;
|
||||
this.fire('change');
|
||||
},
|
||||
|
||||
_calcKnobPosition: function (ratio) {
|
||||
return (this.max - this.min) * ratio + this.min;
|
||||
},
|
||||
|
||||
_onTrack: function (event) {
|
||||
switch (event.detail.state) {
|
||||
case 'start':
|
||||
this._trackStart(event);
|
||||
break;
|
||||
case 'track':
|
||||
this._trackX(event);
|
||||
break;
|
||||
case 'end':
|
||||
this._trackEnd();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_trackStart: function (event) {
|
||||
this._w = this.$.sliderBar.offsetWidth;
|
||||
this._x = this.ratio * this._w;
|
||||
this._startx = this._x || 0;
|
||||
this._minx = -this._startx;
|
||||
this._maxx = this._w - this._startx;
|
||||
this.$.sliderKnob.classList.add('dragging');
|
||||
|
||||
this._setDragging(true);
|
||||
},
|
||||
|
||||
_trackX: function (e) {
|
||||
if (!this.dragging) {
|
||||
this._trackStart(e);
|
||||
}
|
||||
|
||||
var dx = Math.min(this._maxx, Math.max(this._minx, e.detail.dx));
|
||||
this._x = this._startx + dx;
|
||||
|
||||
var immediateValue = this._calcStep(this._calcKnobPosition(this._x / this._w));
|
||||
this._setImmediateValue(immediateValue);
|
||||
this._setPinValue(immediateValue);
|
||||
|
||||
// update knob's position
|
||||
var translateX = ((this._calcRatio(immediateValue) * this._w) - this._startx);
|
||||
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
|
||||
},
|
||||
|
||||
_trackEnd: function () {
|
||||
var s = this.$.sliderKnob.style;
|
||||
|
||||
this.$.sliderKnob.classList.remove('dragging');
|
||||
this._setDragging(false);
|
||||
this._resetKnob();
|
||||
this.value = this.immediateValue;
|
||||
|
||||
s.transform = s.webkitTransform = '';
|
||||
|
||||
this.fire('change');
|
||||
},
|
||||
|
||||
_knobdown: function (event) {
|
||||
this._expandKnob();
|
||||
|
||||
// cancel selection
|
||||
event.detail.sourceEvent.preventDefault();
|
||||
|
||||
// set the focus manually because we will called prevent default
|
||||
this.focus();
|
||||
},
|
||||
|
||||
_bardown: function (event) {
|
||||
this._w = this.$.sliderBar.offsetWidth;
|
||||
var rect = this.$.sliderBar.getBoundingClientRect();
|
||||
var ratio = (event.detail.x - rect.left) / this._w;
|
||||
var prevRatio = this.ratio;
|
||||
|
||||
this._setTransiting(true);
|
||||
|
||||
this._positionKnob(ratio);
|
||||
|
||||
this.debounce('expandKnob', this._expandKnob, 60);
|
||||
|
||||
// if the ratio doesn't change, sliderKnob's animation won't start
|
||||
// and `_knobTransitionEnd` won't be called
|
||||
// Therefore, we need to manually update the `transiting` state
|
||||
|
||||
if (prevRatio === this.ratio) {
|
||||
this._setTransiting(false);
|
||||
}
|
||||
|
||||
this.async(function () {
|
||||
this.fire('change');
|
||||
});
|
||||
|
||||
// cancel selection
|
||||
event.detail.sourceEvent.preventDefault();
|
||||
},
|
||||
|
||||
_knobTransitionEnd: function (event) {
|
||||
if (event.target === this.$.sliderKnob) {
|
||||
this._setTransiting(false);
|
||||
}
|
||||
},
|
||||
|
||||
_maxMarkersChanged: function (maxMarkers) {
|
||||
var l = (this.max - this.min) / this.step;
|
||||
if (!this.snaps && l > maxMarkers) {
|
||||
this._setMarkers([]);
|
||||
} else {
|
||||
this._setMarkers(new Array(l));
|
||||
}
|
||||
},
|
||||
|
||||
_getClassNames: function () {
|
||||
var classes = {};
|
||||
|
||||
classes.disabled = this.disabled;
|
||||
classes.pin = this.pin;
|
||||
classes.snaps = this.snaps;
|
||||
classes.ring = this.immediateValue <= this.min;
|
||||
classes.expand = this.expand;
|
||||
classes.dragging = this.dragging;
|
||||
classes.transiting = this.transiting;
|
||||
classes.editable = this.editable;
|
||||
|
||||
return Object.keys(classes).filter(
|
||||
function (className) {
|
||||
return classes[className];
|
||||
}).join(' ');
|
||||
},
|
||||
|
||||
_incrementKey: function (event) {
|
||||
if (event.detail.key === 'end') {
|
||||
this.value = this.max;
|
||||
} else {
|
||||
this.increment();
|
||||
}
|
||||
this.fire('change');
|
||||
},
|
||||
|
||||
_decrementKey: function (event) {
|
||||
if (event.detail.key === 'home') {
|
||||
this.value = this.min;
|
||||
} else {
|
||||
this.decrement();
|
||||
}
|
||||
this.fire('change');
|
||||
},
|
||||
|
||||
_setPinValue: function (value) {
|
||||
this.pinValue = value;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Increases value by `step` but not above `max`.
|
||||
* @method increment
|
||||
* Fired when the slider's value changes.
|
||||
*
|
||||
* @event value-change
|
||||
*/
|
||||
increment: function() {
|
||||
this.value = this._clampValue(this.value + this.step);
|
||||
},
|
||||
|
||||
/**
|
||||
* Decreases value by `step` but not below `min`.
|
||||
* @method decrement
|
||||
* Fired when the slider's immediateValue changes.
|
||||
*
|
||||
* @event immediate-value-change
|
||||
*/
|
||||
decrement: function() {
|
||||
this.value = this._clampValue(this.value - this.step);
|
||||
},
|
||||
|
||||
_updateKnob: function(value) {
|
||||
this._positionKnob(this._calcRatio(value));
|
||||
},
|
||||
|
||||
_minChanged: function() {
|
||||
this.setAttribute('aria-valuemin', this.min);
|
||||
},
|
||||
|
||||
_maxChanged: function() {
|
||||
this.setAttribute('aria-valuemax', this.max);
|
||||
},
|
||||
|
||||
_valueChanged: function() {
|
||||
this.setAttribute('aria-valuenow', this.value);
|
||||
this.fire('value-change');
|
||||
},
|
||||
|
||||
_immediateValueChanged: function() {
|
||||
if (this.dragging) {
|
||||
this.fire('immediate-value-change');
|
||||
} else {
|
||||
this.value = this.immediateValue;
|
||||
}
|
||||
this._updateInputValue();
|
||||
},
|
||||
|
||||
_secondaryProgressChanged: function() {
|
||||
this.secondaryProgress = this._clampValue(this.secondaryProgress);
|
||||
},
|
||||
|
||||
_updateInputValue: function() {
|
||||
if (this.editable) {
|
||||
this.$$('#input').value = this.immediateValue.toString();
|
||||
}
|
||||
},
|
||||
|
||||
_expandKnob: function() {
|
||||
this._setExpand(true);
|
||||
},
|
||||
|
||||
_resetKnob: function() {
|
||||
this.cancelDebouncer('expandKnob');
|
||||
this._setExpand(false);
|
||||
},
|
||||
|
||||
_positionKnob: function(ratio) {
|
||||
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
|
||||
this._setPinValue(this.immediateValue);
|
||||
|
||||
this._setRatio(this._calcRatio(this.immediateValue));
|
||||
|
||||
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
|
||||
},
|
||||
|
||||
_inputChange: function() {
|
||||
this.value = this.$$('#input').value;
|
||||
this.fire('change');
|
||||
},
|
||||
|
||||
_calcKnobPosition: function(ratio) {
|
||||
return (this.max - this.min) * ratio + this.min;
|
||||
},
|
||||
|
||||
_onTrack: function(event) {
|
||||
switch (event.detail.state) {
|
||||
case 'start':
|
||||
this._trackStart(event);
|
||||
break;
|
||||
case 'track':
|
||||
this._trackX(event);
|
||||
break;
|
||||
case 'end':
|
||||
this._trackEnd();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_trackStart: function(event) {
|
||||
this._w = this.$.sliderBar.offsetWidth;
|
||||
this._x = this.ratio * this._w;
|
||||
this._startx = this._x || 0;
|
||||
this._minx = - this._startx;
|
||||
this._maxx = this._w - this._startx;
|
||||
this.$.sliderKnob.classList.add('dragging');
|
||||
|
||||
this._setDragging(true);
|
||||
},
|
||||
|
||||
_trackX: function(e) {
|
||||
if (!this.dragging) {
|
||||
this._trackStart(e);
|
||||
}
|
||||
|
||||
var dx = Math.min(this._maxx, Math.max(this._minx, e.detail.dx));
|
||||
this._x = this._startx + dx;
|
||||
|
||||
var immediateValue = this._calcStep(this._calcKnobPosition(this._x / this._w));
|
||||
this._setImmediateValue(immediateValue);
|
||||
this._setPinValue(immediateValue);
|
||||
|
||||
// update knob's position
|
||||
var translateX = ((this._calcRatio(immediateValue) * this._w) - this._startx);
|
||||
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
|
||||
},
|
||||
|
||||
_trackEnd: function() {
|
||||
var s = this.$.sliderKnob.style;
|
||||
|
||||
this.$.sliderKnob.classList.remove('dragging');
|
||||
this._setDragging(false);
|
||||
this._resetKnob();
|
||||
this.value = this.immediateValue;
|
||||
|
||||
s.transform = s.webkitTransform = '';
|
||||
|
||||
this.fire('change');
|
||||
},
|
||||
|
||||
_knobdown: function(event) {
|
||||
this._expandKnob();
|
||||
|
||||
// cancel selection
|
||||
event.detail.sourceEvent.preventDefault();
|
||||
|
||||
// set the focus manually because we will called prevent default
|
||||
this.focus();
|
||||
},
|
||||
|
||||
_bardown: function(event) {
|
||||
this._w = this.$.sliderBar.offsetWidth;
|
||||
var rect = this.$.sliderBar.getBoundingClientRect();
|
||||
var ratio = (event.detail.x - rect.left) / this._w;
|
||||
var prevRatio = this.ratio;
|
||||
|
||||
this._setTransiting(true);
|
||||
|
||||
this._positionKnob(ratio);
|
||||
|
||||
this.debounce('expandKnob', this._expandKnob, 60);
|
||||
|
||||
// if the ratio doesn't change, sliderKnob's animation won't start
|
||||
// and `_knobTransitionEnd` won't be called
|
||||
// Therefore, we need to manually update the `transiting` state
|
||||
|
||||
if (prevRatio === this.ratio) {
|
||||
this._setTransiting(false);
|
||||
}
|
||||
|
||||
this.async(function() {
|
||||
this.fire('change');
|
||||
});
|
||||
|
||||
// cancel selection
|
||||
event.detail.sourceEvent.preventDefault();
|
||||
},
|
||||
|
||||
_knobTransitionEnd: function(event) {
|
||||
if (event.target === this.$.sliderKnob) {
|
||||
this._setTransiting(false);
|
||||
}
|
||||
},
|
||||
|
||||
_maxMarkersChanged: function(maxMarkers) {
|
||||
var l = (this.max - this.min) / this.step;
|
||||
if (!this.snaps && l > maxMarkers) {
|
||||
this._setMarkers([]);
|
||||
} else {
|
||||
this._setMarkers(new Array(l));
|
||||
}
|
||||
},
|
||||
|
||||
_getClassNames: function() {
|
||||
var classes = {};
|
||||
|
||||
classes.disabled = this.disabled;
|
||||
classes.pin = this.pin;
|
||||
classes.snaps = this.snaps;
|
||||
classes.ring = this.immediateValue <= this.min;
|
||||
classes.expand = this.expand;
|
||||
classes.dragging = this.dragging;
|
||||
classes.transiting = this.transiting;
|
||||
classes.editable = this.editable;
|
||||
|
||||
return Object.keys(classes).filter(
|
||||
function(className) {
|
||||
return classes[className];
|
||||
}).join(' ');
|
||||
},
|
||||
|
||||
_incrementKey: function(event) {
|
||||
if (event.detail.key === 'end') {
|
||||
this.value = this.max;
|
||||
} else {
|
||||
this.increment();
|
||||
}
|
||||
this.fire('change');
|
||||
},
|
||||
|
||||
_decrementKey: function(event) {
|
||||
if (event.detail.key === 'home') {
|
||||
this.value = this.min;
|
||||
} else {
|
||||
this.decrement();
|
||||
}
|
||||
this.fire('change');
|
||||
},
|
||||
|
||||
_setPinValue: function (value) {
|
||||
this.pinValue = value;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Fired when the slider's value changes.
|
||||
*
|
||||
* @event value-change
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the slider's immediateValue changes.
|
||||
*
|
||||
* @event immediate-value-change
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the slider's value changes due to user interaction.
|
||||
*
|
||||
* Changes to the slider's value due to changes in an underlying
|
||||
* bound variable will not trigger this event.
|
||||
*
|
||||
* @event change
|
||||
*/
|
||||
/**
|
||||
* Fired when the slider's value changes due to user interaction.
|
||||
*
|
||||
* Changes to the slider's value due to changes in an underlying
|
||||
* bound variable will not trigger this event.
|
||||
*
|
||||
* @event change
|
||||
*/
|
||||
|
||||
</script>
|
||||
<iron-iconset-svg name="icons" size="24">
|
||||
|
@ -17112,6 +17112,7 @@ paper-ripple {
|
|||
<g id="keyboard-arrow-left"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"></path></g>
|
||||
<g id="keyboard-arrow-right"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"></path></g>
|
||||
<g id="keyboard-arrow-up"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path></g>
|
||||
<g id="queue-music"><path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"></path></g>
|
||||
</defs>
|
||||
</svg>
|
||||
</iron-iconset-svg>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue