diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-11-14 18:06:01 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-11-14 18:06:01 -0500 |
commit | 8207d8ece74782473cc7dd6d2e47259d6ae9e1b5 (patch) | |
tree | 08ab4cd9a3a61b569bd92c56c83726acf8f9490c /scripts/gui-common/widgets.js | |
parent | b0aa4a84e625f1e7d2aff5e76c447ad9a6437071 (diff) |
Fix color setting
Diffstat (limited to 'scripts/gui-common/widgets.js')
-rw-r--r-- | scripts/gui-common/widgets.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/gui-common/widgets.js b/scripts/gui-common/widgets.js index 0f92d08..66f8bfc 100644 --- a/scripts/gui-common/widgets.js +++ b/scripts/gui-common/widgets.js @@ -416,7 +416,8 @@ class WidgetSlider extends WidgetDragable { if (btns == 0) { - this.set(this.#tmpNum); + if (event.type == "mouseup") + this.set(this.#tmpNum); return; } @@ -608,7 +609,8 @@ class WidgetColorWheel extends WidgetDragable { if (btns == 0) { - this.set(this.#tmpColor); + if (event.type == "mouseup") + this.set(this.#tmpColor); return; } @@ -639,7 +641,13 @@ class WidgetColorWheel extends WidgetDragable #change () { this.#tmpColor = this.get(); - + + let m = this.#tmpColor.hsv_mag(); + let a = this.#tmpColor.hsv_angle(); + + this.element.style.setProperty("--detail", this.#tmpColor.rgb()); + this.element.style.setProperty("--pos-x", Math.cos(a) * m); + this.element.style.setProperty("--pos-y", Math.sin(a) * m); } update_detail(x, y, mag) |