Performance Improvements

This commit is contained in:
Luis Fernando Molina committed 2020-02-12 18:40:33 +01:00
1 parent c270163a83
commit e8eaa7168f
5 files changed
+37 -22

No files matched your search

+4 -6
View File
@@ -85,7 +85,7 @@ function convertTimeFrameToName (pTimeFrame) {
function downloadText (filename, text) {
let element = document.createElement('a')
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text))
element.setAttribute('downloadText', filename)
element.setAttribute('download', filename)
element.style.display = 'none'
document.body.appendChild(element)
element.click()
@@ -228,16 +228,14 @@ function removeTime (datetime) {
return dateOnly
}
function printLabel (labelToPrint, x, y, opacity, fontSize) {
function printLabel (labelToPrint, x, y, opacity, fontSize, color) {
let labelPoint
if (color === undefined) { color = UI_COLOR.DARK }
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
let label = '' + labelToPrint
let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')'
browserCanvasContext.fillStyle = 'rgba(' + color + ', ' + opacity + ')'
browserCanvasContext.fillText(label, x, y)
}