Skip to content

Commit

Permalink
#9 chore: Update events example
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsobspinto committed Jul 19, 2022
1 parent 6f9b247 commit c9a30dd
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 7 deletions.
22 changes: 21 additions & 1 deletion dist/meta-diagram.cjs.development.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/meta-diagram.cjs.development.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/meta-diagram.cjs.production.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/meta-diagram.cjs.production.min.js.map

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion dist/meta-diagram.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/meta-diagram.esm.js.map

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/helpers/nodesHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ export function getNode(
export function processNodes(metaNodes: MetaNode[]) : MetaNodeModel[] {
const metaNodeModels = []
for(const mn of metaNodes){
// TODO: serialize children (bottom up or memoization)
const metaNodeModel = new MetaNodeModel(Object.fromEntries(mn.options.options))
metaNodeModel.registerListener({positionChanged: () => { console.log("positionChanged") }})
// @ts-ignore
metaNodeModel.registerListener({positionChanged: (event => handlePositionChanged(event))})
metaNodeModels.push(metaNodeModel)
}
return metaNodeModels
}

function handlePositionChanged(e: any){
// todo: calculate e.entity.position offset apply the same to e.entity.children
console.log(e)
}

0 comments on commit c9a30dd

Please sign in to comment.