Autoformatter applied on all js files

This commit is contained in:
Luis Fernando Molina committed 2019-02-23 10:32:06 +01:00
1 parent 72c1017b20
commit c627aedcf6
59 files changed
+9087 -10892

No files matched your search

+95 -117
View File
@@ -1,180 +1,158 @@
/*
/*
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() {
function newSplashScreen () {
var thisObject = {
container: undefined,
draw: draw,
timeMachines: [],
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
}
var thisObject = {
container: undefined,
draw: draw,
timeMachines: [],
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
};
var container = newContainer()
container.initialize()
thisObject.container = container
resize()
var container = newContainer();
container.initialize();
thisObject.container = container;
container.displacement.containerName = 'Splash Screen'
container.frame.containerName = 'Splash Screen'
resize();
container.frame.position.x = 0
container.frame.position.y = 0
container.displacement.containerName = "Splash Screen";
container.frame.containerName = "Splash Screen";
container.isDraggeable = false
container.frame.position.x = 0;
container.frame.position.y = 0;
let fadeOutCounter = 0
let opacity = 1
container.isDraggeable = false;
let logo
let canDrawLogo = false
return thisObject
let fadeOutCounter = 0;
let opacity = 1;
function initialize () {
logo = new Image()
let logo;
let canDrawLogo = false;
return thisObject;
function initialize() {
logo = new Image();
logo.onload = onImageLoad;
function onImageLoad() {
canDrawLogo = true;
}
logo.src = window.canvasApp.urlPrefix + "Images/aa-logo.png";
window.canvasApp.eventHandler.listenToEvent("Browser Resized", resize);
logo.onload = onImageLoad
function onImageLoad () {
canDrawLogo = true
}
function resize() {
logo.src = window.canvasApp.urlPrefix + 'Images/aa-logo.png'
thisObject.container.frame.width = browserCanvas.width;
thisObject.container.frame.height = browserCanvas.height;
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
}
function resize () {
thisObject.container.frame.width = browserCanvas.width
thisObject.container.frame.height = browserCanvas.height
}
function draw () {
if (splashScreenNeeded === false) {
stepsInitializationCounter = 100
fadeOutCounter++
if (fadeOutCounter > 20) {
return
}
opacity = opacity - 0.1
}
function draw() {
if (splashScreenNeeded === false) {
stepsInitializationCounter = 100;
fadeOutCounter++;
if (fadeOutCounter > 20) {
return;
}
opacity = opacity - 0.1;
}
thisObject.container.frame.draw(false, false);
thisObject.container.frame.draw(false, false)
/* Set the background. */
browserCanvasContext.beginPath();
browserCanvasContext.beginPath()
browserCanvasContext.rect(0, 0, thisObject.container.frame.width, thisObject.container.frame.height);
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', ' + opacity + ')';
browserCanvasContext.rect(0, 0, thisObject.container.frame.width, thisObject.container.frame.height)
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', ' + opacity + ')'
browserCanvasContext.closePath();
browserCanvasContext.closePath()
browserCanvasContext.fill();
browserCanvasContext.fill()
if (canDrawLogo === false) { return; }
if (canDrawLogo === false) { return }
/* First the AA Logo. */
let imageHeight = 96;
let imageWidth = 480;
let yDisplacement = -50;
let imageHeight = 96
let imageWidth = 480
let yDisplacement = -50
let imagePoint = {
x: thisObject.container.frame.width * 1 / 2 - imageWidth / 2,
y: thisObject.container.frame.height * 1 / 2 - imageHeight / 2 + yDisplacement
};
let imagePoint = {
x: thisObject.container.frame.width * 1 / 2 - imageWidth / 2,
y: thisObject.container.frame.height * 1 / 2 - imageHeight / 2 + yDisplacement
}
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint);
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint)
browserCanvasContext.drawImage(logo, imagePoint.x, imagePoint.y, imageWidth, imageHeight);
browserCanvasContext.drawImage(logo, imagePoint.x, imagePoint.y, imageWidth, imageHeight)
/* Second the % of Advance. */
let label = '' + Math.trunc(stepsInitializationCounter) + ' %';
stepsInitializationCounter = stepsInitializationCounter + 0.5;
let label = '' + Math.trunc(stepsInitializationCounter) + ' %'
stepsInitializationCounter = stepsInitializationCounter + 0.5
if (stepsInitializationCounter > 99) {
if (stepsInitializationCounter > 99) {
splashScreenNeeded = false
stepsInitializationCounter = 99
}
splashScreenNeeded = false;
stepsInitializationCounter = 99;
}
let fontSize = 10
let labelPoint = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize * FONT_ASPECT_RATIO - 25,
y: thisObject.container.frame.height / 2 + fontSize / 2 + fontSize * 0.1 + 80 + yDisplacement
}
let fontSize = 10;
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(0, 0, 0, ' + opacity + ')'
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
let labelPoint = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize * FONT_ASPECT_RATIO - 25,
y: thisObject.container.frame.height / 2 + fontSize / 2 + fontSize * 0.1 + 80 + 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;
let title
let titlePoint
/* Algo Bots Competitions Sub Title */
fontSize = 15;
fontSize = 15
title = "Trading Bots Competitions Platform"
title = 'Trading Bots Competitions Platform'
titlePoint = {
x: thisObject.container.frame.width / 2 - title.length / 2 * fontSize * FONT_ASPECT_RATIO - 20,
y: thisObject.container.frame.height / 2 - fontSize * 2 + 80 + yDisplacement
};
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY;
browserCanvasContext.fillStyle = 'rgba(0, 0, 0, ' + opacity + ')';
browserCanvasContext.fillText(title, titlePoint.x, titlePoint.y);
titlePoint = {
x: thisObject.container.frame.width / 2 - title.length / 2 * fontSize * FONT_ASPECT_RATIO - 20,
y: thisObject.container.frame.height / 2 - fontSize * 2 + 80 + yDisplacement
}
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(0, 0, 0, ' + opacity + ')'
browserCanvasContext.fillText(title, titlePoint.x, titlePoint.y)
}
function getContainer(point) {
var container;
function getContainer (point) {
var container
/* First we check if this point is inside this space. */
if (this.container.frame.isThisPointHere(point) === true) {
if (this.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 this.container;
} else {
return this.container
} else {
/* This point does not belong to this space. */
return undefined;
}
return undefined
}
}
}
}