Bye Splash Screen

This commit is contained in:
Luis Fernando Molina committed 2020-10-14 11:36:33 +02:00
1 parent ea7af51a62
commit fa326dadb6
20 files changed
+23 -192

No files matched your search

+1 -1
View File
@@ -167,7 +167,7 @@ function newAnimation() {
}
function clearBrowserCanvas() {
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
browserCanvasContext.clearRect(0, 0, browserCanvas.width, browserCanvas.height)
}
-8
View File
@@ -1,9 +1,6 @@
let browserCanvasContext // The context of the canvas object.
let stepsInitializationCounter = 0 // This counter the initialization steps required to be able to turn off the splash screen.
let marketInitializationCounter = 0 // This counter the initialization of markets required to be able to turn off the splash screen.
function newCanvas() {
const MODULE_NAME = 'Canvas'
const ERROR_LOG = true
@@ -39,7 +36,6 @@ function newCanvas() {
panelsSpace: undefined,
cockpitSpace: undefined,
designSpace: undefined,
splashScreen: undefined,
animation: undefined,
mouse: undefined,
shorcutNumbers: new Map(),
@@ -92,7 +88,6 @@ function newCanvas() {
browserCanvas.detachEvent('onmousewheel', onMouseWheel) // IE 6/7/8
}
thisObject.splashScreen = undefined
lastContainerMouseOver = undefined
thisObject.mouse = undefined
@@ -138,8 +133,6 @@ function newCanvas() {
thisObject.tutorialSpace = newTutorialSpace()
thisObject.tutorialSpace.initialize()
thisObject.splashScreen = newSplashScreen()
let animation = newAnimation()
animation.initialize()
@@ -167,7 +160,6 @@ function newCanvas() {
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.addCallBackFunction('Splash Screen Draw', thisObject.splashScreen.draw)
animation.start()
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err.stack) }
+1 -1
View File
@@ -126,7 +126,7 @@ function newWorkspace() {
runTasksAndSessions()
thisObject.enabled = true
canvas.cockpitSpace.initializePosition()
canvas.splashScreen.initialize()
CAN_SPACES_DRAW = true
savingWorkspaceIntervalId = setInterval(saveWorkspace, 60000)
isInitialized = true
}
+1 -1
View File
@@ -174,7 +174,7 @@ function newUiObjectConstructor() {
uiObject.isVisibleFunction = canvas.floatingSpace.isThisPointVisible
let menuItemsInitialValues = getMenuItemsInitialValues(uiObject, floatingObject, payload)
let schemaNode = APP_SCHEMA_MAP.get(payload.node.type)
let schemaNode = getNodeDefinition(payload.node)
if (schemaNode === undefined) {
console.log(payload.node.type + ' node found at App Schema. This node will not be created. ')
return
+1 -1
View File
@@ -231,7 +231,7 @@ let ARE_WE_RECORDING_A_MARKET_PANORAMA = false
let PANORAMA_WAS_PANNED = false
let CURRENT_PANORAMA_POSITION = 0
let canWeDraw = false // This global variable regulates when spaces can or can not draw their contents.
let CAN_SPACES_DRAW = false // This global variable regulates when spaces can or can not draw their contents.
function toRadians(angle) {
return angle * (Math.PI / 180);
-1
View File
@@ -159,7 +159,6 @@
<Compile Include="Panels\LayersPanel.js" />
<Compile Include="Panels\TimeControlPanel.js" />
<Compile Include="coordinateSystem.js" />
<Compile Include="SplashScreen.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="ProductStorage.js">
+1 -1
View File
@@ -414,7 +414,7 @@ function newChartingSpace() {
}
function draw() {
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
if (thisObject.visible === false) { return }
drawBackground()
+1 -1
View File
@@ -118,7 +118,7 @@ function newChatSpace() {
}
function draw() {
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
if (isInitialized === false) { return }
borders()
thisObject.sidePanelTab.draw()
+1 -1
View File
@@ -203,7 +203,7 @@ function newCockpitSpace() {
}
function draw() {
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
thisObject.container.frame.draw(false, false)
drawBackground()
+1 -1
View File
@@ -109,7 +109,7 @@ function newDesignSpace() {
function draw() {
if (thisObject.workspace === undefined) { return }
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
thisObject.workspace.draw()
}
}
+1 -1
View File
@@ -116,7 +116,7 @@ function newDocSpace() {
}
function draw() {
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
if (isInitialized === false) { return }
borders()
thisObject.sidePanelTab.draw()
+1 -1
View File
@@ -554,7 +554,7 @@ function newFloatingSpace() {
}
function draw() {
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
if (visible === false) { return }
drawBackground()
thisObject.floatingLayer.draw()
+1 -1
View File
@@ -336,7 +336,7 @@ function newPanelsSpace() {
}
function draw() {
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
if (thisObject.visible !== true) { return }
thisObject.container.frame.draw(false, false)
+1 -1
View File
@@ -91,7 +91,7 @@ function newSideSpace() {
}
function draw() {
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
if (isInitialized === false) { return }
borders()
thisObject.sidePanelTab.draw()
+1 -1
View File
@@ -54,7 +54,7 @@ function newTopSpace() {
}
function draw() {
if (canWeDraw === false) { return }
if (CAN_SPACES_DRAW === false) { return }
thisObject.container.frame.draw(false, false)
drawBackground()
-160
View File
@@ -1,160 +0,0 @@
/*
The Splash Screen is to show some 'loading...' controls while the app is being loaded on the background. After the loading is complete the Splash Screens dissapears for good.
*/
function newSplashScreen() {
let thisObject = {
container: undefined,
draw: draw,
timeMachines: [],
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
}
let container = newContainer()
container.initialize()
thisObject.container = container
resize()
container.frame.containerName = 'Splash Screen'
container.frame.position.x = 0
container.frame.position.y = 0
container.isDraggeable = false
let fadeOutCounter = 0
let opacity = 1
let logo
let canDrawLogo = false
let isInitialized = false
let splashScreenNeeded = true
return thisObject
function initialize() {
logo = new Image()
logo.onload = onImageLoad
function onImageLoad() {
canDrawLogo = true
}
logo.src = 'Images/superalgos-logo.png'
canvas.eventHandler.listenToEvent('Browser Resized', resize)
isInitialized = true
}
function resize() {
thisObject.container.frame.width = browserCanvas.width
thisObject.container.frame.height = browserCanvas.height
}
function draw() {
if (isInitialized === false) { return }
if (splashScreenNeeded === false) {
stepsInitializationCounter = 100
canDrawLogo = false
fadeOutCounter++
if (fadeOutCounter > 2) {
return
}
opacity = opacity - 1
}
thisObject.container.frame.draw(false, false)
/* Set the background. */
browserCanvasContext.beginPath()
browserCanvasContext.rect(0, 0, thisObject.container.frame.width, thisObject.container.frame.height)
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', ' + opacity + ')'
browserCanvasContext.closePath()
browserCanvasContext.fill()
if (canDrawLogo === false) { return }
/* First the AA Logo. */
let imageHeight = 192 / 2
let imageWidth = 720 / 2
let yDisplacement = -60
let xDisplacement = -60
let imagePoint = {
x: thisObject.container.frame.width * 1 / 2 - imageWidth / 2 + xDisplacement,
y: thisObject.container.frame.height * 1 / 2 - imageHeight / 2 + yDisplacement
}
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint)
browserCanvasContext.drawImage(logo, imagePoint.x, imagePoint.y, imageWidth, imageHeight)
/* Second the % of Advance. */
let label = '' + Math.trunc(stepsInitializationCounter) + ' %'
stepsInitializationCounter = stepsInitializationCounter + 5.0
if (stepsInitializationCounter > 99) {
splashScreenNeeded = false
canWeDraw = true
stepsInitializationCounter = 99
}
let fontSize = 15
let labelPoint = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize * FONT_ASPECT_RATIO - 22,
y: thisObject.container.frame.height / 2 + fontSize / 2 + fontSize * 0.1 + 90 + yDisplacement
}
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(0, 0, 0, ' + opacity + ')'
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
let title
let titlePoint
/* Algo Bots Competitions Sub Title */
fontSize = 35
title = 'Beta 6'
titlePoint = {
x: thisObject.container.frame.width / 2 - title.length / 2 * fontSize * FONT_ASPECT_RATIO - 20,
y: thisObject.container.frame.height / 2 + 70 + yDisplacement
}
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.font = 'Saira Condensed'
browserCanvasContext.fillStyle = 'rgba(0, 0, 0, ' + opacity + ')'
browserCanvasContext.fillText(title, titlePoint.x, titlePoint.y)
}
function getContainer(point) {
var container
/* First we check if this point is inside this space. */
if (thisObject.container.frame.isThisPointHere(point) === true) {
/* Now we see which is the inner most container that has it */
// add validation of inner most containers here.
/* The point does not belong to any inner container, so we return the current container. */
return thisObject.container
} else {
/* This point does not belong to this space. */
return undefined
}
}
}
+4 -4
View File
@@ -10,9 +10,9 @@ function nodeBranchToArray(node, nodeType) {
return resultArray
function scanNodeBranch(startingNode) {
if (startingNode === undefined) {return}
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
if (startingNode === undefined) { return }
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
if (startingNode.type === nodeType) {
@@ -24,7 +24,7 @@ function nodeBranchToArray(node, nodeType) {
let lastNodePropertyName
for (let i = 0; i < nodeDefinition.properties.length; i++) {
let property = nodeDefinition.properties[i]
if (lastNodePropertyName === property.name) {continue} // Some nodes have a single property por multiple child node types. We need to check repeated properties only once so as no to duplicate results.
if (lastNodePropertyName === property.name) { continue } // Some nodes have a single property por multiple child node types. We need to check repeated properties only once so as no to duplicate results.
switch (property.type) {
case 'node': {
scanNodeBranch(startingNode[property.name])
+1 -1
View File
@@ -14,7 +14,7 @@ function getHiriarchyMap(rootNode) {
hiriatchyMap.set(node.id, node)
/* Now we go down through all this node children */
let nodeDefinition = APP_SCHEMA_MAP.get(node.type)
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition === undefined) { return }
if (nodeDefinition.properties !== undefined) {
+1 -1
View File
@@ -17,7 +17,7 @@ function findNodeInNodeMesh(node, nodeType, nodeName, connectedViaPayload, findI
if (nodeFound !== undefined) { return }
if (depth >= MAX_DEPTH) {return}
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
if (nodeType !== undefined) {
+4 -4
View File
@@ -6,7 +6,7 @@ function isMissingChildren(startingNode, checkNode, checkReferenceParent) {
if (startingNode === undefined) { return }
if (checkNode === undefined) { return }
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
/* We scan through this node children */
@@ -69,7 +69,7 @@ function findChildReferencingThisNode(startingNode, checkNode) {
if (startingNode === undefined) { return }
if (checkNode === undefined) { return }
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
/* We scan through this node children */
@@ -156,7 +156,7 @@ function findChildIndexAtParentNode(startingNode) {
let parentNode = startingNode.payload.parentNode
let nodeDefinition = APP_SCHEMA_MAP.get(parentNode.type)
let nodeDefinition = getNodeDefinition(parentNode)
if (nodeDefinition === undefined) { return }
/* We scan through this parent node children */
@@ -194,7 +194,7 @@ function isMissingChildrenByName(startingNode, nodeName) {
*/
if (startingNode === undefined) { return }
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
/* We scan through this node children */