mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-23 23:34:43 +08:00
Started work on serialization, refactoring
This commit is contained in:
22
js/UGraphEntity.js
Normal file
22
js/UGraphEntity.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* A Graph Entity is an element that can stay directly (as a first child) on the blueprint grid. Those entities are either nodes or links
|
||||
*/
|
||||
export default class UGraphEntity extends HTMLElement {
|
||||
constructor() {
|
||||
super()
|
||||
/** @type {import("./UEBlueprint").default}" */
|
||||
this.blueprint = null
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.blueprint = this.closest('u-blueprint')
|
||||
let aDiv = document.createElement('div')
|
||||
aDiv.innerHTML = this.render()
|
||||
this.appendChild(aDiv.firstElementChild)
|
||||
}
|
||||
|
||||
// Subclasses want to rewrite this
|
||||
render() {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user