restore slider changes
This commit is contained in:
parent
1a84e71a95
commit
bbf0b4d402
2 changed files with 410 additions and 397 deletions
|
@ -103,7 +103,7 @@ Custom property | Description | Default
|
||||||
class="circle"
|
class="circle"
|
||||||
hidden$="[[!receivedFocusFromKeyboard]]">
|
hidden$="[[!receivedFocusFromKeyboard]]">
|
||||||
</paper-ripple>
|
</paper-ripple>
|
||||||
<div id="sliderKnobInner" value$="[[immediateValue]]"></div>
|
<div id="sliderKnobInner" value$="[[pinValue]]"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -311,6 +311,7 @@ Custom property | Description | Default
|
||||||
|
|
||||||
_positionKnob: function(ratio) {
|
_positionKnob: function(ratio) {
|
||||||
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
|
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
|
||||||
|
this._setPinValue(this.immediateValue);
|
||||||
this._setRatio(this._calcRatio(this.immediateValue));
|
this._setRatio(this._calcRatio(this.immediateValue));
|
||||||
|
|
||||||
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
|
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
|
||||||
|
@ -365,6 +366,7 @@ Custom property | Description | Default
|
||||||
// update knob's position
|
// update knob's position
|
||||||
var translateX = ((this._calcRatio(immediateValue) * this._w) - this._startx);
|
var translateX = ((this._calcRatio(immediateValue) * this._w) - this._startx);
|
||||||
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
|
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
|
||||||
|
this._setPinValue(immediateValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
_trackEnd: function() {
|
_trackEnd: function() {
|
||||||
|
@ -477,6 +479,9 @@ Custom property | Description | Default
|
||||||
this.decrement();
|
this.decrement();
|
||||||
}
|
}
|
||||||
this.fire('change');
|
this.fire('change');
|
||||||
|
},
|
||||||
|
_setPinValue: function (value) {
|
||||||
|
this.pinValue = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -16804,20 +16804,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(:not([disabled])) #sliderBar::shadow #activeProgress {
|
:host(:not([disabled])) #sliderBar {
|
||||||
background-color: var(--paper-slider-active-color, --google-blue-700);
|
--paper-progress-active-color: var(--paper-slider-active-color, --google-blue-700);
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(:not([disabled])) #sliderBar::shadow #secondaryProgress {
|
:host(:not([disabled])) #sliderBar {
|
||||||
background-color: var(--paper-slider-secondary-color, --google-blue-300);
|
--paper-progress-secondary-color: var(--paper-slider-secondary-color, --google-blue-300);
|
||||||
}
|
}
|
||||||
|
|
||||||
:host([disabled]) #sliderBar::shadow #activeProgress {
|
:host([disabled]) #sliderBar {
|
||||||
background-color: var(--paper-slider-disabled-active-color, --google-grey-500);
|
--paper-progress-active-color: var(--paper-slider-disabled-active-color, --google-grey-500);
|
||||||
}
|
}
|
||||||
|
|
||||||
:host([disabled]) #sliderBar::shadow #secondaryProgress {
|
:host([disabled]) #sliderBar {
|
||||||
background-color: var(--paper-slider-disabled-secondary-color, --google-grey-300);
|
--paper-progress-secondary-color: var(--paper-slider-disabled-secondary-color, --google-grey-300);
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(:focus) {
|
:host(:focus) {
|
||||||
|
@ -16901,11 +16901,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
background-color: black;
|
background-color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.transiting #sliderBar::shadow #activeProgress {
|
|
||||||
-webkit-transition: -webkit-transform 0.08s ease;
|
|
||||||
transition: transform 0.08s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sliderKnob {
|
#sliderKnob {
|
||||||
@apply(--layout-center-justified);
|
@apply(--layout-center-justified);
|
||||||
@apply(--layout-center);
|
@apply(--layout-center);
|
||||||
|
@ -16938,10 +16933,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
#sliderKnobInner {
|
#sliderKnobInner {
|
||||||
width: 12px;
|
width: 12px;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: var(--paper-slider-knob-color, --google-blue-700);
|
background-color: var(--paper-slider-knob-color, --google-blue-700);
|
||||||
|
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
transition-property: height, width, background-color, border;
|
transition-property: height, width, background-color, border;
|
||||||
transition-duration: 0.1s;
|
transition-duration: 0.1s;
|
||||||
transition-timing-function: ease;
|
transition-timing-function: ease;
|
||||||
|
@ -16950,13 +16947,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
.expand:not(.pin) > #sliderKnob > #sliderKnobInner {
|
.expand:not(.pin) > #sliderKnob > #sliderKnobInner {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
-webkit-transform: translateZ(0);
|
-webkit-transform: translateZ(0);
|
||||||
transform: translateZ(0);
|
transform: translateZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ring > #sliderKnob > #sliderKnobInner {
|
.ring > #sliderKnob > #sliderKnobInner {
|
||||||
background-color: transparent;
|
background-color: var(--paper-slider-knob-start-color, transparent);
|
||||||
border: 2px solid #c8c8c8;
|
border: 2px solid var(--paper-slider-knob-start-border-color, #c8c8c8);
|
||||||
}
|
}
|
||||||
|
|
||||||
#sliderKnobInner::before {
|
#sliderKnobInner::before {
|
||||||
|
@ -16972,6 +16970,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
height: 26px;
|
height: 26px;
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
border-radius: 50% 50% 50% 0;
|
border-radius: 50% 50% 50% 0;
|
||||||
|
|
||||||
-webkit-transform: rotate(-45deg) scale(0) translate(0);
|
-webkit-transform: rotate(-45deg) scale(0) translate(0);
|
||||||
transform: rotate(-45deg) scale(0) translate(0);
|
transform: rotate(-45deg) scale(0) translate(0);
|
||||||
}
|
}
|
||||||
|
@ -16983,7 +16982,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
}
|
}
|
||||||
|
|
||||||
.pin.ring > #sliderKnob > #sliderKnobInner::before {
|
.pin.ring > #sliderKnob > #sliderKnobInner::before {
|
||||||
background-color: #c8c8c8;
|
background-color: var(--paper-slider-pin-start-color, #c8c8c8);
|
||||||
}
|
}
|
||||||
|
|
||||||
.pin.expand > #sliderKnob > #sliderKnobInner::before {
|
.pin.expand > #sliderKnob > #sliderKnobInner::before {
|
||||||
|
@ -17001,6 +17000,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: var(--paper-slider-font-color, #fff);
|
color: var(--paper-slider-font-color, #fff);
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
|
||||||
-webkit-transform: scale(0) translate(0);
|
-webkit-transform: scale(0) translate(0);
|
||||||
transform: scale(0) translate(0);
|
transform: scale(0) translate(0);
|
||||||
}
|
}
|
||||||
|
@ -17017,9 +17017,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider-input::shadow input {
|
.slider-input {
|
||||||
/* FIXME(ffu): should one be able set text-align directly on paper-input? */
|
--paper-input-container-input: {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* disabled state */
|
/* disabled state */
|
||||||
|
@ -17047,7 +17048,7 @@ paper-ripple {
|
||||||
<div id="sliderContainer" class$="[[_getClassNames(disabled, pin, snaps, immediateValue, min, expand, dragging, transiting, editable)]]">
|
<div id="sliderContainer" class$="[[_getClassNames(disabled, pin, snaps, immediateValue, min, expand, dragging, transiting, editable)]]">
|
||||||
|
|
||||||
<div class="bar-container">
|
<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 class$="[[_getProgressClass(transiting)]]" 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>
|
</paper-progress>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -17060,13 +17061,14 @@ paper-ripple {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div id="sliderKnob" class="center-justified center horizontal layout" on-down="_knobdown" on-up="_resetKnob" on-track="_onTrack" on-transitionend="_knobTransitionEnd">
|
<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>
|
<paper-ripple center="" id="ink" class="circle" hidden$="[[!receivedFocusFromKeyboard]]">
|
||||||
|
</paper-ripple>
|
||||||
<div id="sliderKnobInner" value$="[[pinValue]]"></div>
|
<div id="sliderKnobInner" value$="[[pinValue]]"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template is="dom-if" if="[[editable]]">
|
<template is="dom-if" if="[[editable]]">
|
||||||
<paper-input id="input" class="slider-input" disabled$="[[disabled]]" on-change="_inputChange">
|
<paper-input id="input" class="slider-input" disabled$="[[disabled]]" on-change="_inputChange" value="[[_fixForInput(immediateValue)]]">
|
||||||
</paper-input>
|
</paper-input>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
@ -17079,9 +17081,8 @@ paper-ripple {
|
||||||
is: 'paper-slider',
|
is: 'paper-slider',
|
||||||
|
|
||||||
behaviors: [
|
behaviors: [
|
||||||
Polymer.IronA11yKeysBehavior,
|
|
||||||
Polymer.PaperInkyFocusBehavior,
|
|
||||||
Polymer.IronFormElementBehavior,
|
Polymer.IronFormElementBehavior,
|
||||||
|
Polymer.PaperInkyFocusBehavior,
|
||||||
Polymer.IronRangeBehavior
|
Polymer.IronRangeBehavior
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -17197,9 +17198,9 @@ paper-ripple {
|
||||||
|
|
||||||
ready: function() {
|
ready: function() {
|
||||||
// issue polymer/polymer#1305
|
// issue polymer/polymer#1305
|
||||||
|
|
||||||
this.async(function() {
|
this.async(function() {
|
||||||
this._updateKnob(this.value);
|
this._updateKnob(this.value);
|
||||||
this._updateInputValue();
|
|
||||||
}, 1);
|
}, 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -17242,17 +17243,15 @@ paper-ripple {
|
||||||
} else {
|
} else {
|
||||||
this.value = this.immediateValue;
|
this.value = this.immediateValue;
|
||||||
}
|
}
|
||||||
this._updateInputValue();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_secondaryProgressChanged: function() {
|
_secondaryProgressChanged: function() {
|
||||||
this.secondaryProgress = this._clampValue(this.secondaryProgress);
|
this.secondaryProgress = this._clampValue(this.secondaryProgress);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateInputValue: function () {
|
_fixForInput: function(immediateValue) {
|
||||||
if (this.editable) {
|
// paper-input/issues/114
|
||||||
this.$$('#input').value = this.immediateValue.toString();
|
return this.immediateValue.toString();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_expandKnob: function() {
|
_expandKnob: function() {
|
||||||
|
@ -17267,7 +17266,6 @@ paper-ripple {
|
||||||
_positionKnob: function(ratio) {
|
_positionKnob: function(ratio) {
|
||||||
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
|
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
|
||||||
this._setPinValue(this.immediateValue);
|
this._setPinValue(this.immediateValue);
|
||||||
|
|
||||||
this._setRatio(this._calcRatio(this.immediateValue));
|
this._setRatio(this._calcRatio(this.immediateValue));
|
||||||
|
|
||||||
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
|
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
|
||||||
|
@ -17283,6 +17281,7 @@ paper-ripple {
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTrack: function(event) {
|
_onTrack: function(event) {
|
||||||
|
event.stopPropagation();
|
||||||
switch (event.detail.state) {
|
switch (event.detail.state) {
|
||||||
case 'start':
|
case 'start':
|
||||||
this._trackStart(event);
|
this._trackStart(event);
|
||||||
|
@ -17317,11 +17316,11 @@ paper-ripple {
|
||||||
|
|
||||||
var immediateValue = this._calcStep(this._calcKnobPosition(this._x / this._w));
|
var immediateValue = this._calcStep(this._calcKnobPosition(this._x / this._w));
|
||||||
this._setImmediateValue(immediateValue);
|
this._setImmediateValue(immediateValue);
|
||||||
this._setPinValue(immediateValue);
|
|
||||||
|
|
||||||
// update knob's position
|
// update knob's position
|
||||||
var translateX = ((this._calcRatio(immediateValue) * this._w) - this._startx);
|
var translateX = ((this._calcRatio(immediateValue) * this._w) - this._startx);
|
||||||
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
|
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
|
||||||
|
this._setPinValue(immediateValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
_trackEnd: function() {
|
_trackEnd: function() {
|
||||||
|
@ -17341,7 +17340,7 @@ paper-ripple {
|
||||||
this._expandKnob();
|
this._expandKnob();
|
||||||
|
|
||||||
// cancel selection
|
// cancel selection
|
||||||
event.detail.sourceEvent.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// set the focus manually because we will called prevent default
|
// set the focus manually because we will called prevent default
|
||||||
this.focus();
|
this.focus();
|
||||||
|
@ -17372,7 +17371,7 @@ paper-ripple {
|
||||||
});
|
});
|
||||||
|
|
||||||
// cancel selection
|
// cancel selection
|
||||||
event.detail.sourceEvent.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
|
|
||||||
_knobTransitionEnd: function(event) {
|
_knobTransitionEnd: function(event) {
|
||||||
|
@ -17390,6 +17389,13 @@ paper-ripple {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_mergeClasses: function(classes) {
|
||||||
|
return Object.keys(classes).filter(
|
||||||
|
function(className) {
|
||||||
|
return classes[className];
|
||||||
|
}).join(' ');
|
||||||
|
},
|
||||||
|
|
||||||
_getClassNames: function() {
|
_getClassNames: function() {
|
||||||
var classes = {};
|
var classes = {};
|
||||||
|
|
||||||
|
@ -17402,10 +17408,13 @@ paper-ripple {
|
||||||
classes.transiting = this.transiting;
|
classes.transiting = this.transiting;
|
||||||
classes.editable = this.editable;
|
classes.editable = this.editable;
|
||||||
|
|
||||||
return Object.keys(classes).filter(
|
return this._mergeClasses(classes);
|
||||||
function (className) {
|
},
|
||||||
return classes[className];
|
|
||||||
}).join(' ');
|
_getProgressClass: function() {
|
||||||
|
return this._mergeClasses({
|
||||||
|
transiting: this.transiting
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_incrementKey: function(event) {
|
_incrementKey: function(event) {
|
||||||
|
@ -17425,7 +17434,6 @@ paper-ripple {
|
||||||
}
|
}
|
||||||
this.fire('change');
|
this.fire('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
_setPinValue: function (value) {
|
_setPinValue: function (value) {
|
||||||
this.pinValue = value;
|
this.pinValue = value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue