Merge remote-tracking branch 'upstream/develop' into chart-scale-issue-314

This commit is contained in:
Ben Golden committed 2021-01-13 13:58:35 +00:00
commit cbf6d0c778
1708 files changed
+180539 -2162

No files matched your search

+85 -19
View File
@@ -40,13 +40,19 @@ function newAppPostLoader() {
let schemas = {
array: {
appSchema: [],
docSchema: [],
conceptSchema: []
docsNodeSchema: [],
docsConceptSchema: [],
docsTopicSchema: [],
docsTutorialSchema: [],
docsBookSchema: []
},
map: {
appSchema: new Map(),
docSchema: new Map(),
conceptSchema: new Map()
docsNodeSchema: new Map(),
docsConceptSchema: new Map(),
docsTopicSchema: new Map(),
docsTutorialSchema: new Map(),
docsBookSchema: new Map()
}
}
SCHEMAS_BY_PROJECT.set(project, schemas)
@@ -59,9 +65,9 @@ function newAppPostLoader() {
schemas.array.appSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.appSchema.length; j++) {
let nodeDefinition = schemas.array.appSchema[j]
let key = nodeDefinition.type
schemas.map.appSchema.set(key, nodeDefinition)
let schemaDocument = schemas.array.appSchema[j]
let key = schemaDocument.type
schemas.map.appSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
@@ -72,16 +78,16 @@ function newAppPostLoader() {
}
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/DocSchema', onResponseDocSchema)
httpRequest(undefined, 'Schema/' + project + '/DocsNodeSchema', onResponseDocSchema)
function onResponseDocSchema(err, schema) {
try {
schemas.array.docSchema = JSON.parse(schema)
schemas.array.docsNodeSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.docSchema.length; j++) {
let nodeDefinition = schemas.array.docSchema[j]
let key = nodeDefinition.type
schemas.map.docSchema.set(key, nodeDefinition)
for (let j = 0; j < schemas.array.docsNodeSchema.length; j++) {
let schemaDocument = schemas.array.docsNodeSchema[j]
let key = schemaDocument.type
schemas.map.docsNodeSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
@@ -92,16 +98,76 @@ function newAppPostLoader() {
}
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/ConceptSchema', onResponseConceptSchema)
httpRequest(undefined, 'Schema/' + project + '/DocsConceptSchema', onResponseConceptSchema)
function onResponseConceptSchema(err, schema) {
try {
schemas.array.conceptSchema = JSON.parse(schema)
schemas.array.docsConceptSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.conceptSchema.length; j++) {
let nodeDefinition = schemas.array.conceptSchema[j]
let key = nodeDefinition.type
schemas.map.conceptSchema.set(key, nodeDefinition)
for (let j = 0; j < schemas.array.docsConceptSchema.length; j++) {
let schemaDocument = schemas.array.docsConceptSchema[j]
let key = schemaDocument.type
schemas.map.docsConceptSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/DocsTopicSchema', onResponseTopicSchema)
function onResponseTopicSchema(err, schema) {
try {
schemas.array.docsTopicSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.docsTopicSchema.length; j++) {
let schemaDocument = schemas.array.docsTopicSchema[j]
let key = schemaDocument.type
schemas.map.docsTopicSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/DocsTutorialSchema', onResponseTutorialSchema)
function onResponseTutorialSchema(err, schema) {
try {
schemas.array.docsTutorialSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.docsTutorialSchema.length; j++) {
let schemaDocument = schemas.array.docsTutorialSchema[j]
let key = schemaDocument.type
schemas.map.docsTutorialSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/DocsBookSchema', onResponseBookSchema)
function onResponseBookSchema(err, schema) {
try {
schemas.array.docsBookSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.docsBookSchema.length; j++) {
let schemaDocument = schemas.array.docsBookSchema[j]
let key = schemaDocument.type
schemas.map.docsBookSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
+46 -30
View File
@@ -5,7 +5,7 @@ function newCanvas() {
const MODULE_NAME = 'Canvas'
const ERROR_LOG = true
const logger = newWebDebugLog()
/* Mouse event related variables. */
@@ -51,7 +51,7 @@ function newCanvas() {
function finalize() {
try {
UI.projects.superalgos.spaces.tutorialSpace.finalize()
UI.projects.superalgos.spaces.docSpace.finalize()
UI.projects.superalgos.spaces.docsSpace.finalize()
//thisObject.chatSpace.finalize()
UI.projects.superalgos.spaces.sideSpace.finalize()
UI.projects.superalgos.spaces.chartingSpace.finalize()
@@ -121,6 +121,33 @@ function newCanvas() {
let spaceAnimationDrawMap = new Map()
let spaceDefinitionDrawMap = new Map()
/* Set up Globals of this Project */
if (projectDefinition.UI.globals !== undefined) {
for (let j = 0; j < projectDefinition.UI.globals.length; j++) {
let globalDefinition = projectDefinition.UI.globals[j]
projectInstance.globals[globalDefinition.propertyName] = eval(globalDefinition.functionName + '()')
}
}
/* Set up Utilities of this Project */
if (projectDefinition.UI.utilities !== undefined) {
for (let j = 0; j < projectDefinition.UI.utilities.length; j++) {
let utilityDefinition = projectDefinition.UI.utilities[j]
projectInstance.utilities[utilityDefinition.propertyName] = eval(utilityDefinition.functionName + '()')
}
}
/* Set up Function Libraries of this Project */
if (projectDefinition.UI.functionLibraries !== undefined) {
for (let j = 0; j < projectDefinition.UI.functionLibraries.length; j++) {
let functionLibraryDefinition = projectDefinition.UI.functionLibraries[j]
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
}
}
/* Space Instantiation */
if (projectDefinition.UI.spaces === undefined) { continue }
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
@@ -185,33 +212,6 @@ function newCanvas() {
thisObject.animation.addCallBackFunction(spaceDefinition.name + ' ' + 'Draw', spaceInstance.draw)
}
}
/* Set up Utilities of this Project */
if (projectDefinition.UI.utilities !== undefined) {
for (let j = 0; j < projectDefinition.UI.utilities.length; j++) {
let utilityDefinition = projectDefinition.UI.utilities[j]
projectInstance.utilities[utilityDefinition.propertyName] = eval(utilityDefinition.functionName + '()')
}
}
/* Set up Globals of this Project */
if (projectDefinition.UI.globals !== undefined) {
for (let j = 0; j < projectDefinition.UI.globals.length; j++) {
let globalDefinition = projectDefinition.UI.globals[j]
projectInstance.globals[globalDefinition.propertyName] = eval(globalDefinition.functionName + '()')
}
}
/* Set up Function Libraries of this Project */
if (projectDefinition.UI.functionLibraries !== undefined) {
for (let j = 0; j < projectDefinition.UI.functionLibraries.length; j++) {
let functionLibraryDefinition = projectDefinition.UI.functionLibraries[j]
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
}
}
}
thisObject.animation.start()
@@ -367,7 +367,18 @@ function newCanvas() {
}
async function onKeyDown(event) {
if (EDITOR_ON_FOCUS === true) { return }
if (EDITOR_ON_FOCUS === true) {
/*
We will fordward the event to whoever is
controlling the editor.
*/
window.editorController.onKeyDown(event)
return
}
/* When the Docs is Visible, we do not process key down events of the Designer Space. */
if (UI.projects.superalgos.spaces.docsSpace.isVisible === true) {
return
}
thisObject.mouse.event = event
thisObject.mouse.action = 'key down'
@@ -453,7 +464,12 @@ function newCanvas() {
if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true && event.shiftKey === true && event.keyCode === 123) { // Dev Tool when used with F12
if (nodeOnFocus !== undefined) {
console.log('Node on Focus:')
console.log(nodeOnFocus)
if (nodeOnFocus.config !== undefined) {
console.log('Node on Focus Config:')
console.log(JSON.stringify(JSON.parse(nodeOnFocus.config)).replaceAll('"', '\"'))
}
return
}
}
-147
View File
@@ -1,147 +0,0 @@
function newAppPostLoader() {
const MODULE_NAME = 'Post Loader'
const ERROR_LOG = true
const logger = newWebDebugLog()
let thisObject = {
start: start
}
return thisObject
function start() {
try {
/* Moving PROJECTS_ARRAY to the global variable */
PROJECTS_ARRAY = window.PROJECTS
window.PROJECTS = undefined
setBrowserEvents()
setupProjectsSchema()
function setupProjectsSchema() {
httpRequest(undefined, 'ProjectsSchema', onResponse)
function onResponse(err, file) {
PROJECTS_SCHEMA = JSON.parse(file)
setupSchemas()
}
}
function setupSchemas() {
let totalWebServerCalls = 0
let webServerResponses = 0
for (let i = 0; i < PROJECTS_ARRAY.length; i++) {
let project = PROJECTS_ARRAY[i]
let schemas = {
array: {
appSchema: [],
docSchema: [],
conceptSchema: []
},
map: {
appSchema: new Map(),
docSchema: new Map(),
conceptSchema: new Map()
}
}
SCHEMAS_BY_PROJECT.set(project, schemas)
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/AppSchema', onResponseAppSchema)
function onResponseAppSchema(err, schema) {
try {
schemas.array.appSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.appSchema.length; j++) {
let nodeDefinition = schemas.array.appSchema[j]
let key = nodeDefinition.type
schemas.map.appSchema.set(key, nodeDefinition)
}
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/DocSchema', onResponseDocSchema)
function onResponseDocSchema(err, schema) {
try {
schemas.array.docSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.docSchema.length; j++) {
let nodeDefinition = schemas.array.docSchema[j]
let key = nodeDefinition.type
schemas.map.docSchema.set(key, nodeDefinition)
}
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/ConceptSchema', onResponseConceptSchema)
function onResponseConceptSchema(err, schema) {
try {
schemas.array.conceptSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.conceptSchema.length; j++) {
let nodeDefinition = schemas.array.conceptSchema[j]
let key = nodeDefinition.type
schemas.map.conceptSchema.set(key, nodeDefinition)
}
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
}
}
function startCanvas() {
/* If this method is executed for a second time, it should finalize the current execution structure */
if (canvas !== undefined) { canvas.finalize() }
canvas = newCanvas()
canvas.initialize()
}
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] start -> err = ' + err.stack) }
}
}
function setBrowserEvents() {
window.onbeforeunload = saveWorkspace
/* handles backspace and refresh(F5) from keyboard */
window.manageBackRefresh = function (event) {
var tag = event.target.tagName.toLowerCase()
if (event.keyCode === 8 && tag !== 'input' && tag !== 'textarea') { // Backbutton pressed
saveWorkspace()
} else if (event.keyCode === 116) { // F5 pressed
saveWorkspace()
}
}
window.addEventListener('keydown', window.manageBackRefresh)
function saveWorkspace() {
UI.projects.superalgos.spaces.designSpace.workspace.save()
}
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
function getNodeDefinition(node, project) {
function getSchemaDocument(node, project) {
if (node === null || node === undefined) {
console.log('[Error] Can not get the node definition of a null or undefined node ')
console.log('[Error] Can not get the schema document of a null or undefined node ')
return
}
if (project === undefined) { project = node.project }