Files
ueblueprint/js/element/ISelectableDraggableElement.js
barsdeveloper a5813d0b4d Niagara and Metasound nodes WIP
* Keep track of entities

* Fix renaming

* Niagara variables wip

* Several niagara decode and test

* Move nodeTemplate code to dedicated file, self node added

* Move node decoding functions to dedicated files

* Move pin decoding logic to dedicated files

* Accept space separated keys in objects

* Build

* Prevent a crash in case of incomplete object

* Avoid creating objects unnecessarily

* types formatting

* Initial metasound style

* Common pcg nodes colors

* Fix string serialization

* Metasound new styles and fixes

* More metasound styles and colors

* WIP

* Several fixes

* More tests and fixes

* Clean gitignore
2024-05-20 12:56:36 +02:00

54 lines
1.5 KiB
JavaScript

import Configuration from "../Configuration.js"
import Utility from "../Utility.js"
import IDraggableElement from "./IDraggableElement.js"
/**
* @template {IEntity} EntityT
* @template {ISelectableDraggableTemplate} TemplateT
* @extends {IDraggableElement<EntityT, TemplateT>}
*/
export default class ISelectableDraggableElement extends IDraggableElement {
static properties = {
...super.properties,
selected: {
type: Boolean,
attribute: "data-selected",
reflect: true,
converter: Utility.booleanConverter,
},
}
/** @param {UEBDragEvent} e */
dragHandler = e => this.addLocation(...e.detail.value)
constructor() {
super()
this.selected = false
this.listeningDrag = false
}
setup() {
super.setup()
this.setSelected(this.selected)
}
cleanup() {
super.cleanup()
this.blueprint.removeEventListener(Configuration.nodeDragGeneralEventName, this.dragHandler)
}
setSelected(value = true) {
this.selected = value
if (this.blueprint) {
if (this.selected) {
this.listeningDrag = true
this.blueprint.addEventListener(Configuration.nodeDragGeneralEventName, this.dragHandler)
} else {
this.blueprint.removeEventListener(Configuration.nodeDragGeneralEventName, this.dragHandler)
this.listeningDrag = false
}
}
}
}