Changeset - 18d6bdd422f2
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 months ago 2023-05-29 18:48:00
drewp@bigasterisk.com
update after boost
1 file changed with 8 insertions and 3 deletions:
0 comments (0 inline, 0 general)
light9/web/light9-color-picker.ts
Show inline comments
 
@@ -60,24 +60,28 @@ export class Light9ColorPicker extends L
 
  update(changedProperties: PropertyValueMap<this>) {
 
    super.update(changedProperties);
 
    if (changedProperties.has("color")) {
 
      this.setColor(this.color);
 
    }
 
    if (changedProperties.has("value") || changedProperties.has("hueSatColor")) {
 
      this.color = color(this.hueSatColor)
 
        .value(this.value / 255)
 
        .hex();
 
      this.updateColorFromHSV();
 

	
 
      this.dispatchEvent(new CustomEvent("input", { detail: { value: this.color } }));
 

	
 
      this.swatchEl.then((sw) => {
 
        sw.style.borderColor = this.hueSatColor;
 
      });
 
    }
 
  }
 

	
 
  private updateColorFromHSV() {
 
    this.color = color(this.hueSatColor)
 
      .value(this.value / 255)
 
      .hex();
 
  }
 

	
 
  private onVSliderChange(ev: CustomEvent) {
 
    this.value = ev.detail.value;
 
  }
 

	
 
  // for outside users of the component
 
  setColor(col: string) {
 
@@ -90,12 +94,13 @@ export class Light9ColorPicker extends L
 
  }
 

	
 
  private startFloatingPick(ev: MouseEvent) {
 
    if (this.value < (20 as int8)) {
 
      log("boost");
 
      this.value = 255 as int8;
 
      this.updateColorFromHSV();
 
    }
 
    pickerFloat.startPick(new ClientCoord(ev.clientX, ev.clientY), this.color, (hsc: string) => {
 
      this.hueSatColor = hsc;
 
    });
 
  }
 
}
0 comments (0 inline, 0 general)