import {InputElement} from "./InputElement"; import {UIEventSource} from "../../Logic/UIEventSource"; export default class ColorPicker extends InputElement { private readonly value: UIEventSource private readonly _element : HTMLElement constructor( value: UIEventSource = new UIEventSource(undefined) ) { super(); this.value = value ; const el = document.createElement("input") this._element = el; el.type = "color" this.value.addCallbackAndRun(v => { if(v === undefined){ return; } el.value =v }); el.oninput = () => { const hex = el.value; value.setData(hex); } } protected InnerConstructElement(): HTMLElement { return this._element; } GetValue(): UIEventSource { return this.value; } IsSelected: UIEventSource = new UIEventSource(false); IsValid(t: string): boolean { return false; } }