mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-27 02:34:45 +08:00
Make elements default constructible, testing wip
This commit is contained in:
@@ -6,6 +6,7 @@ import LinearColorEntity from "../../entity/LinearColorEntity"
|
||||
/**
|
||||
* @typedef {import("../../element/NodeElement").default} NodeElement
|
||||
* @typedef {import("../../element/PinElement").default} PinElement
|
||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
||||
*/
|
||||
|
||||
export default class CommentNodeTemplate extends IResizeableTemplate {
|
||||
@@ -14,15 +15,19 @@ export default class CommentNodeTemplate extends IResizeableTemplate {
|
||||
#selectableAreaHeight = 0
|
||||
|
||||
/** @param {NodeElement} element */
|
||||
constructed(element) {
|
||||
initialize(element) {
|
||||
if (element.entity.CommentColor) {
|
||||
this.#color.setFromRGBANumber(element.entity.CommentColor.toNumber())
|
||||
this.#color.setFromHSVA(this.#color.H.value, this.#color.S.value, Math.pow(this.#color.V.value, 0.45) * 0.67)
|
||||
this.#color.setFromHSVA(
|
||||
this.#color.H.value,
|
||||
this.#color.S.value,
|
||||
Math.pow(this.#color.V.value, 0.45) * 0.67
|
||||
)
|
||||
}
|
||||
element.classList.add("ueb-node-style-comment", "ueb-node-resizeable")
|
||||
element.sizeX ??= 25 * Configuration.gridSize
|
||||
element.sizeY ??= 6 * Configuration.gridSize
|
||||
super.constructed(element) // Keep it at the end because it calls this.getColor() where this.#color must be initialized
|
||||
super.initialize(element) // Keep it at the end because it calls this.getColor() where this.#color must be initialized
|
||||
}
|
||||
|
||||
getColor() {
|
||||
@@ -45,7 +50,7 @@ export default class CommentNodeTemplate extends IResizeableTemplate {
|
||||
`
|
||||
}
|
||||
|
||||
/** @param {Map} changedProperties */
|
||||
/** @param {PropertyValues} changedProperties */
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties)
|
||||
const bounding = this.getDraggableElement().getBoundingClientRect()
|
||||
|
||||
Reference in New Issue
Block a user