diff --git a/Desktop/UI/WebAppLoader.js b/Desktop/UI/WebAppLoader.js index ce4e46b77b..5fa30402b0 100644 --- a/Desktop/UI/WebAppLoader.js +++ b/Desktop/UI/WebAppLoader.js @@ -25,6 +25,20 @@ function newWebAppLoader() { modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Function-Libraries' + '/' + fileName) } } + if (project.UI.nodeActionFunctions !== undefined) { + for (let j = 0; j < project.UI.nodeActionFunctions.length; j++) { + let fileName = project.UI.nodeActionFunctions[j].fileName + if (fileName === undefined) {fileName = project.UI.nodeActionFunctions[j].name.replaceAll(' ', '') + '.js'} + modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Node-Action-Functions' + '/' + fileName) + } + } + if (project.UI.systemActionFunctions !== undefined) { + for (let j = 0; j < project.UI.systemActionFunctions.length; j++) { + let fileName = project.UI.systemActionFunctions[j].fileName + if (fileName === undefined) {fileName = project.UI.systemActionFunctions[j].name.replaceAll(' ', '') + '.js'} + modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'System-Action-Functions' + '/' + fileName) + } + } if (project.UI.utilities !== undefined) { for (let j = 0; j < project.UI.utilities.length; j++) { let fileName = project.UI.utilities[j].fileName diff --git a/Platform/Client/httpInterface.js b/Platform/Client/httpInterface.js index c68c05eca0..7801218bf7 100644 --- a/Platform/Client/httpInterface.js +++ b/Platform/Client/httpInterface.js @@ -2227,6 +2227,11 @@ exports.newHttpInterface = function newHttpInterface() { SA.projects.foundations.utilities.httpResponses.respondWithFile(path, httpResponse) } break + case 'ProjectsMenu': { + let path = global.env.PATH_TO_PROJECTS + '/' + 'ProjectsMenu.json' + SA.projects.foundations.utilities.httpResponses.respondWithFile(path, httpResponse) + } + break case 'ListSpaceFiles': { let fs = SA.nodeModules.fs let allFiles = [] @@ -2290,6 +2295,14 @@ exports.newHttpInterface = function newHttpInterface() { SA.projects.foundations.utilities.httpResponses.respondWithProjectFolderFileList(httpResponse, 'Function-Libraries', 'UI') } break + case 'ListNodeActionFunctions': { + SA.projects.foundations.utilities.httpResponses.respondWithProjectFolderFileList(httpResponse, 'Node-Action-Functions', 'UI') + } + break + case 'ListSystemActionFunctions': { + SA.projects.foundations.utilities.httpResponses.respondWithProjectFolderFileList(httpResponse, 'System-Action-Functions', 'UI') + } + break case 'ListUtilitiesFiles': { SA.projects.foundations.utilities.httpResponses.respondWithProjectFolderFileList(httpResponse, 'Utilities', 'UI') } diff --git a/Platform/UI/AppLoader.js b/Platform/UI/AppLoader.js index 93b8745ae6..58efe1df82 100644 --- a/Platform/UI/AppLoader.js +++ b/Platform/UI/AppLoader.js @@ -69,6 +69,46 @@ function newAppLoader() { urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Function-Libraries' + '/' + fileName) } + modulesArray = modulesArray.concat(urlArray) + nodeActionFunctions() + } + } + + function nodeActionFunctions() { + let url = 'ListNodeActionFunctions' + httpRequest(undefined, url, onResponse) + + function onResponse(err, fileList) { + let urlArray = [] + let fileArray = JSON.parse(fileList) + for (let i = 0; i < fileArray.length; i++) { + let item = fileArray[i] + + let project = item[0] + let fileName = item[1] + urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Node-Action-Functions' + '/' + fileName) + } + + modulesArray = modulesArray.concat(urlArray) + systemActionFunctions() + } + } + + function systemActionFunctions() { + let url = 'ListSystemActionFunctions' + httpRequest(undefined, url, onResponse) + + function onResponse(err, fileList) { + let urlArray = [] + let fileArray = JSON.parse(fileList) + for (let i = 0; i < fileArray.length; i++) { + let item = fileArray[i] + + let project = item[0] + let fileName = item[1] + urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'System-Action-Functions' + '/' + fileName) + } + modulesArray = modulesArray.concat(urlArray) utilities() } diff --git a/Platform/UI/AppPostLoader.js b/Platform/UI/AppPostLoader.js index 9d5cccd813..7dfe23501b 100644 --- a/Platform/UI/AppPostLoader.js +++ b/Platform/UI/AppPostLoader.js @@ -24,6 +24,7 @@ function newAppPostLoader() { function onResponse(err, file) { UI.environment = JSON.parse(file) setupProjectsSchema() + setupProjectsMenu() } } @@ -36,6 +37,14 @@ function newAppPostLoader() { } } + function setupProjectsMenu() { + httpRequest(undefined, 'ProjectsMenu', onResponse) + + function onResponse(err, file) { + PROJECTS_MENU = JSON.parse(file) + } + } + function setupSchemas() { let totalWebServerCalls = 0 diff --git a/Platform/UI/Canvas.js b/Platform/UI/Canvas.js index c97dfc0dd2..00a9b037a5 100644 --- a/Platform/UI/Canvas.js +++ b/Platform/UI/Canvas.js @@ -112,6 +112,8 @@ function newCanvas() { projectInstance.utilities = {} projectInstance.globals = {} projectInstance.functionLibraries = {} + projectInstance.nodeActionFunctions = {} + projectInstance.systemActionFunctions = {} projectInstance.events.onMouseWheelMap = new Map() projectInstance.events.onMouseOverMap = new Map() @@ -153,6 +155,24 @@ function newCanvas() { } } + /* Set up Node Action Functions of this Project */ + if (projectDefinition.UI.nodeActionFunctions !== undefined) { + for (let j = 0; j < projectDefinition.UI.nodeActionFunctions.length; j++) { + let nodeActionFunctionsDefinition = projectDefinition.UI.nodeActionFunctions[j] + + projectInstance.nodeActionFunctions[nodeActionFunctionsDefinition.propertyName] = eval(nodeActionFunctionsDefinition.functionName + '()') + } + } + + /* Set up System Action Functions of this Project */ + if (projectDefinition.UI.systemActionFunctions !== undefined) { + for (let j = 0; j < projectDefinition.UI.systemActionFunctions.length; j++) { + let systemActionFunctionsDefinition = projectDefinition.UI.systemActionFunctions[j] + + projectInstance.systemActionFunctions[systemActionFunctionsDefinition.propertyName] = eval(systemActionFunctionsDefinition.functionName + '()') + } + } + /* Space Instantiation */ if (projectDefinition.UI.spaces === undefined) { continue } for (let j = 0; j < projectDefinition.UI.spaces.length; j++) { diff --git a/Platform/WebServer/css/menu.css b/Platform/WebServer/css/menu.css new file mode 100644 index 0000000000..2adf7ecb5d --- /dev/null +++ b/Platform/WebServer/css/menu.css @@ -0,0 +1,94 @@ +#topMenu { + position: fixed; + top: 0; + left: 200px; + z-index: 1; + font-family: 'Saira Condensed'; + font-weight: bold; + letter-spacing: 0.2px; +} + +nav il { + position: relative; + display: block; + opacity: 1; + cursor: pointer; +} + +nav > ul > il > a{ + background:rgb(0, 0, 0, 0); +} + +nav > ul > il > ul > il a{ + background:rgb(0, 0, 0, 0.5); +} + +nav il > ul { + padding: 0; + position: absolute; + pointer-events: none; +} + +nav > ul { + margin: 0; + display:flex; +} + +nav > ul > il { + pointer-events: all; + opacity: 1; + text-decoration: underline; +} + +ul il a { + white-space: nowrap; + display: block; +} + +il:hover > ul { + pointer-events: initial; +} + +il:hover > ul > il, +ul:hover > il { + opacity: 1; +} + +nav > ul > il il ul { + transform: translateX(100%); + top: 0; + right: 0; +} + +nav { + width: 80%; + margin: auto; +} + +nav a { + background:rgb(0, 0, 0, 0.5); + color:#FFF; + height: 38px; + margin: 0px 3px 3px 0px; + padding: 8px 10px; + box-sizing: border-box; + border-radius: 5px; + box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.5); + position: relative; + transition: 0.1s; +} + +nav a:hover { + background:rgb(2 149 170); + transition: 0.1s; +} + +nav > ul > il > ul > il { + transition: opacity 0.1s; + opacity: 0; +} + +il > ul > il > ul > il { + transition: opacity 0.1s; + opacity: 0; +} diff --git a/Platform/WebServer/css/tutorial.css b/Platform/WebServer/css/tutorial.css index f727f61b4c..984fe2c30b 100644 --- a/Platform/WebServer/css/tutorial.css +++ b/Platform/WebServer/css/tutorial.css @@ -9,6 +9,7 @@ background-color: #fdfdfd; -webkit-transition-duration: 1s; transition-duration: 1s; caret-color: transparent; +cursor: grab; } .tutorial-summary { @@ -28,6 +29,7 @@ font-weight: bold; .tutorial-content-div { overflow-y: auto; overflow-x: clip; + cursor: auto; } ::-webkit-scrollbar { diff --git a/Platform/WebServer/index.html b/Platform/WebServer/index.html index 5eca7795da..bd6c2216bc 100644 --- a/Platform/WebServer/index.html +++ b/Platform/WebServer/index.html @@ -13,12 +13,19 @@ + @@ -305,7 +312,6 @@ - +