mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-13 11:47:30 +08:00
Serialization work in progress
This commit is contained in:
25
js/graph/GraphEntity.js
Normal file
25
js/graph/GraphEntity.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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 GraphEntity extends HTMLElement {
|
||||
/**
|
||||
*
|
||||
* @param {import("../template/Template").default} template The template to render this node
|
||||
*/
|
||||
constructor(template) {
|
||||
super()
|
||||
/** @type {import("../Blueprint").Blueprint}" */
|
||||
this.blueprint = null
|
||||
this.template = template
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.blueprint = this.closest('u-blueprint')
|
||||
this.append(...this.template.getElements(this))
|
||||
}
|
||||
|
||||
// Subclasses want to rewrite this
|
||||
render() {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user