Make sure colorpicker is always drawn

This commit is contained in:
Paulus Schoutsen 2016-02-10 22:15:17 -08:00
parent cac1953eb6
commit 77a2f3ace3
2 changed files with 9 additions and 9 deletions

View File

@ -98,12 +98,12 @@ export default new Polymer({
this.context = this.canvas.getContext('2d'); this.context = this.canvas.getContext('2d');
this.debounce('drawGradient', () => { this.debounce('drawGradient', () => {
const style = getComputedStyle(this); let style;
const width = parseInt(style.width, 10); if (!this.width || !this.height) {
const height = parseInt(style.height, 10); style = getComputedStyle(this);
}
this.width = width; const width = this.width || parseInt(style.width, 10);
this.height = height; const height = this.height || parseInt(style.height, 10);
const colorGradient = this.context.createLinearGradient(0, 0, width, 0); const colorGradient = this.context.createLinearGradient(0, 0, width, 0);
colorGradient.addColorStop(0, 'rgb(255,0,0)'); colorGradient.addColorStop(0, 'rgb(255,0,0)');

View File

@ -21,7 +21,7 @@
max-height: 0px; max-height: 0px;
overflow: hidden; overflow: hidden;
transition: max-height .5s ease-in; transition: max-height .2s ease-in;
} }
.has-brightness .brightness { .has-brightness .brightness {
@ -33,7 +33,7 @@
} }
.has-rgb_color ha-color-picker { .has-rgb_color ha-color-picker {
max-height: 500px; max-height: 200px;
} }
</style> </style>
<template> <template>
@ -53,7 +53,7 @@
</paper-slider> </paper-slider>
</div> </div>
<ha-color-picker on-colorselected='colorPicked'> <ha-color-picker on-colorselected='colorPicked' height='200'>
</ha-color-picker> </ha-color-picker>
</div> </div>
</template> </template>