import UEBlueprintDraggableObject from "./UEBlueprintDraggableObject.js" export default class UEBlueprintObject extends UEBlueprintDraggableObject { static classInputs = [/* { name: "Input Example", type: 'integer' } */] static classOutputs = [/* { name: "Return Value", type: 'string' }*/ ] static classInFlow = false static classOutFlow = false static className = 'Empty node' header() { return `
${this.constructor.className}
` } body() { return `
${this.constructor.classInputs.forEach((input, index) => `
${input.name}
`) ?? ''}
${this.constructor.classOutputs.forEach((output, index) => `
${output.name}
`) ?? ''}
` } render() { return `
${this.header()} ${this.body()}
` } constructor() { super() this.selected = false this.inputs = this.constructor.classInputs.map(value => { return { connected: null } }) this.outputs = this.constructor.classOutputs.map(value => { return { connected: null } }) } connectedCallback() { super.connectedCallback() this.classList.add('ueb-node') if (this.selected) { this.classList.add('ueb-selected') } this.style.setProperty('--ueb-position-x', this.location[0]) this.style.setProperty('--ueb-position-y', this.location[1]) let aDiv = document.createElement('div'); aDiv.innerHTML = this.render() this.appendChild(aDiv.firstElementChild) } isSelected() { return this.selected } setSelected(value = true) { if (this.selected == value) { return } this.selected = value if (value) { this.classList.add('ueb-selected') } else { this.classList.remove('ueb-selected') } } } customElements.define('u-object', UEBlueprintObject)