mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-14 04:13:25 +08:00
Color picker improvements
This commit is contained in:
21
js/template/ColorSliderTemplate.js
Executable file
21
js/template/ColorSliderTemplate.js
Executable file
@@ -0,0 +1,21 @@
|
||||
import IDraggableControlTemplate from "./IDraggableControlTemplate"
|
||||
import Utility from "../Utility"
|
||||
|
||||
/** @typedef {import("../element/ColorHandlerElement").default} ColorHandlerElement */
|
||||
|
||||
/** @extends {IDraggableControlTemplate<ColorHandlerElement>} */
|
||||
export default class ColorSliderTemplate extends IDraggableControlTemplate {
|
||||
|
||||
/** @param {[Number, Number]} param0 */
|
||||
adjustLocation([x, y]) {
|
||||
x = 0
|
||||
y = Utility.clamp(y, 0, this.movementSpaceSize[1])
|
||||
const hsva = this.getColor().toHSVA()
|
||||
this.locationChangeCallback?.([x, y])
|
||||
return [x, y]
|
||||
}
|
||||
|
||||
getColor() {
|
||||
return this.element.windowElement.template.color
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user