Mercurial > code > home > repos > light9
changeset 1611:826e295b6a75
faster updates on largerainbow. don't cover the 0.0 button
Ignore-this: ec49c10cf9f25b9b5d2e0cf1a35a1d1a
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 05 Jun 2017 09:57:18 +0000 |
parents | b0846845c772 |
children | 97e4f1b5ff19 |
files | light9/web/light9-color-picker.html |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/web/light9-color-picker.html Mon Jun 05 09:38:08 2017 +0000 +++ b/light9/web/light9-color-picker.html Mon Jun 05 09:57:18 2017 +0000 @@ -155,7 +155,7 @@ sliderWriteValue: { type: Number, notify: true }, }, observers: [ - 'updateSmall(color)', + 'readColor(color)', 'onValue(value)', 'writeColor(hueSatColor, value)' ], @@ -178,7 +178,12 @@ writeColor: function(hueSatColor, value) { this.color = one.color(hueSatColor).value(value / 255).hex(); }, - updateSmall: function(color) { + readColor: function(color) { + if (this.$.largeRainbowComp.style.display == 'block') { + // for performance, don't do color searches on covered widget + return; + } + // setting immediate-value doesn't work this.sliderWriteValue = one.color(color).value() * 255; @@ -198,7 +203,7 @@ let rect = this.$.smallRainbowComp.getBoundingClientRect(); document.body.append(large); large.style.position = 'fixed'; - large.style.left = (rect.left - 100) + 'px'; + large.style.left = (rect.left) + 'px'; large.style.top = (rect.top - 50) + 'px'; }, showLarge: function() { @@ -213,6 +218,7 @@ }, hideLarge: function() { this.$.largeRainbowComp.style.display = 'none'; + this.readColor(this.color); }, onEnterSmall: function() { // not if we just closed the large one