diff --git a/Projects/Education/UI/Spaces/Docs-Space/DocumentPage.js b/Projects/Education/UI/Spaces/Docs-Space/DocumentPage.js index 77fc64bb4..15d64e845 100644 --- a/Projects/Education/UI/Spaces/Docs-Space/DocumentPage.js +++ b/Projects/Education/UI/Spaces/Docs-Space/DocumentPage.js @@ -536,7 +536,7 @@ function newFoundationsDocsDocumentPage() { let includedSchemaDocument if (SCHEMAS_BY_PROJECT.get(project) === undefined) { - return 'Include paragraph style Syntax Error. The Project ' + project + ' could not be found. Check the Docs Include Style Syntax to learn how to include blocks from a page. This error message will dissapear as soon as you fix the problem.' + return 'Include paragraph style Syntax Error. The Project ' + project + ' could not be found. Check the Docs Include Style Syntax to learn how to include blocks from a page. This error message will disappear as soon as you fix the problem.' } switch (category) { case 'Node': { @@ -644,11 +644,11 @@ function newFoundationsDocsDocumentPage() { if (project === undefined || category === undefined || chapterNumber === undefined || chapterName === undefined) { - return 'Chapter paragraph style Syntax Error. Some of the required parameters are undefined. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.' + return 'Chapter paragraph style Syntax Error. Some of the required parameters are undefined. Check the Docs Chapter Style Syntax. This error message will disappear as soon as you fix the problem.' } if (SCHEMAS_BY_PROJECT.get(project) === undefined) { - return 'Chapter paragraph style Syntax Error. The Project ' + project + ' could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.' + return 'Chapter paragraph style Syntax Error. The Project ' + project + ' could not be found. Check the Docs Chapter Style Syntax. This error message will disappear as soon as you fix the problem.' } if (category !== 'Topic' && category !== 'Tutorial' && category !== 'Review') { @@ -664,7 +664,7 @@ function newFoundationsDocsDocumentPage() { ) if (orderedTopicPageIndexArray.length === 0) { - return 'Chapter paragraph style Syntax Error. The Topic ' + chapterName + ' could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.' + return 'Chapter paragraph style Syntax Error. The Topic ' + chapterName + ' could not be found. Check the Docs Chapter Style Syntax. This error message will disappear as soon as you fix the problem.' } break } @@ -676,7 +676,7 @@ function newFoundationsDocsDocumentPage() { ) if (orderedTutorialPageIndexArray.length === 0) { - return 'Chapter paragraph style Syntax Error. The Tutorial ' + chapterName + ' could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.' + return 'Chapter paragraph style Syntax Error. The Tutorial ' + chapterName + ' could not be found. Check the Docs Chapter Style Syntax. This error message will disappear as soon as you fix the problem.' } break } @@ -688,7 +688,7 @@ function newFoundationsDocsDocumentPage() { ) if (orderedReviewPageIndexArray.length === 0) { - return 'Chapter paragraph style Syntax Error. The Review ' + chapterName + ' could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.' + return 'Chapter paragraph style Syntax Error. The Review ' + chapterName + ' could not be found. Check the Docs Chapter Style Syntax. This error message will disappear as soon as you fix the problem.' } break } diff --git a/Projects/Foundations/Schemas/Docs-Nodes/B/Backtesting/Backtesting-Session/backtesting-session.json b/Projects/Foundations/Schemas/Docs-Nodes/B/Backtesting/Backtesting-Session/backtesting-session.json index d7a67e4e7..ba2872f40 100644 --- a/Projects/Foundations/Schemas/Docs-Nodes/B/Backtesting/Backtesting-Session/backtesting-session.json +++ b/Projects/Foundations/Schemas/Docs-Nodes/B/Backtesting/Backtesting-Session/backtesting-session.json @@ -27,7 +27,7 @@ }, { "style": "Text", - "text": "After a few seconds, a literal indication of the progress of the calculations appears below the session node, displaying the date that is currently being processed. Once the calculation is finished, the session stops and the date below the session node dissapears." + "text": "After a few seconds, a literal indication of the progress of the calculations appears below the session node, displaying the date that is currently being processed. Once the calculation is finished, the session stops and the date below the session node disappears." }, { "style": "Text", diff --git a/Projects/Foundations/Schemas/Docs-Topics/T/Troubleshooting/Troubleshooting/troubleshooting-017-problems-saving-the-workspace-or-plugins.json b/Projects/Foundations/Schemas/Docs-Topics/T/Troubleshooting/Troubleshooting/troubleshooting-017-problems-saving-the-workspace-or-plugins.json index 4ca968770..8d9819301 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/T/Troubleshooting/Troubleshooting/troubleshooting-017-problems-saving-the-workspace-or-plugins.json +++ b/Projects/Foundations/Schemas/Docs-Topics/T/Troubleshooting/Troubleshooting/troubleshooting-017-problems-saving-the-workspace-or-plugins.json @@ -3,7 +3,7 @@ "pageNumber": "17", "type": "Problems Saving The Workspace or Plugins", "definition": { - "text": "Are you having problems saving your Workspace? Did your changes in the workspace dissapear? Was the workspace reset? Or you believe the changes were lost? Are you confused on how the system handles the persistance of changes? Is your Workspace not saving your changes?", + "text": "Are you having problems saving your Workspace? Did your changes in the workspace disappear? Was the workspace reset? Or you believe the changes were lost? Are you confused on how the system handles the persistance of changes? Is your Workspace not saving your changes?", "updated": 1620849519292 }, "paragraphs": [ diff --git a/Projects/Foundations/Schemas/Docs-Tutorials/I/Install/Install-a-New-Market/install-a-new-market-020-tutorial-step-charts-verification-2.json b/Projects/Foundations/Schemas/Docs-Tutorials/I/Install/Install-a-New-Market/install-a-new-market-020-tutorial-step-charts-verification-2.json index 75fed8c5c..8e4142965 100644 --- a/Projects/Foundations/Schemas/Docs-Tutorials/I/Install/Install-a-New-Market/install-a-new-market-020-tutorial-step-charts-verification-2.json +++ b/Projects/Foundations/Schemas/Docs-Tutorials/I/Install/Install-a-New-Market/install-a-new-market-020-tutorial-step-charts-verification-2.json @@ -7,7 +7,7 @@ "project": "Foundations", "name": "time-machine" }, - "text": "Verify that the time machines created show up on the chartsing space... you should find..." + "text": "Verify that the time machines created show up on the charting space... you should find..." }, "paragraphs": [ { diff --git a/UI/Utilities.js b/UI/Utilities.js index 2a0e1db54..1f32e3c5c 100644 --- a/UI/Utilities.js +++ b/UI/Utilities.js @@ -1,141 +1,131 @@ -function getSchemaDocument(node, project) { - if (node === null || node === undefined) { - console.log('[Error] Can not get the schema document of a null or undefined node ') - return - } - if (project === undefined) { project = node.project } +function getSchemaDocument (node, project) { + if (node === null || node === undefined) { + console.log('[Error] Can not get the schema document of a null or undefined node ') + return + } + if (project === undefined) { project = node.project } - let APP_SCHEMA = SCHEMAS_BY_PROJECT.get(project) - if (APP_SCHEMA !== undefined) { - return SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(node.type) - } else { - console.log('[Error] Could not get APP Scchema for project ' + node.project) - } + let APP_SCHEMA = SCHEMAS_BY_PROJECT.get(project) + if (APP_SCHEMA !== undefined) { + return SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(node.type) + } else { + console.log('[Error] Could not get APP Scchema for project ' + node.project) + } } -function dynamicDecimals(value, minDecimals) { - if (minDecimals === undefined) { - minDecimals = 0 - } - let decimals = 0 - if (value < 1) { decimals = 3 } - else if (value < 10) { decimals = 2 } - else if (value < 100) { decimals = 1 } - else if (Math.abs(Math.trunc(value * 10)) < 1) { decimals = 4 } - else if (Math.abs(Math.trunc(value * 100)) < 1) { decimals = 5 } - else if (Math.abs(Math.trunc(value * 1000)) < 1) { decimals = 6 } - else if (Math.abs(Math.trunc(value * 10000)) < 1) { decimals = 7 } - else if (Math.abs(Math.trunc(value * 100000)) < 1) { decimals = 8 } - else if (Math.abs(Math.trunc(value * 1000000)) < 1) { decimals = 9 } - else if (Math.abs(Math.trunc(value * 10000000)) < 1) { decimals = 10 } - else if (Math.abs(Math.trunc(value * 100000000000)) < 1) { value = 0; decimals = 0 } +function dynamicDecimals (value, minDecimals) { + if (minDecimals === undefined) { + minDecimals = 0 + } + let decimals = 0 + if (value < 1) { decimals = 3 } else if (value < 10) { decimals = 2 } else if (value < 100) { decimals = 1 } else if (Math.abs(Math.trunc(value * 10)) < 1) { decimals = 4 } else if (Math.abs(Math.trunc(value * 100)) < 1) { decimals = 5 } else if (Math.abs(Math.trunc(value * 1000)) < 1) { decimals = 6 } else if (Math.abs(Math.trunc(value * 10000)) < 1) { decimals = 7 } else if (Math.abs(Math.trunc(value * 100000)) < 1) { decimals = 8 } else if (Math.abs(Math.trunc(value * 1000000)) < 1) { decimals = 9 } else if (Math.abs(Math.trunc(value * 10000000)) < 1) { decimals = 10 } else if (Math.abs(Math.trunc(value * 100000000000)) < 1) { value = 0; decimals = 0 } - if (decimals < minDecimals) { decimals = minDecimals } + if (decimals < minDecimals) { decimals = minDecimals } - let returnValue = Number(value).toFixed(decimals) - return returnValue + let returnValue = Number(value).toFixed(decimals) + return returnValue } -function convertTimeFrameToName(pTimeFrame) { - for (let i = 0; i < dailyTimeFramesArray.length; i++) { - let period = dailyTimeFramesArray[i] - if (period[0] === pTimeFrame) { - return period[1] - } +function convertTimeFrameToName (pTimeFrame) { + for (let i = 0; i < dailyTimeFramesArray.length; i++) { + let period = dailyTimeFramesArray[i] + if (period[0] === pTimeFrame) { + return period[1] } + } - for (let i = 0; i < marketTimeFramesArray.length; i++) { - let period = marketTimeFramesArray[i] - if (period[0] === pTimeFrame) { - return period[1] - } + for (let i = 0; i < marketTimeFramesArray.length; i++) { + let period = marketTimeFramesArray[i] + if (period[0] === pTimeFrame) { + return period[1] } + } } -function nextPorwerOf10(number) { - for (let i = -10; i <= 10; i++) { - if (number < Math.pow(10, i)) { - return Math.pow(10, i) - } +function nextPorwerOf10 (number) { + for (let i = -10; i <= 10; i++) { + if (number < Math.pow(10, i)) { + return Math.pow(10, i) } + } } -function pad(str, max) { - str = str.toString() - return str.length < max ? pad('0' + str, max) : str +function pad (str, max) { + str = str.toString() + return str.length < max ? pad('0' + str, max) : str } -function moveToUserPosition(container, currentDate, currentRate, coordinateSystem, ignoreX, ignoreY, mousePosition, fitFunction) { - let targetPoint = { - x: currentDate.valueOf(), - y: currentRate - } +function moveToUserPosition (container, currentDate, currentRate, coordinateSystem, ignoreX, ignoreY, mousePosition, fitFunction) { + let targetPoint = { + x: currentDate.valueOf(), + y: currentRate + } /* Put this point in the coordinate system of the UI.projects.foundations.spaces.chartingSpace.viewport */ - targetPoint = coordinateSystem.transformThisPoint(targetPoint) - targetPoint = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(targetPoint, container) + targetPoint = coordinateSystem.transformThisPoint(targetPoint) + targetPoint = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(targetPoint, container) - let displaceVector + let displaceVector - let targetNoZoom = UI.projects.foundations.spaces.chartingSpace.viewport.unTransformThisPoint(targetPoint) - let mouseNoZoom = UI.projects.foundations.spaces.chartingSpace.viewport.unTransformThisPoint(mousePosition) + let targetNoZoom = UI.projects.foundations.spaces.chartingSpace.viewport.unTransformThisPoint(targetPoint) + let mouseNoZoom = UI.projects.foundations.spaces.chartingSpace.viewport.unTransformThisPoint(mousePosition) - displaceVector = { - x: mouseNoZoom.x - targetNoZoom.x, - y: mouseNoZoom.y - targetNoZoom.y + displaceVector = { + x: mouseNoZoom.x - targetNoZoom.x, + y: mouseNoZoom.y - targetNoZoom.y + } + + if (ignoreX) { displaceVector.x = 0 } + if (ignoreY) { displaceVector.y = 0 } + + container.displace(displaceVector) +} + +function removeTime (datetime) { + if (datetime === undefined) { return } + + let dateOnly = new Date(Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS) * ONE_DAY_IN_MILISECONDS) + + return dateOnly +} + +function newUniqueId () { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8) + return v.toString(16) + }) +} + +function splitTextIntoPhrases (text, wordsPerLine) { + try { + let splittedLabel = text.split(' ') + let phrases = [] + let phrase = '' + let wordCount = 0 + for (let i = 0; i < splittedLabel.length; i++) { + phrase = phrase + splittedLabel[i] + wordCount++ + + if (i < splittedLabel.length - 1 && wordCount < wordsPerLine) { + phrase = phrase + ' ' + } + if (wordCount >= wordsPerLine) { + phrases.push(phrase) + phrase = '' + wordCount = 0 + } } - - if (ignoreX) { displaceVector.x = 0 } - if (ignoreY) { displaceVector.y = 0 } - - container.displace(displaceVector) -} - -function removeTime(datetime) { - if (datetime === undefined) { return } - - let dateOnly = new Date(Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS) * ONE_DAY_IN_MILISECONDS) - - return dateOnly -} - -function newUniqueId() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8) - return v.toString(16) - }) -} - -function splitTextIntoPhrases(text, wordsPerLine) { - try { - let splittedLabel = text.split(' ') - let phrases = [] - let phrase = '' - let wordCount = 0 - for (let i = 0; i < splittedLabel.length; i++) { - phrase = phrase + splittedLabel[i] - wordCount++ - - if (i < splittedLabel.length - 1 && wordCount < wordsPerLine) { - phrase = phrase + ' ' - } - if (wordCount >= wordsPerLine) { - phrases.push(phrase) - phrase = '' - wordCount = 0 - } - } - if (wordCount > 0) { - phrases.push(phrase) - } - return phrases - } catch (err) { - console.log(err.stack) - return [] + if (wordCount > 0) { + phrases.push(phrase) } + return phrases + } catch (err) { + console.log(err.stack) + return [] + } } -function getTextWidth(text) { - var metrics = browserCanvasContext.measureText(text); - return metrics.width; -} \ No newline at end of file +function getTextWidth (text) { + var metrics = browserCanvasContext.measureText(text) + return metrics.width +}