Changeset - c97c0ac03597
[Not reviewed]
default
0 1 0
Drew Perttula - 7 years ago 2018-06-07 23:04:26
drewp@bigasterisk.com
ok to edit a color by value only
Ignore-this: fcda3510bf9c8bd49c3fb1cf92d5b3c4
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
light9/web/light9-color-picker.html
Show inline comments
 
@@ -232,48 +232,51 @@
 
       if (!window.pickerCanvases) {
 
         window.pickerCanvases = {
 
           large: new RainbowCanvas(
 
             '/colorpick_rainbow_large.png', [400, 200]),
 
           small: new RainbowCanvas(
 
             '/colorpick_rainbow_small.png', [150, 30]),
 
         };
 
       }
 
       this.large = window.pickerCanvases.large;
 
       this.small = window.pickerCanvases.small;
 
       this.small.onLoad(function() {
 
         // color may have been set before our image came
 
         this._updateSmallCrosshair();
 
       }.bind(this));
 
       this.$.large.onCanvasMove = this.onCanvasMove.bind(this);
 
       this.$.large.hideLarge = this.hideLarge.bind(this);
 
       document.body.append(this.$.large);
 
       this.$.large.style.display = 'none';
 
     }
 
     disconnectedCallback() {
 
       super.disconnectedCallback();
 
       document.body.removeChild(this.$.large);
 
     }
 
     onValue(value) {
 
       if (this.hueSatColor === null) {
 
         this.hueSatColor = '#ffffff';
 
       }
 
       let neverBlack = .1 + .9 * value / 255;
 
       this.$.smallRainbow.style.filter = `brightness(${neverBlack})`;
 
     }
 
     writeColor(hueSatColor, value) {
 
       if (hueSatColor === null || this.pauseWrites) { return; }
 
       this.color = one.color(hueSatColor).value(value / 255).hex();
 
     }
 
     readColor(color) {
 
       if (this.$.large.style.display == 'block') {
 
         // for performance, don't do color searches on covered widget
 
         return;
 
       }
 

	
 
       this.pauseWrites = true;
 
       var colorValue = one.color(color).value() * 255;
 
       // writing back to immediate-value doesn't work on paper-slider
 
       this.sliderWriteValue = colorValue;
 

	
 
       // don't update this if only the value changed, or we desaturate
 
       this.hueSatColor = one.color(color).value(1).hex();
 

	
 
       this._updateSmallCrosshair();
 
       this.pauseWrites = false;
 
     }
0 comments (0 inline, 0 general)