Files
ueblueprint/js/template/ColorSliderTemplate.js
barsdeveloper fdd86ce5de Refactor jsdoc types (#16)
* WIP

* Fix type 1

* Missing types info

* Some fixes

* Several types refactoring and fixes

* WIP

* Fix grammar
2023-09-22 22:56:33 +02:00

19 lines
648 B
JavaScript
Executable File

import IDraggableControlTemplate from "./IDraggableControlTemplate.js"
import Utility from "../Utility.js"
/** @extends {IDraggableControlTemplate<ColorHandlerElement>} */
export default class ColorSliderTemplate extends IDraggableControlTemplate {
/**
* @param {Number} x
* @param {Number} y
* @return {[Number, Number]}
*/
adjustLocation(x, y) {
x = Utility.clamp(x, 0, this.movementSpaceSize[0])
y = Utility.clamp(y, 0, this.movementSpaceSize[1])
this.locationChangeCallback?.(x / this.movementSpaceSize[0], 1 - y / this.movementSpaceSize[1])
return [x, y]
}
}