From 2ad465f9a6048b22f4d14d4dc5a6cb723ff79c1c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 22 Sep 2020 18:18:53 +0200 Subject: [PATCH] Tool Tips --- PostLoader.js | 12 ++++++++++-- Spaces/TutorialSpace.js | 43 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/PostLoader.js b/PostLoader.js index 8dd748334..f8e8307ef 100644 --- a/PostLoader.js +++ b/PostLoader.js @@ -3,6 +3,8 @@ let markets let APP_SCHEMA_MAP = new Map() let APP_SCHEMA_ARRAY = [] +let DOC_SCHEMA_MAP = new Map() +let DOC_SCHEMA_ARRAY = [] function newDashboard() { const MODULE_NAME = 'Dashboard' @@ -22,15 +24,21 @@ function newDashboard() { function start() { try { setBrowserEvents() - setUpAppSchema() + setUpSchemas() - function setUpAppSchema() { + function setUpSchemas() { APP_SCHEMA_ARRAY = getAppSchema() for (let i = 0; i < APP_SCHEMA_ARRAY.length; i++) { let nodeDefinition = APP_SCHEMA_ARRAY[i] let key = nodeDefinition.type APP_SCHEMA_MAP.set(key, nodeDefinition) } + DOC_SCHEMA_ARRAY = getDocSchema() + for (let i = 0; i < DOC_SCHEMA_ARRAY.length; i++) { + let nodeDefinition = DOC_SCHEMA_ARRAY[i] + let key = nodeDefinition.type + DOC_SCHEMA_MAP.set(key, nodeDefinition) + } startCanvas() } diff --git a/Spaces/TutorialSpace.js b/Spaces/TutorialSpace.js index 3ce4d4526..0da537187 100644 --- a/Spaces/TutorialSpace.js +++ b/Spaces/TutorialSpace.js @@ -111,6 +111,7 @@ function newTutorialSpace() { } } + checkPressButton() checkGif() checkImage() checkDocumentation() @@ -118,6 +119,34 @@ function newTutorialSpace() { checkReference() return + function checkPressButton() { + if (currentNode === undefined) { return } + let config = JSON.parse(currentNode.config) + if (config.pressButton === undefined || config.pressButton ==="") { + return + } + /* Remove this item from the navigation stack. */ + navigationStack.splice(navigationStack.length - 1) + switch (config.pressButton) { + case "Stop": { + stop() + return + } + case "Skip": { + skip() + return + } + case "Previous": { + previous() + return + } + case "Next": { + next() + return + } + } + } + function checkGif() { let tutorialGifDiv = document.getElementById('tutorialGifDiv') if (tutorialGifDiv !== null && tutorialGifDiv !== undefined) { @@ -673,8 +702,18 @@ function newTutorialSpace() { let firstPart = splittedText[i] let nodeType = splittedText[i + 1] if (nodeType === undefined ) {return resultingText + firstPart} - let tooltip = TOOL_TIP_HTML.replace('NODE_TYPE', nodeType).replace('NODE_DEFINITION', 'La concha del mono, lo logre!') - resultingText = resultingText + firstPart + tooltip + let definitionNode = DOC_SCHEMA_MAP.get(nodeType) + if (definitionNode === undefined) { + currentNode.setErrorMessage(nodeType + ' not found at Doc Schema.') + return + } + let definition = definitionNode.definition + if (definition === undefined || definition === "") { + resultingText = resultingText + firstPart + nodeType + } else { + let tooltip = TOOL_TIP_HTML.replace('NODE_TYPE', nodeType).replace('NODE_DEFINITION', definition) + resultingText = resultingText + firstPart + tooltip + } } return resultingText }