diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-11-15 04:36:45 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-11-15 04:36:45 -0500 |
commit | e0c8f4e49d68c3f174b8877e91beff02565cfa2b (patch) | |
tree | 2476d19ef9b1b8eb47fefddc107d0baa8da6f2bd /scripts | |
parent | 266812564d7905212943f699cc439fcf21d85d26 (diff) |
Better color sliders
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/gui-common/widgets.js | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/scripts/gui-common/widgets.js b/scripts/gui-common/widgets.js index 3d9d004..4ac47fe 100644 --- a/scripts/gui-common/widgets.js +++ b/scripts/gui-common/widgets.js @@ -99,7 +99,7 @@ class Widget extends EventTarget{ if (event.type == "touchstart") this.element.classList.add("touch"); - else if (event.type == "touchend") + else if (event.type == "touchend" || event.type == "touchcancel") this.element.classList.remove("touch"); if (this.inactive) @@ -722,7 +722,7 @@ class WidgetColorTemp extends WidgetSlider out = this.ORANGE.interpolate(this.WHITE, percent / 0.7); else out = this.WHITE.interpolate(this.BLUE, (percent - 0.7) / 0.3); - el.style.setProperty("--detail", out.rgb()); + this.element.style.setProperty("--detail", out.rgb()); } } @@ -741,12 +741,6 @@ class WidgetColorLight extends WidgetSlider { super(1, 0, 0.01, 0, 1); this.element.classList.replace("slider", "color-light"); - - let fills = this.element.getElementsByClassName("fill"); - for(let f of fills) - { - f.remove(); - } this.setDetailUpdater(this.update_detail.bind(this)); this.set(0); @@ -761,7 +755,7 @@ class WidgetColorLight extends WidgetSlider update_detail(el, val, percent) { let out = this.BLACK.interpolate(this.WHITE, percent); - el.style.setProperty("--detail", out.rgb()); + this.element.style.setProperty("--detail", out.rgb()); } } |