All rearenged

This commit is contained in:
Luis Fernando Molina committed 2021-10-01 17:06:39 +02:00
1 parent 15727ff6d1
commit 1658b3ed82
5 files changed
+79 -49

No files matched your search

@@ -75,5 +75,11 @@
"childType": "Asset",
"autoAdd": false
}
]
],
"inMapMode": {
"showNodeType": false,
"showHierarchyHeadRing": false,
"smallIcon": true,
"smallText": true
}
}
@@ -52,5 +52,11 @@
"childType": "Feature",
"autoAdd": false
}
]
],
"inMapMode": {
"showNodeType": false,
"showHierarchyHeadRing": false,
"smallIcon": true,
"smallText": true
}
}
@@ -65,5 +65,11 @@
"childType": "Pool",
"autoAdd": false
}
]
],
"inMapMode": {
"showNodeType": false,
"showHierarchyHeadRing": false,
"smallIcon": true,
"smallText": true
}
}
@@ -52,5 +52,11 @@
"childType": "Position",
"autoAdd": false
}
]
],
"inMapMode": {
"showNodeType": false,
"showHierarchyHeadRing": false,
"smallIcon": true,
"smallText": true
}
}
@@ -55,59 +55,65 @@ function newGovernanceUserProfileSpace() {
}
}
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
/*
Here we will change the Y position of all profiles so that they are all at the same level.
*/
let pools = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Pools')
let assets = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Assets')
let features = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Features')
let positions = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Positions')
const SPACE_WIDTH = UI.projects.foundations.spaces.floatingSpace.container.frame.width
const SPACE_HEIGHT = UI.projects.foundations.spaces.floatingSpace.container.frame.height
const X_STEP = SPACE_WIDTH / (userProfiles.length + 1)
const Y_STEP = 3000
arrangeNodes(userProfiles, SPACE_HEIGHT * 0.425, 3000)
arrangeNodes(pools, SPACE_HEIGHT * 0.595, 0)
arrangeNodes(features, SPACE_HEIGHT * 0.635, 0)
arrangeNodes(positions, SPACE_HEIGHT * 0.675, 0)
arrangeNodes(assets, SPACE_HEIGHT * 0.835, 3000)
const Y_LEVEL = SPACE_HEIGHT * 0.425
let xOffset = X_STEP
let yOffset = 0
for (let i = 0; i < userProfiles.length; i++) {
userProfiles[i].payload.floatingObject.container.frame.position.x = xOffset
xOffset = xOffset + X_STEP
}
for (let i = 0; i < userProfiles.length; i++) {
switch (true) {
case (yOffset === 0): {
yOffset = Y_STEP
break
}
case (yOffset === Y_STEP): {
yOffset = Y_STEP * 2
break
}
case (yOffset === Y_STEP * 2): {
yOffset = Y_STEP * 1 + 1
break
}
case (yOffset === Y_STEP * 1 + 1): {
yOffset = Y_STEP * 0 + 1
break
}
case (yOffset === Y_STEP * 0 + 1): {
yOffset = -Y_STEP
break
}
case (yOffset === -Y_STEP): {
yOffset = 0
break
}
function arrangeNodes(nodes, yLevel, yStep) {
/*
Here we will change the Y position of all profiles so that they are all at the same level.
*/
const X_STEP = SPACE_WIDTH / (nodes.length + 1)
let xOffset = X_STEP
let yOffset = 0
for (let i = 0; i < nodes.length; i++) {
nodes[i].payload.floatingObject.container.frame.position.x = xOffset
xOffset = xOffset + X_STEP
}
userProfiles[i].payload.floatingObject.container.frame.position.y = Y_LEVEL + yOffset
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.payload.floatingObject.isCollapsed !== true) {
userProfile.payload.floatingObject.collapseToggle()
for (let i = 0; i < nodes.length; i++) {
switch (true) {
case (yOffset === 0): {
yOffset = yStep
break
}
case (yOffset === yStep): {
yOffset = yStep * 2
break
}
case (yOffset === yStep * 2): {
yOffset = yStep * 1 + 1
break
}
case (yOffset === yStep * 1 + 1): {
yOffset = yStep * 0 + 1
break
}
case (yOffset === yStep * 0 + 1): {
yOffset = -yStep
break
}
case (yOffset === -yStep): {
yOffset = 0
break
}
}
nodes[i].payload.floatingObject.container.frame.position.y = yLevel + yOffset
}
}
/*
Here we will setup the Reputation for each profile.
*/