Various color picker improvements

This commit is contained in:
barsdeveloper
2022-10-22 23:06:37 +02:00
parent 14d376d447
commit acea290c9d
23 changed files with 562 additions and 279 deletions

View File

@@ -13,14 +13,9 @@ export default class ColorHandlerTemplate extends IDraggableControlTemplate {
y = -(y - radius)
let [r, theta] = Utility.getPolarCoordinates([x, y])
r = Math.min(r, radius), [x, y] = Utility.getCartesianCoordinates([r, theta])
this.locationChangeCallback?.([x / radius, y / radius])
x = Math.round(x + radius)
y = Math.round(-y + radius)
const hsva = this.getColor().toHSVA()
this.locationChangeCallback?.([x, y], radius, hsva[2], hsva[3])
return [x, y]
}
getColor() {
return this.element.windowElement.template.color
}
}