Merge Develop into Master

This commit is contained in:
Luis Fernando Molina committed 2021-08-05 13:07:45 +02:00
1 parent 2d7ed1d085
commit 2bb78c50fb
4223 files changed
+1207152 -16544

No files matched your search

+8 -8
View File
@@ -116,23 +116,23 @@ function newAnimation() {
for (const [key, timeConsumed] of performanceMap.entries()) {
row++
let labelToPrint = key + ' ' + timeConsumed.toFixed(4)
UI.projects.superalgos.utilities.drawPrint.printLabel(labelToPrint, 10,undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
UI.projects.foundations.utilities.drawPrint.printLabel(labelToPrint, 10,undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
let percentage = timeConsumed * 100 / totalTimeConsumed
labelToPrint = key + ' ' + percentage.toFixed(1) + '%'
UI.projects.superalgos.utilities.drawPrint.printLabel(labelToPrint, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
UI.projects.foundations.utilities.drawPrint.printLabel(labelToPrint, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
}
/* Other Variables */
row++
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable1, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
UI.projects.foundations.utilities.drawPrint.printLabel(DEBUG.variable1, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
row++
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable2, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
UI.projects.foundations.utilities.drawPrint.printLabel(DEBUG.variable2, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
row++
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable3, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
UI.projects.foundations.utilities.drawPrint.printLabel(DEBUG.variable3, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
row++
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable4, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
UI.projects.foundations.utilities.drawPrint.printLabel(DEBUG.variable4, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
row++
UI.projects.superalgos.utilities.drawPrint.printLabel('Animation Frame Per Seconds: ' + ANIMATION_FRAME_PER_SECONDS, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
UI.projects.foundations.utilities.drawPrint.printLabel('Animation Frame Per Seconds: ' + ANIMATION_FRAME_PER_SECONDS, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
}
/* Video Recording */
@@ -144,7 +144,7 @@ function newAnimation() {
/* Panorama Recording */
if (ARE_WE_RECORDING_A_MARKET_PANORAMA === true) {
if (PANORAMA_WAS_PANNED === true) {
UI.projects.superalgos.utilities.download.addToMarketPanorama()
UI.projects.foundations.utilities.download.addToMarketPanorama()
PANORAMA_WAS_PANNED = false
}
}
+7 -7
View File
@@ -177,13 +177,13 @@ function newAppLoader() {
function defaultPlotters() {
return [
'Plotters/Superalgos/Candles/Plotters-Candles-Volumes/Candles.js',
'Plotters/Superalgos/Candles/Plotters-Candles-Volumes/CandlePanel.js',
'Plotters/Superalgos/Candles/Plotters-Candles-Volumes/Volumes.js',
'Plotters/Superalgos/Candles/Plotters-Candles-Volumes/VolumePanel.js',
'Plotters/Superalgos/Bollinger/Plotters-Bollinger-Bands/BollingerBands.js',
'Plotters/Superalgos/Bollinger/Plotters-Bollinger-Bands/BollingerBandsPanel.js',
'Plotters/Superalgos/Bollinger/Plotters-Bollinger-Bands/PercentageBandwidth.js'
'Plotters/Foundations/Candles/Plotters-Candles-Volumes/Candles.js',
'Plotters/Foundations/Candles/Plotters-Candles-Volumes/CandlePanel.js',
'Plotters/Foundations/Candles/Plotters-Candles-Volumes/Volumes.js',
'Plotters/Foundations/Candles/Plotters-Candles-Volumes/VolumePanel.js',
'Plotters/Foundations/Bollinger/Plotters-Bollinger-Bands/BollingerBands.js',
'Plotters/Foundations/Bollinger/Plotters-Bollinger-Bands/BollingerBandsPanel.js',
'Plotters/Foundations/Bollinger/Plotters-Bollinger-Bands/PercentageBandwidth.js'
]
}
}
+6 -9
View File
@@ -14,11 +14,8 @@ function newAppPostLoader() {
function start() {
try {
/* Moving PROJECTS_ARRAY to the global variable */
PROJECTS_ARRAY = window.PROJECTS
window.PROJECTS = undefined
setBrowserEvents()
// autoSaveWhenClosingTheBrowser()
setupProjectsSchema()
function setupProjectsSchema() {
@@ -35,8 +32,8 @@ function newAppPostLoader() {
let totalWebServerCalls = 0
let webServerResponses = 0
for (let i = 0; i < PROJECTS_ARRAY.length; i++) {
let project = PROJECTS_ARRAY[i]
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
let project = PROJECTS_SCHEMA[i].name
let schemas = {
array: {
appSchema: [],
@@ -213,7 +210,7 @@ function newAppPostLoader() {
}
}
function setBrowserEvents() {
function autoSaveWhenClosingTheBrowser() {
window.onbeforeunload = saveWorkspace
/* handles backspace and refresh(F5) from keyboard */
@@ -229,7 +226,7 @@ function newAppPostLoader() {
window.addEventListener('keydown', window.manageBackRefresh)
function saveWorkspace() {
UI.projects.superalgos.spaces.designSpace.workspace.save()
UI.projects.foundations.spaces.designSpace.workspace.save()
}
}
}
+73 -74
View File
@@ -1,78 +1,78 @@
/* Callbacks default responses. */
let GLOBAL = {};
let GLOBAL = {}
GLOBAL.DEFAULT_OK_RESPONSE = {
result: "Ok",
message: "Operation Succeeded"
};
}
GLOBAL.DEFAULT_FAIL_RESPONSE = {
result: "Fail",
message: "Operation Failed"
};
}
GLOBAL.DEFAULT_RETRY_RESPONSE = {
result: "Retry",
message: "Retry Later"
};
}
GLOBAL.CUSTOM_OK_RESPONSE = {
result: "Ok, but check Message",
message: "Custom Message"
};
}
GLOBAL.CUSTOM_FAIL_RESPONSE = {
result: "Fail Because",
message: "Custom Message"
};
}
let browserCanvas; // This is the canvas object of the browser.
let browserCanvas // This is the canvas object of the browser.
function spacePad(str, max) {
str = str.toString();
return str.length < max ? spacePad(" " + str, max) : str;
str = str.toString()
return str.length < max ? spacePad(" " + str, max) : str
}
function loadSuperalgos() {
const MODULE_NAME = "App Pre-Loader";
const INFO_LOG = false;
const MODULE_NAME = "App Pre-Loader"
const INFO_LOG = false
let browser = checkBrowserVersion();
let browser = checkBrowserVersion()
setupHTMLTextArea()
setupHTMLInput()
setupHTMLCanvas()
loadDebugModule()
if ((browser.name !== "Chrome" && browser.name!=="Safari") || (browser.name === "Chrome" && parseInt(browser.version) < 85) || (browser.name === "Safari" && parseInt(browser.version) < 13)) {
alert("Superalgos is officially supported on Google Chrome 85 or Safari 13.1 and above. Your browser version has been detected as potentially beneath this. If you continue you may experience some functionaility issues.\n\nDetected Browser: " + browser.name + "\nVersion: " + browser.version);
alert("Superalgos is officially supported on Google Chrome 85 or Safari 13.1 and above. Your browser version has been detected as potentially beneath this. If you continue you may experience some functionaility issues.\n\nDetected Browser: " + browser.name + "\nVersion: " + browser.version)
}
function checkBrowserVersion () {
let ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
let ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []
if(/trident/i.test(M[1])){
tem=/\brv[ :]+(\d+)/g.exec(ua) || [];
return {name:'IE',version:(tem[1]||'')};
tem=/\brv[ :]+(\d+)/g.exec(ua) || []
return {name:'IE',version:(tem[1]||'')}
}
if(M[1]==='Chrome'){
tem=ua.match(/\bOPR|Edge\/(\d+)/)
if(tem!=null) {return {name:'Opera', version:tem[1]};}
if(tem!=null) {return {name:'Opera', version:tem[1]}}
}
M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1]);}
M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']
if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1])}
return {
name: M[0],
version: M[1]
};
}
}
function setupHTMLTextArea() {
let textArea = document.createElement('textarea');
textArea.id = "textArea";
textArea.spellcheck = false;
let textArea = document.createElement('textarea')
textArea.id = "textArea"
textArea.spellcheck = false
textArea.style = 'resize: none;' +
' border: none;' +
' outline: none;' +
@@ -85,97 +85,96 @@ function loadSuperalgos() {
'width: ' + 600 + 'px;' +
'height: ' + 400 + 'px'
let textAreaDiv = document.getElementById('textAreaDiv');
textAreaDiv.appendChild(textArea);
let textAreaDiv = document.getElementById('textAreaDiv')
textAreaDiv.appendChild(textArea)
textAreaDiv.style = 'position:fixed; top:' + -1500 + 'px; left:' + 500 + 'px; z-index:10; '
}
function setupHTMLInput() {
let input = document.createElement('input');
input.id = "input";
input.spellcheck = false;
input.style = "border: none; outline: none; box-shadow: none; overflow:hidden; width: 0px; height: 0px;";
let input = document.createElement('input')
input.id = "input"
input.spellcheck = false
input.style = "border: none; outline: none; box-shadow: none; overflow:hidden; width: 0px; height: 0px;"
let inputDiv = document.getElementById('inputDiv');
inputDiv.appendChild(input);
let inputDiv = document.getElementById('inputDiv')
inputDiv.appendChild(input)
}
function setupHTMLCanvas() {
let canvas = document.createElement('canvas');
let canvas = document.createElement('canvas')
canvas.id = "canvas";
canvas.width = 1400;
canvas.height = 600;
canvas.style.border = "0";
canvas.style = "position:absolute; top:0px; left:0px; z-index:1";
canvas.id = "canvas"
canvas.width = 1400
canvas.height = 600
canvas.style.border = "0"
canvas.style = "position:absolute; top:0px; left:0px; z-index:1"
let canvasApp = document.getElementById('canvasApp');
canvasApp.appendChild(canvas);
let canvasApp = document.getElementById('canvasApp')
canvasApp.appendChild(canvas)
browserCanvas = document.getElementById('canvas');
browserCanvas = document.getElementById('canvas')
browserCanvas.width = window.innerWidth;
browserCanvas.height = window.innerHeight;
browserCanvas.style.border = "none";
browserCanvas.width = window.innerWidth
browserCanvas.height = window.innerHeight
browserCanvas.style.border = "none"
browserCanvas.style.top = 0 + 'px';
browserCanvas.style.top = 0 + 'px'
}
function loadDebugModule() {
let path = "WebDebugLog.js";
REQUIREJS([path], onRequired);
let path = "WebDebugLog.js"
REQUIREJS([path], onRequired)
function onRequired(pModule) {
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); }
setUpProjects();
}
}
function setUpProjects() {
let url = 'ProjectNames'
httpRequest(undefined, url, onResponse)
function onResponse(err, projects) {
window.PROJECTS = JSON.parse(projects)
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded.") }
loadModules()
}
}
/* And Finally, we start loading all the scripts we will inmediatelly need. */
function loadModules() {
let path = "AppLoader.js";
REQUIREJS([path], onRequired);
let path = "AppLoader.js"
REQUIREJS([path], onRequired)
function onRequired(pModule) {
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); }
let APP_LOADER_MODULE = newAppLoader();
APP_LOADER_MODULE.loadModules();
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded.") }
let APP_LOADER_MODULE = newAppLoader()
APP_LOADER_MODULE.loadModules()
}
}
}
function httpRequest(pContentToSend, pPath, callBackFunction) {
let xmlHttpRequest = new XMLHttpRequest();
let xmlHttpRequest = new XMLHttpRequest()
xmlHttpRequest.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, xmlHttpRequest.responseText);
return;
try {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, xmlHttpRequest.responseText)
} catch(err) {
console.log('[ERROR] httpRequest -> httpRequest -> err.stack = '+ err.stack)
console.log('[ERROR] httpRequest -> httpRequest -> pContentToSend = '+ pContentToSend)
console.log('[ERROR] httpRequest -> httpRequest -> pPath = '+ pPath)
console.log('[ERROR] httpRequest -> httpRequest -> xmlHttpRequest.responseText = '+ xmlHttpRequest.responseText)
console.log('[ERROR] httpRequest -> httpRequest -> callBackFunction = '+ callBackFunction)
}
return
} else if (this.readyState === 4 && this.status === 404) {
callBackFunction({ result: "Fail", message: xmlHttpRequest.responseText.trim(), code: xmlHttpRequest.responseText.trim() });
return;
callBackFunction({ result: "Fail", message: xmlHttpRequest.responseText.trim(), code: xmlHttpRequest.responseText.trim() })
return
}
};
}
if (pContentToSend === undefined) {
xmlHttpRequest.open("GET", pPath, true);
xmlHttpRequest.send();
xmlHttpRequest.open("GET", pPath, true)
xmlHttpRequest.send()
} else {
try {
let blob = new Blob([pContentToSend], { type: 'text/plain' });
xmlHttpRequest.open("POST", pPath, true);
xmlHttpRequest.send(blob);
let blob = new Blob([pContentToSend], { type: 'text/plain' })
xmlHttpRequest.open("POST", pPath, true)
xmlHttpRequest.send(blob)
} catch (err) {
if (ERROR_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] callServer -> err.message = " & err.message); }
if (ERROR_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] callServer -> err.message = " & err.message) }
callBackFunction({ result: "Fail", message: err.message })
}
}
+89 -53
View File
@@ -50,12 +50,12 @@ function newCanvas() {
function finalize() {
try {
UI.projects.superalgos.spaces.tutorialSpace.finalize()
UI.projects.superalgos.spaces.docsSpace.finalize()
UI.projects.education.spaces.tutorialSpace.finalize()
UI.projects.education.spaces.docsSpace.finalize()
//thisObject.chatSpace.finalize()
UI.projects.superalgos.spaces.sideSpace.finalize()
UI.projects.superalgos.spaces.chartingSpace.finalize()
UI.projects.superalgos.spaces.floatingSpace.finalize()
UI.projects.foundations.spaces.sideSpace.finalize()
UI.projects.foundations.spaces.chartingSpace.finalize()
UI.projects.foundations.spaces.floatingSpace.finalize()
thisObject.shorcutNumbers = undefined
if (browserCanvas.removeEventListener) {
@@ -86,7 +86,7 @@ function newCanvas() {
}
}
function initialize() {
async function initialize() {
try {
browserResized()
@@ -189,7 +189,7 @@ function newCanvas() {
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
let spaceInstance = spaceInitializationMap.get(j)
if (spaceInstance !== undefined) {
spaceInstance.initialize()
await spaceInstance.initialize()
}
}
@@ -318,12 +318,12 @@ function newCanvas() {
break
}
case 118: { // F7
UI.projects.superalgos.utilities.download.downloadPanorama('Superalgos.Market.Panorama')
UI.projects.foundations.utilities.download.downloadPanorama('Superalgos.Market.Panorama')
return
break
}
case 119: { // F8
UI.projects.superalgos.utilities.download.downloadCanvas('Superalgos.Image.Capture', browserCanvas)
UI.projects.foundations.utilities.download.downloadCanvas('Superalgos.Image.Capture', browserCanvas)
return
break
}
@@ -367,7 +367,7 @@ function newCanvas() {
}
async function onKeyDown(event) {
if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return }
if (UI.projects.foundations.spaces.designSpace.workspace === undefined) { return }
if (EDITOR_ON_FOCUS === true) {
/*
@@ -380,7 +380,7 @@ function newCanvas() {
return
}
/* When the Docs is Visible, we do not process key down events of the Designer Space. */
if (UI.projects.superalgos.spaces.docsSpace.isVisible === true) {
if (UI.projects.education !== undefined && UI.projects.education.spaces.docsSpace.isVisible === true) {
return
}
thisObject.mouse.event = event
@@ -388,12 +388,12 @@ function newCanvas() {
checkMediaRecording(event)
event.x = thisObject.mouse.position.x
event.y = thisObject.mouse.position.y
event.x = thisObject.mouse.position.x
event.y = thisObject.mouse.position.y
UI.projects.superalgos.spaces.chartingSpace.onKeyPressed(event)
UI.projects.foundations.spaces.chartingSpace.onKeyPressed(event)
/* Shourcuts to Menu Items */
/* Shortcuts to Menu Items */
if ((event.keyCode >= 48 && event.keyCode <= 57)) {
let number = event.key
if (MENU_ITEM_ON_FOCUS !== undefined) {
@@ -411,37 +411,53 @@ function newCanvas() {
}
}
if (event.key === 'Escape' && UI.projects.superalgos.spaces.floatingSpace.inMapMode === true) {
UI.projects.superalgos.spaces.floatingSpace.exitMapMode()
if (event.key === 'Escape' && UI.projects.foundations.spaces.floatingSpace.inMapMode === true) {
UI.projects.foundations.spaces.floatingSpace.exitMapMode()
}
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'M' || event.key === 'm')) {
UI.projects.superalgos.spaces.floatingSpace.toggleMapMode()
if (
event.shiftKey === true &&
(event.ctrlKey === true || event.metaKey === true) &&
(event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.toggleMapMode || event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.toggleMapMode.toLowerCase())
) {
UI.projects.foundations.spaces.floatingSpace.toggleMapMode()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'R' || event.key === 'r')) {
UI.projects.superalgos.spaces.floatingSpace.toggleDrawReferenceLines()
if (
event.shiftKey === true &&
(event.ctrlKey === true || event.metaKey === true) &&
(event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.toggleDrawRelationshipLines || event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.toggleDrawRelationshipLines.toLowerCase())
) {
UI.projects.foundations.spaces.floatingSpace.toggleDrawReferenceLines()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'C' || event.key === 'c')) {
UI.projects.superalgos.spaces.floatingSpace.toggleDrawChainLines()
if (
event.shiftKey === true &&
(event.ctrlKey === true || event.metaKey === true) &&
(event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.toggleDrawParentLines || event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.toggleDrawParentLines.toLowerCase())
) {
UI.projects.foundations.spaces.floatingSpace.toggleDrawChainLines()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'S' || event.key === 's')) {
UI.projects.superalgos.spaces.designSpace.workspace.save()
if (
event.shiftKey === true &&
(event.ctrlKey === true || event.metaKey === true) &&
(event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.saveWorkspace || event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.saveWorkspace.toLowerCase())
) {
UI.projects.foundations.spaces.designSpace.workspace.save()
if (event.preventDefault !== undefined) {
event.preventDefault()
}
return
}
let nodeOnFocus = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeThatIsOnFocus()
let nodeOnFocus = await UI.projects.foundations.spaces.designSpace.workspace.getNodeThatIsOnFocus()
if (nodeOnFocus !== undefined) {
if (nodeOnFocus.payload.uiObject.codeEditor !== undefined) {
if (nodeOnFocus.payload.uiObject.codeEditor.visible === true) {
@@ -492,55 +508,55 @@ function newCanvas() {
}
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowUp') {
UI.projects.superalgos.spaces.cockpitSpace.toTop()
UI.projects.foundations.spaces.cockpitSpace.toTop()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowDown') {
UI.projects.superalgos.spaces.cockpitSpace.toBottom()
UI.projects.foundations.spaces.cockpitSpace.toBottom()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowLeft') {
UI.projects.superalgos.spaces.cockpitSpace.moveUp()
UI.projects.foundations.spaces.cockpitSpace.moveUp()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowRight') {
UI.projects.superalgos.spaces.cockpitSpace.moveDown()
UI.projects.foundations.spaces.cockpitSpace.moveDown()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === false && event.metaKey === false) && event.code === 'ArrowLeft') {
UI.projects.superalgos.spaces.chartingSpace.oneScreenLeft()
UI.projects.foundations.spaces.chartingSpace.oneScreenLeft()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === false && event.metaKey === false) && event.code === 'ArrowRight') {
UI.projects.superalgos.spaces.chartingSpace.oneScreenRight()
UI.projects.foundations.spaces.chartingSpace.oneScreenRight()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === false && event.metaKey === false) && event.code === 'ArrowUp') {
UI.projects.superalgos.spaces.chartingSpace.oneScreenUp()
UI.projects.foundations.spaces.chartingSpace.oneScreenUp()
event.preventDefault()
return
}
if (event.shiftKey === true && (event.ctrlKey === false && event.metaKey === false) && event.code === 'ArrowDown') {
UI.projects.superalgos.spaces.chartingSpace.oneScreenDown()
UI.projects.foundations.spaces.chartingSpace.oneScreenDown()
event.preventDefault()
return
}
if ((event.ctrlKey === true || event.metaKey === true) && event.shiftKey === false && event.code === 'ArrowLeft') {
let displaceVector = UI.projects.superalgos.spaces.floatingSpace.oneScreenLeft()
let displaceVector = UI.projects.foundations.spaces.floatingSpace.oneScreenLeft()
if (displaceVector !== undefined) {
dragVector.downX = dragVector.downX + displaceVector.x
dragVector.downY = dragVector.downY + displaceVector.y
@@ -551,7 +567,7 @@ function newCanvas() {
}
if ((event.ctrlKey === true || event.metaKey === true) && event.shiftKey === false && event.code === 'ArrowRight') {
let displaceVector = UI.projects.superalgos.spaces.floatingSpace.oneScreenRight()
let displaceVector = UI.projects.foundations.spaces.floatingSpace.oneScreenRight()
if (displaceVector !== undefined) {
dragVector.downX = dragVector.downX + displaceVector.x
dragVector.downY = dragVector.downY + displaceVector.y
@@ -562,7 +578,7 @@ function newCanvas() {
}
if ((event.ctrlKey === true || event.metaKey === true) && event.shiftKey === false && event.code === 'ArrowUp') {
let displaceVector = UI.projects.superalgos.spaces.floatingSpace.oneScreenUp()
let displaceVector = UI.projects.foundations.spaces.floatingSpace.oneScreenUp()
if (displaceVector !== undefined) {
dragVector.downX = dragVector.downX + displaceVector.x
dragVector.downY = dragVector.downY + displaceVector.y
@@ -573,7 +589,7 @@ function newCanvas() {
}
if ((event.ctrlKey === true || event.metaKey === true) && event.shiftKey === false && event.code === 'ArrowDown') {
let displaceVector = UI.projects.superalgos.spaces.floatingSpace.oneScreenDown()
let displaceVector = UI.projects.foundations.spaces.floatingSpace.oneScreenDown()
if (displaceVector !== undefined) {
dragVector.downX = dragVector.downX + displaceVector.x
dragVector.downY = dragVector.downY + displaceVector.y
@@ -595,7 +611,7 @@ function newCanvas() {
if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 65 && event.keyCode <= 90)) {
/* From here we prevent the default behaviour. Putting it earlier prevents imput box and text area to receive keystrokes */
event.preventDefault()
let nodeUsingThisKey = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeByShortcutKey(event.key)
let nodeUsingThisKey = await UI.projects.foundations.spaces.designSpace.workspace.getNodeByShortcutKey(event.key)
if (nodeUsingThisKey !== undefined) {
if (nodeOnFocus !== undefined) {
@@ -611,7 +627,7 @@ function newCanvas() {
nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + Alt + ' + event.key)
}
} else {
UI.projects.superalgos.spaces.floatingSpace.positionAtNode(nodeUsingThisKey)
UI.projects.foundations.spaces.floatingSpace.positionAtNode(nodeUsingThisKey)
}
return
} else {
@@ -635,7 +651,7 @@ function newCanvas() {
try {
event.preventDefault()
event.stopPropagation()
UI.projects.superalgos.spaces.cockpitSpace.toTop()
UI.projects.foundations.spaces.cockpitSpace.toTop()
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] onDragEnter -> err = ' + err.stack) }
}
@@ -679,7 +695,7 @@ function newCanvas() {
x: event.x,
y: event.y
}
UI.projects.superalgos.spaces.designSpace.workspace.spawn(reader.result, mousePosition)
UI.projects.foundations.spaces.designSpace.workspace.spawn(reader.result, mousePosition)
}
}
} catch (err) {
@@ -716,10 +732,15 @@ function newCanvas() {
and we are going to query each space to see if they have the container that is at
the mouse position. We will order firt the spaces by the sequence order defined
at the project schema specifically for this mouse event.
The order of the projects for events evaluations has intentionally been inverted,
because the latest project is drwan the last, on top of the others, that means that
events should belong to the last first.
*/
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
for (let i = PROJECTS_SCHEMA.length - 1; i >= 0; i--) {
let projectDefinition = PROJECTS_SCHEMA[i]
let projectInstance = UI.projects[projectDefinition.propertyName]
if (projectInstance === undefined) { continue }
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
let spaceInstance = projectInstance.events.onMouseDownMap.get(j)
@@ -819,10 +840,15 @@ function newCanvas() {
and we are going to query each space to see if they have the container that is at
the mouse position. We will order firt the spaces by the sequence order defined
at the project schema specifically for this mouse event.
The order of the projects for events evaluations has intentionally been inverted,
because the latest project is drwan the last, on top of the others, that means that
events should belong to the last first.
*/
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
for (let i = PROJECTS_SCHEMA.length - 1; i >= 0; i--) {
let projectDefinition = PROJECTS_SCHEMA[i]
let projectInstance = UI.projects[projectDefinition.propertyName]
if (projectInstance === undefined) { continue }
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
let spaceInstance = projectInstance.events.onMouseClickMap.get(j)
@@ -870,14 +896,14 @@ function newCanvas() {
point.x = event.pageX
point.y = event.pageY - CURRENT_TOP_MARGIN
if (UI.projects.superalgos.spaces.chartingSpace.viewport !== undefined) {
UI.projects.superalgos.spaces.chartingSpace.viewport.mousePosition.x = point.x
UI.projects.superalgos.spaces.chartingSpace.viewport.mousePosition.y = point.y
if (UI.projects.foundations.spaces.chartingSpace.viewport !== undefined) {
UI.projects.foundations.spaces.chartingSpace.viewport.mousePosition.x = point.x
UI.projects.foundations.spaces.chartingSpace.viewport.mousePosition.y = point.y
}
if (containerDragStarted === true || floatingObjectDragStarted === true || viewPortBeingDragged === true) {
if (floatingObjectDragStarted === true) {
let targetContainer = UI.projects.superalgos.spaces.floatingSpace.getContainer(point)
let targetContainer = UI.projects.foundations.spaces.floatingSpace.getContainer(point)
if (targetContainer !== undefined) {
if (targetContainer.id !== containerBeingDragged.id) {
containerBeingDragged.eventHandler.raiseEvent('onDragFinished', point)
@@ -930,10 +956,15 @@ function newCanvas() {
and we are going to query each space to see if they have the container that is at
the mouse position. We will order firt the spaces by the sequence order defined
at the project schema specifically for this mouse event.
The order of the projects for events evaluations has intentionally been inverted,
because the latest project is drwan the last, on top of the others, that means that
events should belong to the last first.
*/
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
for (let i = PROJECTS_SCHEMA.length - 1; i >= 0; i--) {
let projectDefinition = PROJECTS_SCHEMA[i]
let projectInstance = UI.projects[projectDefinition.propertyName]
if (projectInstance === undefined) { continue }
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
let spaceInstance = projectInstance.events.onMouseOverMap.get(j)
@@ -987,10 +1018,15 @@ function newCanvas() {
and we are going to query each space to see if they have the container that is at
the mouse position. We will order firt the spaces by the sequence order defined
at the project schema specifically for this mouse event.
The order of the projects for events evaluations has intentionally been inverted,
because the latest project is drwan the last, on top of the others, that means that
events should belong to the last first.
*/
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
for (let i = PROJECTS_SCHEMA.length - 1; i >= 0; i--) {
let projectDefinition = PROJECTS_SCHEMA[i]
let projectInstance = UI.projects[projectDefinition.propertyName]
if (projectInstance === undefined) { continue }
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
let spaceInstance = projectInstance.events.onMouseWheelMap.get(j)
@@ -1061,7 +1097,7 @@ function newCanvas() {
y: dragVector.upY - dragVector.downY
}
UI.projects.superalgos.spaces.chartingSpace.viewport.displace(displaceVector)
UI.projects.foundations.spaces.chartingSpace.viewport.displace(displaceVector)
}
if (containerDragStarted) {
if (containerBeingDragged !== undefined) {
@@ -1072,7 +1108,7 @@ function newCanvas() {
}
let downNoZoom
downNoZoom = UI.projects.superalgos.spaces.chartingSpace.viewport.unTransformThisPoint(downCopy)
downNoZoom = UI.projects.foundations.spaces.chartingSpace.viewport.unTransformThisPoint(downCopy)
let upCopy = {
x: dragVector.upX,
@@ -1080,7 +1116,7 @@ function newCanvas() {
}
let upNoZoom
upNoZoom = UI.projects.superalgos.spaces.chartingSpace.viewport.unTransformThisPoint(upCopy)
upNoZoom = UI.projects.foundations.spaces.chartingSpace.viewport.unTransformThisPoint(upCopy)
displaceVector = {
x: upNoZoom.x - downNoZoom.x,
+3 -3
View File
@@ -231,7 +231,7 @@ function newEventsServerClient(networkNode) {
'Bad configuration. Invalid JSON Format.',
undefined,
{
project: 'Superalgos',
project: 'Foundations',
category: 'Topic',
type: 'UI Websockets Error - Bad Configuration',
anchor: 'Invalid JSON Format'
@@ -245,7 +245,7 @@ function newEventsServerClient(networkNode) {
'Bad configuration. Host Property Not Found.',
undefined,
{
project: 'Superalgos',
project: 'Foundations',
category: 'Topic',
type: 'UI Websockets Error - Bad Configuration',
anchor: 'Host Property Not Found'
@@ -259,7 +259,7 @@ function newEventsServerClient(networkNode) {
'Bad configuration. WebSocketsPort Property Not Found.',
undefined,
{
project: 'Superalgos',
project: 'Foundations',
category: 'Topic',
type: 'UI Websockets Error - Bad Configuration',
anchor: 'WebSocketsPort Property Not Found'
+22 -22
View File
@@ -53,7 +53,7 @@ function newFrame() {
}
function isInViewPort() {
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the UI.projects.superalgos.spaces.chartingSpace.viewport */
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the UI.projects.foundations.spaces.chartingSpace.viewport */
point1 = {
x: 0,
@@ -67,10 +67,10 @@ function newFrame() {
/* Now the transformations. */
point1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
point1 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point3 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
if (point1.x < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight.x && point1.y < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomRight.y && point3.x > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x && point3.y > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft.y) {
if (point1.x < UI.projects.foundations.spaces.chartingSpace.viewport.visibleArea.topRight.x && point1.y < UI.projects.foundations.spaces.chartingSpace.viewport.visibleArea.bottomRight.y && point3.x > UI.projects.foundations.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x && point3.y > UI.projects.foundations.spaces.chartingSpace.viewport.visibleArea.topLeft.y) {
return true
} else {
return false
@@ -78,7 +78,7 @@ function newFrame() {
}
function isCenterInViewPort() {
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the UI.projects.superalgos.spaces.chartingSpace.viewport */
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the UI.projects.foundations.spaces.chartingSpace.viewport */
point1 = {
x: thisObject.width * 40 / 100,
@@ -92,10 +92,10 @@ function newFrame() {
/* Now the transformations. */
point1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
point1 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point3 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
if (point1.x < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight.x && point1.y < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomRight.y && point3.x > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x && point3.y > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft.y) {
if (point1.x < UI.projects.foundations.spaces.chartingSpace.viewport.visibleArea.topRight.x && point1.y < UI.projects.foundations.spaces.chartingSpace.viewport.visibleArea.bottomRight.y && point3.x > UI.projects.foundations.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x && point3.y > UI.projects.foundations.spaces.chartingSpace.viewport.visibleArea.topLeft.y) {
return true
} else {
return false
@@ -204,7 +204,7 @@ function newFrame() {
if (outsideViewPort === true) {
checkPoint = thisObject.container.frame.unframeThisPoint(checkPoint)
} else {
checkPoint = UI.projects.superalgos.utilities.coordinateTransformations.unTransformThisPoint(checkPoint, thisObject.container)
checkPoint = UI.projects.foundations.utilities.coordinateTransformations.unTransformThisPoint(checkPoint, thisObject.container)
}
}
@@ -290,7 +290,7 @@ function newFrame() {
fitFunction: fitFunction
}
UI.projects.superalgos.utilities.drawPrint.roundedCornersBackground(params)
UI.projects.foundations.utilities.drawPrint.roundedCornersBackground(params)
titleBarPoint1 = {
x: 0,
@@ -388,10 +388,10 @@ function newFrame() {
}
/* Now the transformations. */
point1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point2 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point2, thisObject.container)
point3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
point4 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point4, thisObject.container)
point1 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point2 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point2, thisObject.container)
point3 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
point4 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point4, thisObject.container)
if (fitFunction !== undefined) {
point1 = fitFunction(point1)
@@ -437,8 +437,8 @@ function newFrame() {
y: j
}
point1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point2 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point2, thisObject.container)
point1 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point2 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point2, thisObject.container)
if (fitFunction !== undefined) {
point1 = fitFunction(point1)
@@ -459,8 +459,8 @@ function newFrame() {
y: thisObject.height
}
point3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
point4 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point4, thisObject.container)
point3 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
point4 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point4, thisObject.container)
if (fitFunction !== undefined) {
point3 = fitFunction(point3)
@@ -495,8 +495,8 @@ function newFrame() {
y: j
}
point1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point2 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point2, thisObject.container)
point1 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point1, thisObject.container)
point2 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point2, thisObject.container)
if (fitFunction !== undefined) {
point1 = fitFunction(point1)
@@ -517,8 +517,8 @@ function newFrame() {
y: thisObject.height
}
point3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
point4 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(point4, thisObject.container)
point3 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point3, thisObject.container)
point4 = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(point4, thisObject.container)
if (fitFunction !== undefined) {
point3 = fitFunction(point3)
+3 -3
View File
@@ -1,7 +1,6 @@
/* Global Constatns */
let canvas
let PROJECTS_ARRAY
let PROJECTS_SCHEMA
let SCHEMAS_BY_PROJECT = new Map()
/* New Root object*/
@@ -70,6 +69,7 @@ const MAC_AMOUNT_FACTOR = 5
const IS_MAC = navigator.platform.toUpperCase().indexOf('MAC') >= 0
const MAC_ZOOM_SENSITIVITY = 5
const MAC_SCROLL_SENSITIVITY = 20
const MAC_MOUSE_WHEEL_INFINITE_SCROLL_THRESHOLD= 120
const DEBUG = {}
@@ -203,9 +203,9 @@ const _1_MINUTE_IN_MILISECONDS = 1 * 60 * 1000;
let NEW_SESSION_INITIAL_DATE = new Date(); // This value will be overwritten at the UI.projects.superalgos.spaces.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
let NEW_SESSION_INITIAL_DATE = new Date(); // This value will be overwritten at the UI.projects.foundations.spaces.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
let INITIAL_ZOOM_LEVEL = -28.25 // This is the zoom level at the view port in which the APP starts.
let INITIAL_TIME_PERIOD = ONE_DAY_IN_MILISECONDS // This value will be overwritten at the UI.projects.superalgos.spaces.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
let INITIAL_TIME_PERIOD = ONE_DAY_IN_MILISECONDS // This value will be overwritten at the UI.projects.foundations.spaces.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
let VERY_LARGE_NUMBER = 100000000000000
const TOP_MARGIN = 0
+99 -104
View File
@@ -1,136 +1,131 @@
function getSchemaDocument(node, project) {
if (node === null || node === undefined) {
console.log('[Error] Can not get the schema document of a null or undefined node ')
return
}
if (project === undefined) { project = node.project }
function getSchemaDocument (node, project) {
if (node === null || node === undefined) {
console.log('[Error] Can not get the schema document of a null or undefined node ')
return
}
if (project === undefined) { project = node.project }
let APP_SCHEMA = SCHEMAS_BY_PROJECT.get(project)
if (APP_SCHEMA !== undefined) {
return SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(node.type)
} else {
console.log('[Error] Could not get APP Scchema for project ' + node.project)
}
let APP_SCHEMA = SCHEMAS_BY_PROJECT.get(project)
if (APP_SCHEMA !== undefined) {
return SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(node.type)
} else {
console.log('[Error] Could not get APP Scchema for project ' + node.project)
}
}
function dynamicDecimals(value, minDecimals) {
if (minDecimals === undefined) {
minDecimals = 0
function dynamicDecimals (value, minDecimals) {
if (minDecimals === undefined) {
minDecimals = 0
}
let decimals = 0
if (value < 1) { decimals = 3 } else if (value < 10) { decimals = 2 } else if (value < 100) { decimals = 1 } else if (Math.abs(Math.trunc(value * 10)) < 1) { decimals = 4 } else if (Math.abs(Math.trunc(value * 100)) < 1) { decimals = 5 } else if (Math.abs(Math.trunc(value * 1000)) < 1) { decimals = 6 } else if (Math.abs(Math.trunc(value * 10000)) < 1) { decimals = 7 } else if (Math.abs(Math.trunc(value * 100000)) < 1) { decimals = 8 } else if (Math.abs(Math.trunc(value * 1000000)) < 1) { decimals = 9 } else if (Math.abs(Math.trunc(value * 10000000)) < 1) { decimals = 10 } else if (Math.abs(Math.trunc(value * 100000000000)) < 1) { value = 0; decimals = 0 }
if (decimals < minDecimals) { decimals = minDecimals }
let returnValue = Number(value).toFixed(decimals)
return returnValue
}
function convertTimeFrameToName (pTimeFrame) {
for (let i = 0; i < dailyTimeFramesArray.length; i++) {
let period = dailyTimeFramesArray[i]
if (period[0] === pTimeFrame) {
return period[1]
}
let decimals = 0
if (value < 1) { decimals = 3 }
else if (value < 10) { decimals = 2 }
else if (value < 100) { decimals = 1 }
else if (Math.abs(Math.trunc(value * 10)) < 1) { decimals = 4 }
else if (Math.abs(Math.trunc(value * 100)) < 1) { decimals = 5 }
else if (Math.abs(Math.trunc(value * 1000)) < 1) { decimals = 6 }
else if (Math.abs(Math.trunc(value * 10000)) < 1) { decimals = 7 }
else if (Math.abs(Math.trunc(value * 100000)) < 1) { decimals = 8 }
else if (Math.abs(Math.trunc(value * 1000000)) < 1) { decimals = 9 }
else if (Math.abs(Math.trunc(value * 10000000)) < 1) { decimals = 10 }
else if (Math.abs(Math.trunc(value * 100000000000)) < 1) { value = 0; decimals = 0 }
}
if (decimals < minDecimals) { decimals = minDecimals }
let returnValue = Number(value).toFixed(decimals)
return returnValue
}
function convertTimeFrameToName(pTimeFrame) {
for (let i = 0; i < dailyTimeFramesArray.length; i++) {
let period = dailyTimeFramesArray[i]
if (period[0] === pTimeFrame) {
return period[1]
}
for (let i = 0; i < marketTimeFramesArray.length; i++) {
let period = marketTimeFramesArray[i]
if (period[0] === pTimeFrame) {
return period[1]
}
}
}
for (let i = 0; i < marketTimeFramesArray.length; i++) {
let period = marketTimeFramesArray[i]
if (period[0] === pTimeFrame) {
return period[1]
}
function nextPorwerOf10 (number) {
for (let i = -10; i <= 10; i++) {
if (number < Math.pow(10, i)) {
return Math.pow(10, i)
}
}
}
function nextPorwerOf10(number) {
for (let i = -10; i <= 10; i++) {
if (number < Math.pow(10, i)) {
return Math.pow(10, i)
}
}
function pad (str, max) {
str = str.toString()
return str.length < max ? pad('0' + str, max) : str
}
function pad(str, max) {
str = str.toString()
return str.length < max ? pad('0' + str, max) : str
function moveToUserPosition (container, currentDate, currentRate, coordinateSystem, ignoreX, ignoreY, mousePosition, fitFunction) {
let targetPoint = {
x: currentDate.valueOf(),
y: currentRate
}
/* Put this point in the coordinate system of the UI.projects.foundations.spaces.chartingSpace.viewport */
targetPoint = coordinateSystem.transformThisPoint(targetPoint)
targetPoint = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(targetPoint, container)
let displaceVector
let targetNoZoom = UI.projects.foundations.spaces.chartingSpace.viewport.unTransformThisPoint(targetPoint)
let mouseNoZoom = UI.projects.foundations.spaces.chartingSpace.viewport.unTransformThisPoint(mousePosition)
displaceVector = {
x: mouseNoZoom.x - targetNoZoom.x,
y: mouseNoZoom.y - targetNoZoom.y
}
if (ignoreX) { displaceVector.x = 0 }
if (ignoreY) { displaceVector.y = 0 }
container.displace(displaceVector)
}
function moveToUserPosition(container, currentDate, currentRate, coordinateSystem, ignoreX, ignoreY, mousePosition, fitFunction) {
let targetPoint = {
x: currentDate.valueOf(),
y: currentRate
}
function removeTime (datetime) {
if (datetime === undefined) { return }
/* Put this point in the coordinate system of the UI.projects.superalgos.spaces.chartingSpace.viewport */
targetPoint = coordinateSystem.transformThisPoint(targetPoint)
targetPoint = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(targetPoint, container)
let dateOnly = new Date(Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS) * ONE_DAY_IN_MILISECONDS)
let displaceVector
let targetNoZoom = UI.projects.superalgos.spaces.chartingSpace.viewport.unTransformThisPoint(targetPoint)
let mouseNoZoom = UI.projects.superalgos.spaces.chartingSpace.viewport.unTransformThisPoint(mousePosition)
displaceVector = {
x: mouseNoZoom.x - targetNoZoom.x,
y: mouseNoZoom.y - targetNoZoom.y
}
if (ignoreX) { displaceVector.x = 0 }
if (ignoreY) { displaceVector.y = 0 }
container.displace(displaceVector)
return dateOnly
}
function removeTime(datetime) {
if (datetime === undefined) { return }
let dateOnly = new Date(Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS) * ONE_DAY_IN_MILISECONDS)
return dateOnly
function newUniqueId () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)
return v.toString(16)
})
}
function newUniqueId() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)
return v.toString(16)
})
}
function splitTextIntoPhrases(text, wordsPerLine) {
function splitTextIntoPhrases (text, wordsPerLine) {
try {
let splittedLabel = text.split(' ')
let phrases = []
let phrase = ''
let wordCount = 0
for (let i = 0; i < splittedLabel.length; i++) {
phrase = phrase + splittedLabel[i]
wordCount++
phrase = phrase + splittedLabel[i]
wordCount++
if (i < splittedLabel.length - 1 && wordCount < wordsPerLine) {
phrase = phrase + ' '
}
if (wordCount >= wordsPerLine) {
phrases.push(phrase)
phrase = ''
wordCount = 0
}
if (i < splittedLabel.length - 1 && wordCount < wordsPerLine) {
phrase = phrase + ' '
}
if (wordCount >= wordsPerLine) {
phrases.push(phrase)
phrase = ''
wordCount = 0
}
}
if (wordCount > 0) {
phrases.push(phrase)
phrases.push(phrase)
}
return phrases
} catch (err) {
console.log(err.stack)
return []
}
}
function getTextWidth(text) {
var metrics = browserCanvasContext.measureText(text);
return metrics.width;
}
function getTextWidth (text) {
var metrics = browserCanvasContext.measureText(text)
return metrics.width
}
+19 -19
View File
@@ -20,12 +20,12 @@ function newVideoRecorder() {
const DISTANCE_BETWEEN_ICONS = 35
const ICON_SIZES = 50
let mousePointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-pointer')
let draggingIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'hand-drag')
let mousePointerIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'mouse-pointer')
let draggingIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'hand-drag')
let leftClickIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-left-click')
let rightClickIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-right-click')
let wheelClickIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-wheel-click')
let leftClickIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'mouse-left-click')
let rightClickIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'mouse-right-click')
let wheelClickIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'mouse-wheel-click')
let imagePosition
let buttonPressedIcon
@@ -45,10 +45,10 @@ function newVideoRecorder() {
case 'wheel': {
wheelAnimationCounter = 25
if (canvas.mouse.event.delta > 0) {
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-wheel-up')
pointerIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'mouse-wheel-up')
lastWheelPointerIcon = pointerIcon
} else {
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-wheel-down')
pointerIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'mouse-wheel-down')
lastWheelPointerIcon = pointerIcon
}
@@ -65,27 +65,27 @@ function newVideoRecorder() {
switch (key.toLowerCase()) {
case 'escape':
{
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-m')
pointerIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-m')
break
}
case 'm':
{
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-m')
pointerIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-m')
break
}
case 'a':
{
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-a')
pointerIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-a')
break
}
case 'r':
{
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-r')
pointerIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-r')
break
}
case 'c':
{
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-r')
pointerIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-r')
break
}
}
@@ -139,7 +139,7 @@ function newVideoRecorder() {
drawMousePointer(buttonPressedIcon, imagePosition, ICON_SIZES)
if (canvas.mouse.event.shiftKey === true) {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-shift')
icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-shift')
imagePosition = {
x: canvas.mouse.position.x - DISTANCE_BETWEEN_ICONS * 3,
y: canvas.mouse.position.y + firstRow
@@ -148,7 +148,7 @@ function newVideoRecorder() {
}
if (canvas.mouse.event.ctrlKey === true || canvas.mouse.event.metaKey === true) {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-ctrl')
icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-ctrl')
imagePosition = {
x: canvas.mouse.position.x - DISTANCE_BETWEEN_ICONS * 3,
y: canvas.mouse.position.y + secondRow
@@ -157,7 +157,7 @@ function newVideoRecorder() {
}
if (canvas.mouse.event.altKey === true) {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-alt')
icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-alt')
imagePosition = {
x: canvas.mouse.position.x + DISTANCE_BETWEEN_ICONS * 3 + ICON_SIZES * 0,
y: canvas.mouse.position.y + secondRow
@@ -166,7 +166,7 @@ function newVideoRecorder() {
}
if (canvas.mouse.event.code === 'ArrowUp') {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-up')
icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-up')
imagePosition = {
x: canvas.mouse.position.x - 0,
y: canvas.mouse.position.y + firstRow
@@ -175,7 +175,7 @@ function newVideoRecorder() {
}
if (canvas.mouse.event.code === 'ArrowDown') {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-down')
icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-down')
imagePosition = {
x: canvas.mouse.position.x - 0,
y: canvas.mouse.position.y + secondRow
@@ -184,7 +184,7 @@ function newVideoRecorder() {
}
if (canvas.mouse.event.code === 'ArrowLeft') {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-left')
icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-left')
imagePosition = {
x: canvas.mouse.position.x - DISTANCE_BETWEEN_ICONS * 0 - ICON_SIZES * 1,
y: canvas.mouse.position.y + secondRow
@@ -193,7 +193,7 @@ function newVideoRecorder() {
}
if (canvas.mouse.event.code === 'ArrowRight') {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-right')
icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName( 'Foundations', 'key-right')
imagePosition = {
x: canvas.mouse.position.x + DISTANCE_BETWEEN_ICONS * 0 + ICON_SIZES * 1,
y: canvas.mouse.position.y + secondRow