Make color wheel picker draggable

pull/12/head
catboxanon 2023-09-12 12:05:41 -04:00
parent 21ee72007b
commit a7eaa3a54a
1 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,10 @@
function registerPicker(wheel, sliders) {
wheel.onclick = function (e) {
wheel.onmousemove = function (e) {
e.preventDefault();
if (e.buttons != 1) {
return;
}
const rect = e.target.getBoundingClientRect();
var x = ((e.clientX - rect.left) - 100.0) / 25;
var y = ((e.clientY - rect.top) - 100.0) / 25;
@ -69,7 +74,7 @@ onUiLoaded(async () => {
wheel.style.margin = 'auto'
wheel.id = 'cc-img-' + mode
wheel.ondragstart = () => { return false; }
wheel.ondragstart = (e) => { e.preventDefault(); }
sliders = [
document.getElementById('cc-r-' + mode).querySelector('input'),