Header upgraded

This commit is contained in:
Luis Fernando Molina committed 2020-02-10 11:37:22 +01:00
1 parent 5661f9e429
commit 8716798206
3 files changed
+60 -13

No files matched your search

+1 -1
View File
@@ -178,7 +178,7 @@ maxDate.setDate(maxDate.getDate() + 365 * 1); // We might have charts that proj
const MIN_PLOTABLE_DATE = new Date(2015, 0, 1, 0, 0, 0);
const MAX_PLOTABLE_DATE = maxDate;
const TOP_SPACE_HEIGHT = 2
const TOP_SPACE_HEIGHT = 40
const COCKPIT_SPACE_HEIGHT = 30;
const BREAKPOINT_HEIGHT = 15;
const SIDE_PANEL_WIDTH = 450
+58 -11
View File
@@ -7,27 +7,45 @@ function newTopSpace () {
initialize: initialize
}
let container = newContainer()
container.initialize()
thisObject.container = container
thisObject.container = newContainer()
thisObject.container.initialize()
resize()
container.isDraggeable = false
thisObject.container.isDraggeable = false
let backgroundImage
let logoImage
return thisObject
function initialize () {
canvas.eventHandler.listenToEvent('Browser Resized', resize)
backgroundImage = new Image()
logoImage = new Image()
loadImage('superalgos-header-background', backgroundImage)
loadImage('superalgos-logo-for-color-background', logoImage)
function loadImage (name, image) {
const PATH = 'Images/'
image.onload = onImageLoad
image.fileName = name
function onImageLoad () {
image.canDraw = true
}
image.src = window.canvasApp.urlPrefix + PATH + name + '.png'
}
}
function resize () {
thisObject.container.frame.width = browserCanvas.width
thisObject.container.frame.height = TOP_SPACE_HEIGHT
container.frame.position.x = 0
thisObject.container.frame.position.x = 0
try {
container.frame.position.y = canvas.chartSpace.viewport.visibleArea.bottomLeft.y
thisObject.container.frame.position.y = canvas.chartSpace.viewport.visibleArea.bottomLeft.y
} catch (e) { }
}
@@ -54,19 +72,48 @@ function newTopSpace () {
}
function drawBackground () {
/* Solid Color */
let opacity = 1
browserCanvasContext.beginPath()
browserCanvasContext.rect(0, 0, thisObject.container.frame.width, thisObject.container.frame.height)
if (areWeRecording === true) {
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', ' + opacity + ')'
} else {
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', ' + opacity + ')'
}
browserCanvasContext.closePath()
browserCanvasContext.fill()
/* Background Image */
if (backgroundImage !== undefined) {
if (backgroundImage.canDraw === true) {
let imagePosition = {
x: 0,
y: 0
}
browserCanvasContext.drawImage(
backgroundImage, imagePosition.x,
imagePosition.y,
browserCanvas.width,
TOP_SPACE_HEIGHT - 2)
}
}
/* Logo Image */
if (logoImage !== undefined) {
if (logoImage.canDraw === true) {
let imagePosition = {
x: 10,
y: 0
}
browserCanvasContext.drawImage(
logoImage, imagePosition.x,
imagePosition.y,
150,
TOP_SPACE_HEIGHT - 2)
}
}
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ function newSplashScreen () {
canDrawLogo = true
}
logo.src = window.canvasApp.urlPrefix + 'Images/Superalgos-logo-horz-sm-t.png'
logo.src = window.canvasApp.urlPrefix + 'Images/superalgos-logo.png'
canvas.eventHandler.listenToEvent('Browser Resized', resize)
}