diff --git a/ui/system/color_picker.js b/ui/system/color_picker.js index 2489730..db26582 100644 --- a/ui/system/color_picker.js +++ b/ui/system/color_picker.js @@ -207,29 +207,32 @@ export class ColorPicker extends LitElement { } // Event handlers for the picker areas - handleSLMouseDown(e) { + handleSLPointerDown(e) { this.dragging = "sl"; this.updateSL(e); - document.addEventListener("mousemove", this.handleMouseMove); - document.addEventListener("mouseup", this.handleMouseUp); + document.addEventListener("pointermove", this.handlePointerMove); + document.addEventListener("pointerup", this.handlePointerUp); } - handleHueMouseDown(e) { + handleHuePointerDown(e) { this.dragging = "hue"; this.updateHue(e); - document.addEventListener("mousemove", this.handleMouseMove); - document.addEventListener("mouseup", this.handleMouseUp); + document.addEventListener("pointermove", this.handlePointerMove); + document.addEventListener("pointerup", this.handlePointerUp); } - handleMouseMove = (e) => { - if (this.dragging === "sl") this.updateSL(e); - else if (this.dragging === "hue") this.updateHue(e); + handlePointerMove = (e) => { + if (this.dragging === "sl") { + this.updateSL(e); + } else if (this.dragging === "hue") { + this.updateHue(e); + } }; - handleMouseUp = () => { + handlePointerUp = () => { this.dragging = null; - document.removeEventListener("mousemove", this.handleMouseMove); - document.removeEventListener("mouseup", this.handleMouseUp); + document.removeEventListener("pointermove", this.handlePointerMove); + document.removeEventListener("pointerup", this.handlePointerUp); }; updateSL(e) { @@ -272,7 +275,9 @@ export class ColorPicker extends LitElement { handleHexInput(e) { let hex = e.target.value; - if (!hex.startsWith("#")) hex = "#" + hex; + if (!hex.startsWith("#")) { + hex = "#" + hex; + } if (/^#[0-9a-fA-F]{6}$/.test(hex)) { const rgb = this.hexToRgb(hex); if (rgb) { @@ -320,7 +325,7 @@ export class ColorPicker extends LitElement {