highlights and values working

This commit is contained in:
Luis Fernando Molina committed 2020-06-16 19:21:38 +02:00
1 parent 1ed6a48488
commit 6796745980
10 files changed
+233 -140

No files matched your search

+15 -6
View File
@@ -9,23 +9,32 @@ function newNodesHighlights () {
finalize: finalize
}
let rootNode
let hiriarchyMap
return thisObject
function finalize () {
rootNode = undefined
hiriarchyMap = undefined
}
function initialize (pRootNode) {
rootNode = pRootNode
let rootNode = canvas.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
hiriarchyMap = getHiriarchyMap(rootNode)
}
function onRecordChange (currentRecord) {
evalNode(rootNode, currentRecord.array, 0, applyHighlight)
if (currentRecord === undefined) { return }
let array = currentRecord.highlights
if (array === undefined) { return }
for (let i = 0; i < array.length; i++) {
let arrayItem = array[0]
let nodeId = arrayItem[0]
let value = arrayItem[1]
applyValue(nodeId, value)
}
}
function applyHighlight (node, value) {
if (value !== 1) { return }
function applyValue (nodeId, value) {
let node = hiriarchyMap.get(nodeId)
if (node.payload === undefined) { return }
if (node.payload.uiObject === undefined) { return }
node.payload.uiObject.highlight()