mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-15 09:44:49 +08:00
Start implementing link dragging
This commit is contained in:
@@ -2,6 +2,7 @@ import NodeTemplate from "../template/NodeTemplate"
|
||||
import ObjectEntity from "../entity/ObjectEntity"
|
||||
import SelectableDraggable from "./SelectableDraggable"
|
||||
import SerializerFactory from "../serialization/SerializerFactory"
|
||||
import DragLink from "../input/DragLink"
|
||||
|
||||
export default class GraphNode extends SelectableDraggable {
|
||||
|
||||
@@ -16,21 +17,30 @@ export default class GraphNode extends SelectableDraggable {
|
||||
*/
|
||||
constructor(entity) {
|
||||
super(entity, new NodeTemplate())
|
||||
this.graphNodeName = 'n/a'
|
||||
this.inputs = []
|
||||
this.outputs = []
|
||||
this.graphNodeName = "n/a"
|
||||
this.dragLinkObjects = Array()
|
||||
super.setLocation([this.entity.NodePosX, this.entity.NodePosY])
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
const type = this.getAttribute('type')?.trim()
|
||||
const type = this.getAttribute("type")?.trim()
|
||||
super.connectedCallback()
|
||||
this.classList.add('ueb-node')
|
||||
this.classList.add("ueb-node")
|
||||
if (this.selected) {
|
||||
this.classList.add('ueb-selected')
|
||||
this.classList.add("ueb-selected")
|
||||
}
|
||||
this.style.setProperty('--ueb-position-x', this.location[0])
|
||||
this.style.setProperty('--ueb-position-y', this.location[1])
|
||||
this.style.setProperty("--ueb-position-x", this.location[0])
|
||||
this.style.setProperty("--ueb-position-y", this.location[1])
|
||||
this.querySelectorAll(".ueb-node-input, .ueb-node-output").forEach(element => {
|
||||
this.dragLinkObjects.push(
|
||||
new DragLink(element, this.blueprint, {
|
||||
clickButton: 0,
|
||||
moveEverywhere: true,
|
||||
exitAnyButton: true,
|
||||
looseTarget: true
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
setLocation(value = [0, 0]) {
|
||||
|
||||
Reference in New Issue
Block a user