Serialization fixed

This commit is contained in:
barsdeveloper
2021-11-08 22:28:26 +01:00
parent ad8c34cdab
commit 39e26bc0c2
12 changed files with 195 additions and 48 deletions

View File

@@ -9,6 +9,7 @@ import Select from "./input/Select"
import Unfocus from "./input/Unfocus"
import Utility from "./Utility"
import Zoom from "./input/Zoom"
import Copy from "./input/Copy"
/** @typedef {import("./graph/GraphNode").default} GraphNode */
export default class Blueprint extends GraphElement {
@@ -70,6 +71,7 @@ export default class Blueprint extends GraphElement {
this.querySelector('[data-nodes]').append(...this.entity.nodes)
this.copyObject = new Copy(this.getGridDOMElement(), this)
this.pasteObject = new Paste(this.getGridDOMElement(), this)
this.dragObject = new DragScroll(this.getGridDOMElement(), this, {
@@ -290,8 +292,18 @@ export default class Blueprint extends GraphElement {
*
* @returns {GraphNode[]} Nodes
*/
getNodes() {
return this.entity.nodes
getNodes(selected = false) {
if (selected) {
return this.entity.nodes.filter(
/**
*
* @param {GraphNode} node
*/
node => node.selected
)
} else {
return this.entity.nodes
}
}
/**