This commit is contained in:
Luis Fernando Molina committed 2020-10-18 20:42:59 +02:00
1 parent 982be3be6d
commit bd6e1bc291
3 files changed
+66 -67

No files matched your search

+37 -52
View File
@@ -98,69 +98,54 @@ function newCanvas() {
function initialize() {
try {
browserResized()
initializeBrowserCanvas()
addCanvasEvents()
/* Instantiate all the children spaces of Canvas object */
thisObject.floatingSpace = newFloatingSpace()
thisObject.floatingSpace.initialize()
thisObject.animation = newAnimation()
thisObject.animation.initialize()
thisObject.topSpace = newTopSpace()
thisObject.topSpace.initialize()
let spaceInitializationMap = new Map()
let spaceAnimationMap = new Map()
let spaceDefinitionMap = new Map()
thisObject.cockpitSpace = newCockpitSpace()
thisObject.cockpitSpace.initialize()
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
let projectDefinition = PROJECTS_SCHEMA[i]
UI.projects[projectDefinition.propertyName] = {}
let projectInstance = UI.projects[projectDefinition.propertyName]
projectInstance.spaces = {}
thisObject.designSpace = newDesignSpace()
thisObject.designSpace.initialize()
/* Space Instantiation */
for (let j = 0; j < projectDefinition.spaces.length; j++) {
let spaceDefinition = projectDefinition.spaces[j]
projectInstance.spaces[spaceDefinition.propertyName] = eval(spaceDefinition.functionName + '()')
thisObject.panelSpace = newPanelSpace()
thisObject.panelSpace.initialize()
spaceInitializationMap.set(spaceDefinition.initializationIndex, projectInstance.spaces[spaceDefinition.propertyName])
spaceAnimationMap.set(spaceDefinition.animationIndex, projectInstance.spaces[spaceDefinition.propertyName])
spaceDefinitionMap.set(spaceDefinition.animationIndex, spaceDefinition)
}
thisObject.chartingSpace = newChartingSpace()
thisObject.chartingSpace.initialize()
/* Space Initialization */
for (let j = 0; j < projectDefinition.spaces.length; j++) {
let spaceInstance = spaceInitializationMap.get(j)
spaceInstance.initialize()
}
thisObject.sideSpace = newSideSpace()
thisObject.sideSpace.initialize()
/* Space Initialization */
for (let j = 0; j < projectDefinition.spaces.length; j++) {
let spaceInstance = spaceAnimationMap.get(j)
let spaceDefinition = spaceDefinitionMap.get(j)
thisObject.animation.addCallBackFunction(spaceDefinition.name + ' ' + 'Physics', spaceInstance.physics)
thisObject.animation.addCallBackFunction(spaceDefinition.name + ' ' + 'Draw', spaceInstance.draw)
}
}
thisObject.docSpace = newDocSpace()
thisObject.docSpace.initialize()
console.log(UI)
return
//thisObject.chatSpace = newChatSpace()
//thisObject.chatSpace.initialize()
thisObject.tutorialSpace = newTutorialSpace()
thisObject.tutorialSpace.initialize()
let animation = newAnimation()
animation.initialize()
thisObject.animation = animation
/* Spcaces Physics */
animation.addCallBackFunction('CockpitSpace Physics', thisObject.cockpitSpace.physics)
animation.addCallBackFunction('Floating Space Physics', thisObject.floatingSpace.physics)
animation.addCallBackFunction('Charting Space Physics', thisObject.chartingSpace.physics)
animation.addCallBackFunction('Design Space Physics', thisObject.designSpace.physics)
animation.addCallBackFunction('Panels Space Physics', thisObject.panelSpace.physics)
animation.addCallBackFunction('Side Space Physics', thisObject.sideSpace.physics)
animation.addCallBackFunction('Doc Space Physics', thisObject.docSpace.physics)
//animation.addCallBackFunction('Chat Space Physics', thisObject.chatSpace.physics)
animation.addCallBackFunction('Tutorial Space Physics', thisObject.tutorialSpace.physics)
/* Spcaces Drawing */
animation.addCallBackFunction('Floating Space Draw', thisObject.floatingSpace.draw)
animation.addCallBackFunction('Charting Space Draw', thisObject.chartingSpace.draw)
animation.addCallBackFunction('Panels Space', thisObject.panelSpace.draw)
animation.addCallBackFunction('CockpitSpace Draw', thisObject.cockpitSpace.draw)
animation.addCallBackFunction('Design Space Draw', thisObject.designSpace.draw)
animation.addCallBackFunction('Top Space Draw', thisObject.topSpace.draw)
animation.addCallBackFunction('Side Space Draw', thisObject.sideSpace.draw)
animation.addCallBackFunction('Doc Space Draw', thisObject.docSpace.draw)
//animation.addCallBackFunction('Chat Space Draw', thisObject.chatSpace.draw)
animation.addCallBackFunction('Tutorial Space Draw', thisObject.tutorialSpace.draw)
animation.start()
thisObject.animation.start()
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err.stack) }
}
@@ -537,7 +522,7 @@ function newCanvas() {
}
return
} else {
if (nodeOnFocus !== undefined) {
if (nodeOnFocus !== undefined) {
nodeOnFocus.payload.uiObject.shortcutKey = event.key
nodeOnFocus.payload.uiObject.valueAtAngle = false
nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + Alt + ' + event.key)
+8 -3
View File
@@ -1,7 +1,12 @@
/* Canvas is the root object that will contain all spaces and everything inside. */
let canvas
let PROJECTS
let canvas /* Canvas is the root object that will contain all spaces and everything inside. */
let PROJECTS_ARRAY
let PROJECTS_SCHEMA
let SCHEMAS_BY_PROJECT = new Map()
/* New Root object*/
let UI = {
projects: {}
}
/* User Interface Colors */
const UI_COLOR = {
+21 -12
View File
@@ -14,20 +14,29 @@ function newPostLoader() {
function start() {
try {
/* Moving PROJECTS to the global variable */
PROJECTS = window.PROJECTS
/* Moving PROJECTS_ARRAY to the global variable */
PROJECTS_ARRAY = window.PROJECTS
window.PROJECTS = undefined
setBrowserEvents()
setUpSchemas()
setupProjectsSchema()
function setUpSchemas() {
function setupProjectsSchema() {
callWebServer(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.length; i++) {
let project = PROJECTS[i]
for (let i = 0; i < PROJECTS_ARRAY.length; i++) {
let project = PROJECTS_ARRAY[i]
let schemas = {
array: {
appSchema: [],
@@ -54,12 +63,12 @@ function newPostLoader() {
let key = nodeDefinition.type
schemas.map.appSchema.set(key, nodeDefinition)
}
} catch(err) {
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) {startCanvas()}
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
totalWebServerCalls++
@@ -74,12 +83,12 @@ function newPostLoader() {
let key = nodeDefinition.type
schemas.map.docSchema.set(key, nodeDefinition)
}
} catch(err) {
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) {startCanvas()}
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
totalWebServerCalls++
@@ -94,12 +103,12 @@ function newPostLoader() {
let key = nodeDefinition.type
schemas.map.conceptSchema.set(key, nodeDefinition)
}
} catch(err) {
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) {startCanvas()}
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
}
}