diff --git a/FloatingSpace/CodeEditor.js b/FloatingSpace/CodeEditor.js index 89bce2189..4dea3fb0c 100644 --- a/FloatingSpace/CodeEditor.js +++ b/FloatingSpace/CodeEditor.js @@ -4,8 +4,6 @@ function newCodeEditor () { let thisObject = { isVisibleFunction: undefined, - iconOK: undefined, - iconNOT_OK: undefined, visible: false, imagePathOK: undefined, imagePathNOT_OK: undefined, @@ -41,29 +39,12 @@ function newCodeEditor () { function finalize () { thisObject.container.finalize() thisObject.container = undefined - thisObject.iconOK = undefined - thisObject.iconNOT_OK = undefined thisObject.payload = undefined thisObject.isVisibleFunction = undefined } function initialize () { - /* Load Images */ - thisObject.iconOK = new Image() - thisObject.iconOK.onload = onImageLoad - - function onImageLoad () { - thisObject.iconNOT_OK = new Image() - thisObject.iconNOT_OK.onload = onImageLoad - - function onImageLoad () { - thisObject.canDrawIcon = true - } - thisObject.iconNOT_OK.src = window.canvasApp.urlPrefix + thisObject.imagePathNOT_OK - } - // thisObject.iconOK.src = window.canvasApp.urlPrefix + thisObject.imagePathOK - // thisObject.icon = thisObject.iconOK // The default value is ON. } function deactivate () { diff --git a/FloatingSpace/ConditionEditor.js b/FloatingSpace/ConditionEditor.js index c42b3dc5a..36735a41e 100644 --- a/FloatingSpace/ConditionEditor.js +++ b/FloatingSpace/ConditionEditor.js @@ -4,8 +4,6 @@ function newConditionEditor () { let thisObject = { isVisibleFunction: undefined, - iconOK: undefined, - iconNOT_OK: undefined, visible: false, imagePathOK: undefined, imagePathNOT_OK: undefined, @@ -42,37 +40,17 @@ function newConditionEditor () { function finalize () { thisObject.container.finalize() thisObject.container = undefined - thisObject.iconOK = undefined - thisObject.iconNOT_OK = undefined thisObject.payload = undefined thisObject.isVisibleFunction = undefined } function initialize () { - /* Load Images */ - thisObject.iconOK = new Image() - thisObject.iconOK.onload = onImageLoad - - function onImageLoad () { - thisObject.iconNOT_OK = new Image() - thisObject.iconNOT_OK.onload = onImageLoad - - function onImageLoad () { - thisObject.canDrawIcon = true - } - thisObject.iconNOT_OK.src = window.canvasApp.urlPrefix + thisObject.imagePathNOT_OK - } - // thisObject.iconOK.src = window.canvasApp.urlPrefix + thisObject.imagePathOK - // thisObject.icon = thisObject.iconOK // The default value is ON. } function deactivate () { if (thisObject.visible === true) { thisObject.visible = false - let textArea = document.getElementById('textArea') - textArea.style.display = 'none' - thisObject.payload.node.code = textArea.value } EDITOR_ON_FOCUS = false } @@ -85,22 +63,6 @@ function newConditionEditor () { thisObject.currentRadius = 0 thisObject.payload.uiObject.setErrorMessage('', 0) - let textArea = document.getElementById('textArea') - textArea.value = payload.node.code - 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.GREY + ');' + - 'color:rgb(255, 255, 255);' + - 'width: ' + thisObject.container.frame.width + 'px;' + - 'height: ' + thisObject.container.frame.height + 'px' - textArea.style.display = 'block' - textArea.focus() - scanDataMines() EDITOR_ON_FOCUS = true } @@ -190,26 +152,6 @@ function newConditionEditor () { thisObject.container.frame.width = thisObject.container.frame.radius * 1.8 * 2 thisObject.container.frame.height = thisObject.container.frame.radius * 1 * 2 - - 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 () { diff --git a/FloatingSpace/ConfigEditor.js b/FloatingSpace/ConfigEditor.js index 5ddb74eac..b25331644 100644 --- a/FloatingSpace/ConfigEditor.js +++ b/FloatingSpace/ConfigEditor.js @@ -4,8 +4,6 @@ function newConfigEditor () { let thisObject = { isVisibleFunction: undefined, - iconOK: undefined, - iconNOT_OK: undefined, visible: false, imagePathOK: undefined, imagePathNOT_OK: undefined, @@ -41,29 +39,12 @@ function newConfigEditor () { function finalize () { thisObject.container.finalize() thisObject.container = undefined - thisObject.iconOK = undefined - thisObject.iconNOT_OK = undefined thisObject.payload = undefined thisObject.isVisibleFunction = undefined } function initialize () { - /* Load Images */ - thisObject.iconOK = new Image() - thisObject.iconOK.onload = onImageLoad - - function onImageLoad () { - thisObject.iconNOT_OK = new Image() - thisObject.iconNOT_OK.onload = onImageLoad - - function onImageLoad () { - thisObject.canDrawIcon = true - } - thisObject.iconNOT_OK.src = window.canvasApp.urlPrefix + thisObject.imagePathNOT_OK - } - // thisObject.iconOK.src = window.canvasApp.urlPrefix + thisObject.imagePathOK - // thisObject.icon = thisObject.iconOK // The default value is ON. } function deactivate () { diff --git a/FloatingSpace/FormulaEditor.js b/FloatingSpace/FormulaEditor.js index 0872f1b5f..596f1ba27 100644 --- a/FloatingSpace/FormulaEditor.js +++ b/FloatingSpace/FormulaEditor.js @@ -4,8 +4,6 @@ function newFormulaEditor () { let thisObject = { isVisibleFunction: undefined, - iconOK: undefined, - iconNOT_OK: undefined, visible: false, imagePathOK: undefined, imagePathNOT_OK: undefined, @@ -41,29 +39,12 @@ function newFormulaEditor () { function finalize () { thisObject.container.finalize() thisObject.container = undefined - thisObject.iconOK = undefined - thisObject.iconNOT_OK = undefined thisObject.payload = undefined thisObject.isVisibleFunction = undefined } function initialize () { - /* Load Images */ - thisObject.iconOK = new Image() - thisObject.iconOK.onload = onImageLoad - - function onImageLoad () { - thisObject.iconNOT_OK = new Image() - thisObject.iconNOT_OK.onload = onImageLoad - - function onImageLoad () { - thisObject.canDrawIcon = true - } - thisObject.iconNOT_OK.src = window.canvasApp.urlPrefix + thisObject.imagePathNOT_OK - } - // thisObject.iconOK.src = window.canvasApp.urlPrefix + thisObject.imagePathOK - // thisObject.icon = thisObject.iconOK // The default value is ON. } function deactivate () { diff --git a/FloatingSpace/Picker.js b/FloatingSpace/Picker.js new file mode 100644 index 000000000..8f00f9c81 --- /dev/null +++ b/FloatingSpace/Picker.js @@ -0,0 +1,61 @@ + +function newPicker () { + const MODULE_NAME = 'Picker' + + let thisObject = { + container: undefined, + 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.frame.radius = 0 + thisObject.container.frame.position.x = 0 + thisObject.container.frame.position.y = 0 + thisObject.container.frame.width = 50 + thisObject.container.frame.height = 100 + + let optionsList + return thisObject + + function finalize () { + thisObject.container.finalize() + thisObject.container = undefined + optionsList = undefined + } + + function initialize (pOptionsList, payload) { + optionsList = pOptionsList + } + + function getContainer (point) { + let container + + if (thisObject.container.frame.isThisPointHere(point, true, false) === true) { + return thisObject.container + } + } + + function physics () { + + } + + function drawBackground (pFloatingObject) { + + } + + function drawForeground (pFloatingObject) { + const FONT_SIZE = 15 + + for (let i = 0; i < optionsList.length; i++) { + drawLabel(optionsList[i], 1 / 2, i / optionsList.length, 0, 0, FONT_SIZE, thisObject.container, UI_COLOR.BLACK, undefined, undefined) + } + } +}