diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js index 86f541e56..b33b5427f 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js @@ -2965,6 +2965,11 @@ function newSuperalgosDocSpace() { const MAX_COLUMNS = 10 const MAX_ROWS = 100 + const ELBOW = 'elbow' + const FORK = 'fork' + const LINE = 'line' + const SPACE = 'space' + let contentMatrix = [] for (let i = 0; i < MAX_ROWS; i++) { @@ -2976,16 +2981,24 @@ function newSuperalgosDocSpace() { scanHierarchy(appSchemaDocument, project, currentColumn) - function scanHierarchy(schemaDocument, project, currentColumn) { + function scanHierarchy(schemaDocument, project, currentColumn, lastChild) { if (schemaDocument === undefined) { return } - if (schemaDocument.childrenNodesProperties === undefined) { return } currentRow++ let matrixValue = schemaDocument.type let matrixRow = contentMatrix[currentRow] matrixRow[currentColumn] = matrixValue + if (lastChild === true) { + matrixRow[currentColumn - 1] = ELBOW + } + if (lastChild === false) { + matrixRow[currentColumn - 1] = FORK + } + + if (schemaDocument.childrenNodesProperties === undefined) { return } + for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) { let property = schemaDocument.childrenNodesProperties[i] let childProject = project @@ -2994,24 +3007,61 @@ function newSuperalgosDocSpace() { } let childType = property.childType let childSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(childType) - scanHierarchy(childSchemaDocument, childProject, currentColumn + 1) + + if (i === schemaDocument.childrenNodesProperties.length - 1) { + lastChild = true + } else { + lastChild = false + } + + scanHierarchy(childSchemaDocument, childProject, currentColumn + 1, lastChild) } } + /* + Now we will scan the Matrix to put the lines of the hirierchy. + */ + /* + for (let i = 0; i < contentMatrix.length; i++) { + let matrixRow = contentMatrix[i] + let previousRow = contentMatrix[i - 1] + for (let j = 0; j < matrixRow.length; j++) { + let matrixValue = matrixRow[j] + let valueUp = previousRow[j] + let valueLeft = matrixRow[j - 1] + let valueRight = matrixRow[j + 1] + if (contentMatrix !== '') { + break + } + + } + } + */ + + for (let i = 0; i < contentMatrix.length; i++) { + let matrixRow = contentMatrix[i] + for (let j = 0; j < matrixRow.length; j++) { + if (matrixRow[j] === '') { + matrixRow[j] = SPACE + } + } + } let HTML = '' HTML = HTML + '' - HTML = HTML + '' - HTML = HTML + '' - HTML = HTML + '' + for (let i = 0; i < contentMatrix.length; i++) { + let matrixRow = contentMatrix[i] + HTML = HTML + '' + for (let j = 0; j < matrixRow.length; j++) { + HTML = HTML + '' + + } + HTML = HTML + '' + } HTML = HTML + '
' - HTML = HTML + '
' + HTML = HTML + matrixRow[j] + HTML = HTML + '
' - - HTML = HTML + '
Design Space
' - HTML = HTML + '
Space Style
' - HTML = HTML + '
Space Settings
' - return HTML } }