diff --git a/Platform/Client/httpInterface.js b/Platform/Client/httpInterface.js index 6ab30764c..81e4a60af 100644 --- a/Platform/Client/httpInterface.js +++ b/Platform/Client/httpInterface.js @@ -1651,7 +1651,6 @@ exports.newHttpInterface = function newHttpInterface() { SA.projects.foundations.utilities.httpResponses.respondWithFont(global.env.PATH_TO_PLATFORM + '/WebServer/externalScripts/' + fullPath, httpResponse) break default: - console.log("Default file") SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/externalScripts/' + fullPath, httpResponse) } diff --git a/Platform/UI/Globals.js b/Platform/UI/Globals.js index 1f34fc0a0..84b558b77 100644 --- a/Platform/UI/Globals.js +++ b/Platform/UI/Globals.js @@ -261,6 +261,11 @@ let CURRENT_PANORAMA_POSITION = 0 let CAN_SPACES_DRAW = false // This global variable regulates when spaces can or can not draw their contents. +const codeEditorType = { + CODE: "code", + CONFIG: "config" +} + function toRadians(angle) { return angle * (Math.PI / 180); } diff --git a/Projects/Foundations/UI/Spaces/CodeEditor-Space/CodeEditorSpace.js b/Projects/Foundations/UI/Spaces/CodeEditor-Space/CodeEditorSpace.js index 068fe4968..71362e847 100644 --- a/Projects/Foundations/UI/Spaces/CodeEditor-Space/CodeEditorSpace.js +++ b/Projects/Foundations/UI/Spaces/CodeEditor-Space/CodeEditorSpace.js @@ -60,10 +60,10 @@ function newFoundationsCodeEditorSpace() { } - function openSpaceArea(originatingNode) { + function openSpaceArea(originatingNode, codeEditorType) { thisObject.sidePanelTab.open() - thisObject.editorPage.render(originatingNode) + thisObject.editorPage.render(originatingNode, codeEditorType) } function physics() { diff --git a/Projects/Foundations/UI/Spaces/CodeEditor-Space/EditorPage.js b/Projects/Foundations/UI/Spaces/CodeEditor-Space/EditorPage.js index c19596f20..f01f1fbdf 100644 --- a/Projects/Foundations/UI/Spaces/CodeEditor-Space/EditorPage.js +++ b/Projects/Foundations/UI/Spaces/CodeEditor-Space/EditorPage.js @@ -1,6 +1,7 @@ function newFoundationsCodeEditorEditorPage() { let thisObject = { originatingNode: undefined, + editorType: undefined, render: render, initialize: initialize, finalize: finalize @@ -8,7 +9,6 @@ function newFoundationsCodeEditorEditorPage() { let monacoInitialized = false let monacoEditor = undefined - let recordFormulaString = '' let codeString = '' let tradingEngineObj = undefined let recordFormulasObj = {} @@ -22,6 +22,263 @@ function newFoundationsCodeEditorEditorPage() { buildIntelliSenseModels() } + + function finalize() { + monacoInitialized = false + monacoEditor = undefined + codeString = '' + tradingEngineObj = undefined + recordFormulasObj = {} + thisObject.originatingNode = undefined + thisObject.editorType = undefined + + } + + + function render(originatingNode, editorType) { + + thisObject.editorType = editorType + thisObject.originatingNode = originatingNode + createEditingNodePath() + + + /** + * The reason we are doing the monaco initialization here is simply because monaco will set his own width at the moment it's rendered + * Rendering it earlier when the code panel is closed will result in a very narrow width + * Therefore we choose to render it after the panel has his width set correctly + * Probably there is a better way but at the time this has been coded, nothing else seemed to work + **/ + + require(["vs/editor/editor.main"], initMonacoEditor) + + } + + function initMonacoEditor() { + if (monacoEditor === undefined) { + monacoEditor = monaco.editor.create(document.querySelector('#editor'), { + model: null, + theme: 'vs-dark', + fixedOverflowWidgets: true + }); + + // Create autocomplete models and providers only once + monaco.editor.createModel(codeString, "javascript") + showAutocompletionFor(tradingEngineObj) + showAutocompletionFor(recordFormulasObj) + } + + monaco.languages.typescript.javascriptDefaults.setEagerModelSync(true) + monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ + allowNonTsExtensions: true + }); + + + createCurrentEditorModel() + } + + + function createCurrentEditorModel() { + + let payload = thisObject.originatingNode.payload; + // Determine the editor type and change source for code + if (thisObject.editorType === codeEditorType.CODE) { + monacoEditor.setModel(monaco.editor.createModel(payload.node.code, "javascript")) + //Update code values + monacoEditor.getModel().onDidChangeContent(function () { + payload.node.code = monacoEditor.getValue() + }) + } else if (thisObject.editorType === codeEditorType.CONFIG) { + monacoEditor.setModel(monaco.editor.createModel(payload.node.config, "json")) + //Update config values + monacoEditor.getModel().onDidChangeContent(function () { + payload.node.config = monacoEditor.getValue() + }) + } + + } + + function showAutocompletionFor(obj) { + // Disable default autocompletion for javascript + monaco.languages.typescript.javascriptDefaults.setCompilerOptions({noLib: true}); + + // Helper function to return the monaco completion item type of a thing + function getType(thing, isMember) { + isMember = (isMember === undefined) ? (typeof isMember == "boolean") ? isMember : false : false; // Give isMember a default value of false + + switch ((typeof thing).toLowerCase()) { + case "object": + return monaco.languages.CompletionItemKind.Class; + + case "function": + return (isMember) ? monaco.languages.CompletionItemKind.Method : monaco.languages.CompletionItemKind.Function; + + default: + return (isMember) ? monaco.languages.CompletionItemKind.Property : monaco.languages.CompletionItemKind.Variable; + } + } + + // Register object that will return autocomplete items + monaco.languages.registerCompletionItemProvider('javascript', { + // Run this function when the period or open parenthesis is typed (and anything after a space) + triggerCharacters: ['.', '('], + + // Function to generate autocompletion results + provideCompletionItems: function (model, position, token) { + // Split everything the user has typed on the current line up at each space, and only look at the last word + let last_chars = model.getValueInRange({ + startLineNumber: position.lineNumber, + startColumn: 0, + endLineNumber: position.lineNumber, + endColumn: position.column + }); + let words = last_chars.replace("\t", "").split(" "); + let active_typing = words[words.length - 1]; // What the user is currently typing (everything after the last space) + if (active_typing.includes('(')) { + let split = active_typing.split('('); + active_typing = split[split.length - 1] + } + + // If the last character typed is a period then we need to look at member objects of the obj object + let is_member = active_typing.charAt(active_typing.length - 1) === "."; + + // Array of autocompletion results + let result = []; + + // Used for generic handling between member and non-member objects + let last_token = obj; + let prefix = ''; + + if (is_member) { + // Is a member, get a list of all members, and the prefix + let parents = active_typing.substring(0, active_typing.length - 1).split("."); + last_token = obj[parents[0]]; + prefix = parents[0]; + + // Loop through all the parents the current one will have (to generate prefix) + for (let i = 1; i < parents.length; i++) { + if (last_token.hasOwnProperty(parents[i])) { + prefix += '.' + parents[i]; + last_token = last_token[parents[i]]; + } else { + // Not valid + return result; + } + } + + prefix += '.'; + } + + // Get all the child properties of the last token + for (let prop in last_token) { + // Do not show properites that begin with "__" + if (last_token.hasOwnProperty(prop) && !prop.startsWith("__")) { + // Get the detail type (try-catch) incase object does not have prototype + let details = ''; + try { + details = last_token[prop].__proto__.constructor.name; + } catch (e) { + details = typeof last_token[prop]; + } + + // Create completion object + let to_push = { + label: prop, + kind: getType(last_token[prop], is_member), + detail: details, + insertText: prop + }; + + // Change insertText and documentation for functions + if (to_push.detail.toLowerCase() === 'function') { + to_push.insertText += "("; + to_push.documentation = (last_token[prop].toString()).split("{")[0]; // Show function prototype in the documentation popup + } + + // Add to final results + result.push(to_push); + } + } + + return { + suggestions: result + }; + } + }); + } + + /** + * The autocomplete models will be based on: + * 1. Existing code in the data mines -> we will create models for each code node (it's like opening multiple files in vscode) + * 2. Formulas from data mines by creating an object representation of all formulas see implementation below than passing it to the monaco registerCompletionItemProvider + * 2. Trading engine loaded into the workspace - we create an obj. representation using getProtocolNode and we are using monaco registerCompletionItemProvider + * + */ + function buildIntelliSenseModels() { + + + UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes.forEach(node => { + if (node.type === 'Data Mine') { + // Getting all the Javascript code nodes into one single model + UI.projects.visualScripting.utilities.branches.nodeBranchToArray(node, 'Procedure Javascript Code').forEach(node => { + codeString += '\n' + codeString += node.code + }) + /** + * Getting all the Formula codes and create an object representation, all non-object children will be initialized with strings + * + * e.g : we will end with something like { + * variable: { + * last24hsDirection: "", + * last24HsMax: "" + * }, + * record: { + * current: { + * direction: "" + * } + * } + * } + * the above object will have as many properties as we can find in the entire workspace + * + */ + + UI.projects.visualScripting.utilities.branches.nodeBranchToArray(node, 'Record Formula').forEach(node => { + /** + * Extract each code formula as an object to be merged with the next one until we end up with an object containing all the objects present in the formula with proper children + * The resulting object will be later used as model for autocompletion + */ + objectMerge(recordFormulasObj, node.code.split('.').reduceRight((o, x) => ({[x]: o}), "")) + + }) + } else if (node.type === 'Trading Engine') { + // Create an object representation for the engine + tradingEngineObj = {tradingEngine: UI.projects.visualScripting.functionLibraries.protocolNode.getProtocolNode(node, false, false, false, false, false, undefined)} + } + }) + + + function objectMerge(target, source) { + for (const key of Object.keys(source)) { + const currTarget = target[key]; + const currSource = source[key]; + + if (currTarget) { + const objSource = typeof currSource === 'object'; + const objTarget = typeof currTarget === 'object'; + + if (objSource && objTarget) { + void objectMerge(currTarget, currSource) + continue; + } + } + + target[key] = currSource; + } + + return target; + } + + } + function buildEditorHTML() { let HTML = '' @@ -63,247 +320,7 @@ function newFoundationsCodeEditorEditorPage() { } - function finalize() { - monacoEditor = undefined - } - - function render(originatingNode) { - - thisObject.originatingNode = originatingNode - intellisenseModels = [] - - createCodePath() - /** - * The reason we are doing the monaco initialization here is simply because monaco will set his own width at the moment it's rendered - * Rendering it earlier when the code panel is closed will result in a very narrow width - * Thus we choose to render it after the panel has his width set correctly - * Probably there is a better way but at the time this has been coded, nothing else seemed to work - **/ - - require(["vs/editor/editor.main"], function () { - if (monacoEditor === undefined) { - monacoEditor = monaco.editor.create(document.querySelector('#editor'), { - language: 'javascript', - model: null, - theme: 'vs-dark', - fixedOverflowWidgets: true - }); - - - //Creating default models - monaco.editor.createModel(codeString, "javascript") - monaco.editor.createModel(recordFormulaString, "javascript") - - showAutocompletionFor(tradingEngineObj) - showAutocompletionFor(recordFormulasObj) - - - monaco.languages.typescript.javascriptDefaults.setEagerModelSync(true) - monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ - allowNonTsExtensions: true - }); - let currentModel = monaco.editor.createModel(originatingNode.payload.node.code, "javascript") - monacoEditor.setModel(currentModel) - } else { - let currentModel = monaco.editor.createModel(originatingNode.payload.node.code, "javascript") - monacoEditor.setModel(currentModel) - } - - //Registering events - monacoEditor.getModel().onDidChangeContent(function () { - originatingNode.payload.node.code = monacoEditor.getValue() - }) - - - function showAutocompletionFor(obj) { - // Disable default autocompletion for javascript - monaco.languages.typescript.javascriptDefaults.setCompilerOptions({noLib: true}); - - // Helper function to return the monaco completion item type of a thing - function getType(thing, isMember) { - isMember = (isMember === undefined) ? (typeof isMember == "boolean") ? isMember : false : false; // Give isMember a default value of false - - switch ((typeof thing).toLowerCase()) { - case "object": - return monaco.languages.CompletionItemKind.Class; - - case "function": - return (isMember) ? monaco.languages.CompletionItemKind.Method : monaco.languages.CompletionItemKind.Function; - - default: - return (isMember) ? monaco.languages.CompletionItemKind.Property : monaco.languages.CompletionItemKind.Variable; - } - } - - // Register object that will return autocomplete items - monaco.languages.registerCompletionItemProvider('javascript', { - // Run this function when the period or open parenthesis is typed (and anything after a space) - triggerCharacters: ['.', '('], - - // Function to generate autocompletion results - provideCompletionItems: function (model, position, token) { - // Split everything the user has typed on the current line up at each space, and only look at the last word - let last_chars = model.getValueInRange({ - startLineNumber: position.lineNumber, - startColumn: 0, - endLineNumber: position.lineNumber, - endColumn: position.column - }); - let words = last_chars.replace("\t", "").split(" "); - let active_typing = words[words.length - 1]; // What the user is currently typing (everything after the last space) - if (active_typing.includes('(')) { - let split = active_typing.split('('); - active_typing = split[split.length - 1] - } - - // If the last character typed is a period then we need to look at member objects of the obj object - let is_member = active_typing.charAt(active_typing.length - 1) === "."; - - // Array of autocompletion results - let result = []; - - // Used for generic handling between member and non-member objects - let last_token = obj; - let prefix = ''; - - if (is_member) { - // Is a member, get a list of all members, and the prefix - let parents = active_typing.substring(0, active_typing.length - 1).split("."); - last_token = obj[parents[0]]; - prefix = parents[0]; - - // Loop through all the parents the current one will have (to generate prefix) - for (let i = 1; i < parents.length; i++) { - if (last_token.hasOwnProperty(parents[i])) { - prefix += '.' + parents[i]; - last_token = last_token[parents[i]]; - } else { - // Not valid - return result; - } - } - - prefix += '.'; - } - - // Get all the child properties of the last token - for (let prop in last_token) { - // Do not show properites that begin with "__" - if (last_token.hasOwnProperty(prop) && !prop.startsWith("__")) { - // Get the detail type (try-catch) incase object does not have prototype - let details = ''; - try { - details = last_token[prop].__proto__.constructor.name; - } catch (e) { - details = typeof last_token[prop]; - } - - // Create completion object - let to_push = { - label: prop, - kind: getType(last_token[prop], is_member), - detail: details, - insertText: prop - }; - - // Change insertText and documentation for functions - if (to_push.detail.toLowerCase() === 'function') { - to_push.insertText += "("; - to_push.documentation = (last_token[prop].toString()).split("{")[0]; // Show function prototype in the documentation popup - } - - // Add to final results - result.push(to_push); - } - } - - return { - suggestions: result - }; - } - }); - } - - }); - - } - - /** - * The autocomplete models will be based on: - * 1. Existing code in the data mines -> we will create models for each code node (it's like opening multiple files in vscode) - * 2. Formulas from data mines by creating an object representation of all formulas see implementation below than passing it to the monaco registerCompletionItemProvider - * 2. Trading engine loaded into the workspace - we create an obj. representation using getProtocolNode and we are using monaco registerCompletionItemProvider - * - */ - function buildIntelliSenseModels() { - - - UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes.forEach(node => { - if (node.type === 'Data Mine') { - // Getting all the Javascript code nodes into one single model - UI.projects.visualScripting.utilities.branches.nodeBranchToArray(node, 'Procedure Javascript Code').forEach(node => { - codeString += '\n' - codeString += node.code - }) - /** - * Getting all the Formula codes and create an object representation, all non-object children will be initialized with strings - * - * e.g : we will end with something like { - * variable: { - * last24hsDirection: "", - * last24HsMax: "" - * }, - * record: { - * current: { - * direction: "" - * } - * } - * } - * the above object will have as many properties as we can find in the entire workspace - * - */ - - UI.projects.visualScripting.utilities.branches.nodeBranchToArray(node, 'Record Formula').forEach(node => { - /** - * Extract each code formula as an object to be merged with the next one until we end up with an object containing all the objects present in the formula with proper children - * The resulting object will be later used as model for autocompletion - */ - console.log(node.code) - objectMerge(recordFormulasObj, node.code.split('.').reduceRight((o, x) => ({[x]: o}), "")) - - }) - } else if (node.type === 'Trading Engine') { - // Create an object representation for the engine - tradingEngineObj = {tradingEngine: UI.projects.visualScripting.functionLibraries.protocolNode.getProtocolNode(node, false, false, false, false, false, undefined)} - } - }) - - - function objectMerge(target, source) { - for (const key of Object.keys(source)) { - const currTarget = target[key]; - const currSource = source[key]; - - if (currTarget) { - const objSource = typeof currSource === 'object'; - const objTarget = typeof currTarget === 'object'; - - if (objSource && objTarget) { - void objectMerge(currTarget, currSource) - continue; - } - } - - target[key] = currSource; - } - - return target; - } - - } - - - function createCodePath() { + function createEditingNodePath() { let parentNodeStructure = [] parentNodeRecursive(thisObject.originatingNode, parentNodeStructure) diff --git a/Projects/Foundations/UI/Spaces/Floating-Space/CodeEditor.js b/Projects/Foundations/UI/Spaces/Floating-Space/CodeEditor.js index 638859952..bc8def528 100644 --- a/Projects/Foundations/UI/Spaces/Floating-Space/CodeEditor.js +++ b/Projects/Foundations/UI/Spaces/Floating-Space/CodeEditor.js @@ -25,7 +25,7 @@ function newCodeEditor() { function activate(action) { - UI.projects.foundations.spaces.codeEditorSpace.openSpaceArea(action.node) + UI.projects.foundations.spaces.codeEditorSpace.openSpaceArea(action.node, codeEditorType.CODE) } } diff --git a/Projects/Foundations/UI/Spaces/Floating-Space/ConfigEditor.js b/Projects/Foundations/UI/Spaces/Floating-Space/ConfigEditor.js index 562cfb1c3..fe27933fd 100644 --- a/Projects/Foundations/UI/Spaces/Floating-Space/ConfigEditor.js +++ b/Projects/Foundations/UI/Spaces/Floating-Space/ConfigEditor.js @@ -1,211 +1,31 @@ - +/** + * + * The only reason we are keeping this class is to keep consistency across the uiObject implementation + * It will also provide a good place to enrich the action received, separating the logic of the action from the editor space + * Entire functionality is provided by CodeEditor Space + */ function newConfigEditor() { const MODULE_NAME = 'Config Editor' let thisObject = { - isVisibleFunction: undefined, - visible: false, - imagePathOK: undefined, - imagePathNOT_OK: undefined, - rawRadius: undefined, - targetRadius: undefined, - currentRadius: undefined, - container: undefined, - payload: undefined, - deactivate: deactivate, activate: activate, - physics: physics, - drawBackground: drawBackground, - drawForeground: drawForeground, - getContainer: getContainer, - finalize: finalize, initialize: initialize } - thisObject.container = newContainer() - thisObject.container.initialize(MODULE_NAME) - thisObject.container.isClickeable = false - thisObject.container.isDraggeable = false - thisObject.container.detectMouseOver = false - thisObject.container.frame.radius = 0 - thisObject.container.frame.position.x = 0 - thisObject.container.frame.position.y = 0 - - let isMouseOver = false - let SIZE_FACTOR = 1 - return thisObject + function finalize() { - thisObject.container.finalize() - thisObject.container = undefined - thisObject.payload = undefined - thisObject.isVisibleFunction = undefined + } function initialize() { } - function deactivate() { - if (thisObject.visible === true) { - thisObject.visible = false - let textArea = document.getElementById('textArea') - textArea.style.display = 'none' - thisObject.payload.node.config = textArea.value - - try { - let config = JSON.parse(thisObject.payload.node.config) - } catch (err) { - thisObject.payload.uiObject.setErrorMessage(err.message, 10) - } - } - EDITOR_ON_FOCUS = false - } function activate(action) { - thisObject.visible = true - thisObject.payload = action.node.payload - thisObject.rawRadius = 8 - thisObject.targetRadius = thisObject.container.frame.radius - thisObject.currentRadius = 0 - thisObject.payload.uiObject.resetErrorMessage() - thisObject.payload.uiObject.uiObjectTitle.exitEditMode() - - let textArea = document.getElementById('textArea') - try { - textArea.value = JSON.stringify(JSON.parse(thisObject.payload.node.config), undefined, 4) - } catch(err) { - textArea.value = thisObject.payload.node.config - } - - textArea.style = 'resize: none;' + - ' border: none;' + - ' outline: none;' + - 'box-shadow: none;' + - 'overflow:hidden;' + - 'font-family: ' + UI_FONT.PRIMARY + ';' + - 'font-size: 14px;' + - 'background-color: rgb(' + UI_COLOR.DARK_TURQUOISE + ');' + - 'color:rgb(255, 255, 255);' + - 'width: ' + thisObject.container.frame.width + 'px;' + - 'height: ' + thisObject.container.frame.height + 'px' - textArea.style.display = 'block' - textArea.focus() - EDITOR_ON_FOCUS = true + UI.projects.foundations.spaces.codeEditorSpace.openSpaceArea(action.node, codeEditorType.CONFIG) } - function getContainer(point) { - let container - if (thisObject.visible === true) { - if (point.x === VERY_LARGE_NUMBER) { - /* The the mouse leaves the canvas, and event of mouse over with a ridiculous coordinate is triggered so that - anyone can react. In our case, the config editor has a text area that is not part of the canvas, so the event is - triggered. We compensate recognizing this coordinate and returning our container. */ - return thisObject.container - } - - if (thisObject.container.frame.isThisPointHere(point, true, false) === true) { - return thisObject.container - } else { - return undefined - } - } - } - - function physics() { - if (Math.abs(thisObject.currentRadius - thisObject.targetRadius) >= 0.5) { - if (thisObject.currentRadius < thisObject.targetRadius) { - thisObject.currentRadius = thisObject.currentRadius + 0.5 - } else { - thisObject.currentRadius = thisObject.currentRadius - 0.5 - } - } - - thisObject.container.frame.position.x = 0 - thisObject.container.frame.position.y = 0 - - thisObject.container.frame.width = thisObject.container.frame.radius * 1 * SIZE_FACTOR - thisObject.container.frame.height = thisObject.container.frame.radius * 1 * SIZE_FACTOR - - let textAreaPosition = { - x: 0 - thisObject.container.frame.width / 2, - y: 0 - thisObject.container.frame.height * 3 / 7 + CURRENT_TOP_MARGIN - } - - textAreaPosition = thisObject.container.frame.frameThisPoint(textAreaPosition) - if (thisObject.visible === true) { - let checkPosition = { - x: textAreaPosition.x, - y: textAreaPosition.y - CURRENT_TOP_MARGIN - } - if (thisObject.isVisibleFunction(checkPosition) === false) { - deactivate() - } - } - if (thisObject.visible === true) { - let textAreaDiv = document.getElementById('textAreaDiv') - textAreaDiv.style = 'position:fixed; top:' + textAreaPosition.y + 'px; left:' + textAreaPosition.x + 'px; z-index:1; ' - } - } - - function drawBackground() { - if (thisObject.visible === true) { - let position = { - x: 0, - y: 0 - } - - position = thisObject.container.frame.frameThisPoint(position) - - let radius = thisObject.container.frame.radius * SIZE_FACTOR - - if (radius > 0.5) { - browserCanvasContext.beginPath() - browserCanvasContext.arc(position.x, position.y, radius + 3, 0, Math.PI * 2, true) - browserCanvasContext.closePath() - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', ' + 1 + ')' - browserCanvasContext.fill() - - browserCanvasContext.beginPath() - browserCanvasContext.arc(position.x, position.y, radius , 0, Math.PI * 2, true) - browserCanvasContext.closePath() - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK_TURQUOISE + ', ' + 1 + ')' - browserCanvasContext.fill() - } - } - } - function drawForeground() { - let iconPosition = { - x: 0, - y: thisObject.currentRadius * 1.5 - } - - iconPosition = thisObject.container.frame.frameThisPoint(iconPosition) - - /* Menu Item */ - - if (thisObject.canDrawIcon === true && thisObject.currentRadius > 1) { - browserCanvasContext.drawImage(thisObject.icon, iconPosition.x - thisObject.currentRadius, iconPosition.y - thisObject.currentRadius, thisObject.currentRadius * 2, thisObject.currentRadius * 2) - - /* Menu Label */ - - let label = 'Code looks good!' - let labelPoint - let fontSize = 10 - - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY - - if (thisObject.currentRadius >= thisObject.targetRadius) { - labelPoint = { - x: iconPosition.x + thisObject.currentRadius + 10, - y: iconPosition.y + fontSize * FONT_ASPECT_RATIO - } - - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' - browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y) - } - } - } } diff --git a/Projects/Foundations/UI/Spaces/Floating-Space/FormulaEditor.js b/Projects/Foundations/UI/Spaces/Floating-Space/FormulaEditor.js index 65b62c35c..7570d73f4 100644 --- a/Projects/Foundations/UI/Spaces/Floating-Space/FormulaEditor.js +++ b/Projects/Foundations/UI/Spaces/Floating-Space/FormulaEditor.js @@ -25,6 +25,6 @@ function newFormulaEditor() { function activate(action) { - UI.projects.foundations.spaces.codeEditorSpace.openSpaceArea(action.node) + UI.projects.foundations.spaces.codeEditorSpace.openSpaceArea(action.node, codeEditorType.CODE) } } diff --git a/Projects/Foundations/UI/Spaces/Floating-Space/UiObject.js b/Projects/Foundations/UI/Spaces/Floating-Space/UiObject.js index cd3f889dc..f44209352 100644 --- a/Projects/Foundations/UI/Spaces/Floating-Space/UiObject.js +++ b/Projects/Foundations/UI/Spaces/Floating-Space/UiObject.js @@ -14,7 +14,6 @@ function newUiObject() { isOnFocus: false, container: undefined, payload: undefined, - configEditor: undefined, conditionEditor: undefined, listSelector: undefined, uiObjectTitle: undefined, @@ -191,11 +190,6 @@ function newUiObject() { - if (thisObject.configEditor !== undefined) { - thisObject.configEditor.finalize() - thisObject.configEditor = undefined - } - if (thisObject.conditionEditor !== undefined) { thisObject.conditionEditor.finalize() thisObject.conditionEditor = undefined @@ -288,11 +282,6 @@ function newUiObject() { if (isDragging === false && thisObject.isOnFocus === true) { - if (thisObject.configEditor !== undefined) { - container = thisObject.configEditor.getContainer(point) - if (container !== undefined) { return container } - } - if (thisObject.conditionEditor !== undefined) { container = thisObject.conditionEditor.getContainer(point) if (container !== undefined) { return container } @@ -305,12 +294,6 @@ function newUiObject() { let getitle = true - - if (thisObject.configEditor !== undefined) { - if (thisObject.configEditor.visible === true) { - getitle = false - } - } if (thisObject.conditionEditor !== undefined) { if (thisObject.conditionEditor.visible === true) { getitle = false @@ -356,11 +339,6 @@ function newUiObject() { thisObject.uiObjectMessage.physics() - - if (thisObject.configEditor !== undefined) { - thisObject.configEditor.physics() - } - if (thisObject.conditionEditor !== undefined) { thisObject.conditionEditor.physics() } @@ -1330,9 +1308,7 @@ function newUiObject() { function onNotFocus() { thisObject.isOnFocus = false - if (thisObject.configEditor !== undefined) { - thisObject.configEditor.deactivate() - } + if (thisObject.conditionEditor !== undefined) { thisObject.conditionEditor.deactivate() } @@ -1357,9 +1333,6 @@ function newUiObject() { function onDragStarted(event) { thisObject.uiObjectTitle.exitEditMode() - if (thisObject.configEditor !== undefined) { - thisObject.configEditor.deactivate() - } if (thisObject.conditionEditor !== undefined) { thisObject.conditionEditor.deactivate() } @@ -1453,12 +1426,6 @@ function newUiObject() { let drawTitle = true - if (thisObject.configEditor !== undefined) { - if (thisObject.configEditor.visible === true) { - drawMenu = false - drawTitle = false - } - } if (thisObject.conditionEditor !== undefined) { if (thisObject.conditionEditor.visible === true) { drawMenu = false @@ -1636,9 +1603,6 @@ function newUiObject() { function isEditorVisible() { - if (thisObject.configEditor !== undefined) { - if (thisObject.configEditor.visible === true) { return true } - } if (thisObject.conditionEditor !== undefined) { if (thisObject.conditionEditor.visible === true) { return true } diff --git a/Projects/Foundations/UI/Spaces/Floating-Space/UiObjectConstructor.js b/Projects/Foundations/UI/Spaces/Floating-Space/UiObjectConstructor.js index 2864cc672..5636477d3 100644 --- a/Projects/Foundations/UI/Spaces/Floating-Space/UiObjectConstructor.js +++ b/Projects/Foundations/UI/Spaces/Floating-Space/UiObjectConstructor.js @@ -474,8 +474,6 @@ function newUiObjectConstructor() { if (schemaDocument.editors !== undefined) { if (schemaDocument.editors.config === true) { uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) uiObject.configEditor.initialize() } if (schemaDocument.editors.code === true) {