mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
JSDoc complete type check
This commit is contained in:
37
js/element/ColorHandlerElement.js
Normal file
37
js/element/ColorHandlerElement.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import LinearColorEntity from "../entity/LinearColorEntity"
|
||||
import ColorHandlerTemplate from "../template/ColorHandlerTemplate"
|
||||
import IDraggableElement from "./IDraggableElement"
|
||||
|
||||
/** @typedef {import("../template/ColorPickerWindowTemplate").default} ColorPickerWindowTemplate */
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("./WindowElement").default<T>} WindowElement
|
||||
*/
|
||||
|
||||
export default class ColorHandlerElement extends IDraggableElement {
|
||||
|
||||
/** @type {WindowElement<ColorPickerWindowTemplate>} */
|
||||
windowElement
|
||||
|
||||
constructor() {
|
||||
super({}, new ColorHandlerTemplate())
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback()
|
||||
this.windowElement = this.closest("ueb-window")
|
||||
}
|
||||
|
||||
/** @param {Number[]} param0 */
|
||||
addLocation([x, y]) {
|
||||
super.addLocation([x, y])
|
||||
this.windowElement.windowOptions
|
||||
this.windowElement.template.color = this.computeColor()
|
||||
}
|
||||
|
||||
computeColor() {
|
||||
return new LinearColorEntity()
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("ueb-color-handler", ColorHandlerElement)
|
||||
Reference in New Issue
Block a user