mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 18:56:39 +00:00
Fix input_Slider pt2 (#190)
This commit is contained in:
parent
fa68419f77
commit
8d62654e4f
@ -45,9 +45,11 @@ Polymer({
|
|||||||
},
|
},
|
||||||
min: {
|
min: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
value: 0,
|
||||||
},
|
},
|
||||||
max: {
|
max: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
value: 100,
|
||||||
},
|
},
|
||||||
step: {
|
step: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@ -59,8 +61,20 @@ Polymer({
|
|||||||
|
|
||||||
stateObjectChanged: function (newVal) {
|
stateObjectChanged: function (newVal) {
|
||||||
this.value = Number(newVal.state);
|
this.value = Number(newVal.state);
|
||||||
this.max = Number(newVal.attributes.max);
|
var min = Number(newVal.attributes.min);
|
||||||
this.min = Number(newVal.attributes.min);
|
var max = Number(newVal.attributes.max);
|
||||||
|
|
||||||
|
// Polymer doesn't batch attribute updates
|
||||||
|
// And input_slider blows up when min > max.
|
||||||
|
|
||||||
|
if (max <= this.min) {
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
|
} else {
|
||||||
|
this.max = max;
|
||||||
|
this.min = min;
|
||||||
|
}
|
||||||
|
|
||||||
this.step = Number(newVal.attributes.step);
|
this.step = Number(newVal.attributes.step);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user