conditions editor
This commit is contained in:
1 parent
ec6e9fc907
commit
879aefcfea
9 files changed
+843
-121
No files matched your search
+6
-10
@@ -2224,7 +2224,7 @@
|
||||
"compatibleTypes": "->Trading System->"
|
||||
},
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Process Instance->"
|
||||
"compatibleTypes": "->Trading Process Instance->"
|
||||
},
|
||||
"icon": "session-paper-trading",
|
||||
"properties": [
|
||||
@@ -2309,7 +2309,7 @@
|
||||
"compatibleTypes": "->Trading System->"
|
||||
},
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Process Instance->"
|
||||
"compatibleTypes": "->Trading Process Instance->"
|
||||
},
|
||||
"icon": "session-forward-testing",
|
||||
"properties": [
|
||||
@@ -2419,7 +2419,7 @@
|
||||
"compatibleTypes": "->Trading System->"
|
||||
},
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Process Instance->"
|
||||
"compatibleTypes": "->Trading Process Instance->"
|
||||
},
|
||||
"icon": "session-live-trading",
|
||||
"properties": [
|
||||
@@ -4829,7 +4829,7 @@
|
||||
{
|
||||
"action": "Send Webhook Test Message",
|
||||
"label": "Send Test Message",
|
||||
"workingLabel": "Seinding Message",
|
||||
"workingLabel": "Sending Message",
|
||||
"workDoneLabel": "Message Sent",
|
||||
"workFailedLabel": "Message not Delived",
|
||||
"iconPathOn": "paper-plane",
|
||||
@@ -6115,7 +6115,7 @@
|
||||
"compatibleTypes": "->Crypto Exchange->"
|
||||
},
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Data Mining->Testing Environmnet->Production Environment->Template Structure->"
|
||||
"compatibleTypes": "->Data Mining->Testing Environment->Production Environment->Template Structure->"
|
||||
},
|
||||
"alternativeIcons": "Use Reference Parent",
|
||||
"title": [
|
||||
@@ -6184,7 +6184,6 @@
|
||||
"name": "exchangeTasks",
|
||||
"type": "array",
|
||||
"childType": "Exchange Tasks",
|
||||
"autoAdd": true,
|
||||
"monitorChildrenRunning": true
|
||||
}
|
||||
]
|
||||
@@ -6241,7 +6240,6 @@
|
||||
"name": "exchangeTasks",
|
||||
"type": "array",
|
||||
"childType": "Exchange Tasks",
|
||||
"autoAdd": true,
|
||||
"monitorChildrenRunning": true
|
||||
}
|
||||
]
|
||||
@@ -6298,7 +6296,6 @@
|
||||
"name": "exchangeTasks",
|
||||
"type": "array",
|
||||
"childType": "Exchange Tasks",
|
||||
"autoAdd": true,
|
||||
"monitorChildrenRunning": true
|
||||
}
|
||||
]
|
||||
@@ -6453,8 +6450,7 @@
|
||||
{
|
||||
"name": "exchangeSessions",
|
||||
"type": "array",
|
||||
"childType": "Exchange Sessions",
|
||||
"autoAdd": true
|
||||
"childType": "Exchange Sessions"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -7,9 +7,6 @@ function newConditionEditor () {
|
||||
visible: false,
|
||||
imagePathOK: undefined,
|
||||
imagePathNOT_OK: undefined,
|
||||
rawRadius: undefined,
|
||||
targetRadius: undefined,
|
||||
currentRadius: undefined,
|
||||
container: undefined,
|
||||
payload: undefined,
|
||||
deactivate: deactivate,
|
||||
@@ -23,17 +20,17 @@ function newConditionEditor () {
|
||||
}
|
||||
|
||||
thisObject.container = newContainer()
|
||||
thisObject.container.initialize(MODULE_NAME)
|
||||
thisObject.container.initialize(MODULE_NAME, 'Circle')
|
||||
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
|
||||
thisObject.container.frame.radius = 750
|
||||
thisObject.container.frame.containerName = MODULE_NAME
|
||||
|
||||
let isMouseOver = false
|
||||
let operatorA = {}
|
||||
let operatorB = {}
|
||||
let operationPicker
|
||||
let operatorA
|
||||
let operatorB
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -42,30 +39,239 @@ function newConditionEditor () {
|
||||
thisObject.container = undefined
|
||||
thisObject.payload = undefined
|
||||
thisObject.isVisibleFunction = undefined
|
||||
|
||||
operationPicker = undefined
|
||||
operatorA = undefined
|
||||
operatorB = undefined
|
||||
}
|
||||
|
||||
function initialize () {
|
||||
|
||||
}
|
||||
|
||||
function activate (payload) {
|
||||
thisObject.visible = true
|
||||
thisObject.payload = payload
|
||||
thisObject.payload.uiObject.setErrorMessage('', 0)
|
||||
|
||||
operatorA = {}
|
||||
operatorB = {}
|
||||
scanDataMines()
|
||||
initializePickers()
|
||||
|
||||
loadFromCode()
|
||||
EDITOR_ON_FOCUS = true
|
||||
}
|
||||
|
||||
function deactivate () {
|
||||
convertToCode()
|
||||
finalizePickers()
|
||||
|
||||
if (thisObject.visible === true) {
|
||||
thisObject.visible = false
|
||||
}
|
||||
EDITOR_ON_FOCUS = false
|
||||
}
|
||||
|
||||
function activate (payload) {
|
||||
thisObject.visible = true
|
||||
thisObject.payload = payload
|
||||
thisObject.rawRadius = 8
|
||||
thisObject.targetRadius = thisObject.container.frame.radius
|
||||
thisObject.currentRadius = 0
|
||||
thisObject.payload.uiObject.setErrorMessage('', 0)
|
||||
function convertToCode () {
|
||||
if (operatorA === undefined || operatorB === undefined || operationPicker === undefined) { return }
|
||||
|
||||
scanDataMines()
|
||||
setUpPickers()
|
||||
EDITOR_ON_FOCUS = true
|
||||
// chart.at01hs.bollingerSubChannel.previous.previous.slope=== "Extreme"
|
||||
let code = ''
|
||||
|
||||
code = code + 'chart.at' + operatorA.timeFramePicker.getSelected().replace('-', '')
|
||||
code = code + '.' + operatorA.productPicker.getSelected()
|
||||
insertWhen(operatorA)
|
||||
code = code + '.' + operatorA.propertyPicker.getSelected()
|
||||
|
||||
switch (operationPicker.getSelected()) {
|
||||
case 'Greater Than': {
|
||||
code = code + ' > '
|
||||
break
|
||||
}
|
||||
case 'Less Than': {
|
||||
code = code + ' < '
|
||||
break
|
||||
}
|
||||
case 'Greater or Equal Than': {
|
||||
code = code + ' >= '
|
||||
break
|
||||
}
|
||||
case 'Less or Equal Than': {
|
||||
code = code + ' <= '
|
||||
break
|
||||
}
|
||||
case 'Equal To': {
|
||||
code = code + ' === '
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (operationPicker.getSelected() === 'Equal To') {
|
||||
code = code + '"' + operatorA.valuePicker.getSelected() + '"'
|
||||
} else {
|
||||
code = code + 'chart.at' + operatorB.timeFramePicker.getSelected().replace('-', '')
|
||||
code = code + '.' + operatorB.productPicker.getSelected()
|
||||
insertWhen(operatorB)
|
||||
code = code + '.' + operatorB.propertyPicker.getSelected()
|
||||
}
|
||||
|
||||
thisObject.payload.node.code = code
|
||||
|
||||
function insertWhen (operator) {
|
||||
switch (operator.whenPicker.getSelected()) {
|
||||
case 'Current': {
|
||||
return
|
||||
}
|
||||
case '1 Previous': {
|
||||
code = code + '.previous'
|
||||
return
|
||||
}
|
||||
case '2 Previous': {
|
||||
code = code + '.previous.previous'
|
||||
return
|
||||
}
|
||||
case '3 Previous': {
|
||||
code = code + '.previous.previous.previous'
|
||||
return
|
||||
}
|
||||
case '4 Previous': {
|
||||
code = code + '.previous.previous.previous.previous'
|
||||
return
|
||||
}
|
||||
case '5 Previous': {
|
||||
code = code + '.previous.previous.previous.previous.previous'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadFromCode () {
|
||||
if (thisObject.payload.node.code === undefined || thisObject.payload.node.code === '') { return }
|
||||
|
||||
let code = thisObject.payload.node.code
|
||||
let codeA
|
||||
let codeB
|
||||
|
||||
if (code.indexOf(' > ') > 0) {
|
||||
let codeArray = code.split(' > ')
|
||||
codeA = codeArray[0]
|
||||
codeB = codeArray[1]
|
||||
operationPicker.setSelected(undefined, undefined, undefined, 0)
|
||||
}
|
||||
|
||||
if (code.indexOf(' < ') > 0) {
|
||||
let codeArray = code.split(' < ')
|
||||
codeA = codeArray[0]
|
||||
codeB = codeArray[1]
|
||||
operationPicker.setSelected(undefined, undefined, undefined, 1)
|
||||
}
|
||||
|
||||
if (code.indexOf(' >= ') > 0) {
|
||||
let codeArray = code.split(' >= ')
|
||||
codeA = codeArray[0]
|
||||
codeB = codeArray[1]
|
||||
operationPicker.setSelected(undefined, undefined, undefined, 2)
|
||||
}
|
||||
|
||||
if (code.indexOf(' <= ') > 0) {
|
||||
let codeArray = code.split(' <= ')
|
||||
codeA = codeArray[0]
|
||||
codeB = codeArray[1]
|
||||
operationPicker.setSelected(undefined, undefined, undefined, 3)
|
||||
}
|
||||
|
||||
if (code.indexOf(' === ') > 0) {
|
||||
let codeArray = code.split(' === ')
|
||||
codeA = codeArray[0]
|
||||
codeB = codeArray[1]
|
||||
operationPicker.setSelected(undefined, undefined, undefined, 4)
|
||||
}
|
||||
|
||||
let codeAArray = codeA.split('.')
|
||||
let codeBArray = codeB.split('.')
|
||||
|
||||
updatePickers(operatorA, codeAArray)
|
||||
updatePickers(operatorB, codeBArray)
|
||||
|
||||
function updatePickers (operator, codeArray) {
|
||||
let codeTimeFrame = codeArray[1].substring(2, 4) + '-' + codeArray[1].substring(4, 7)
|
||||
let codeProduct = codeArray[2]
|
||||
|
||||
/* Parse When */
|
||||
let propertyDisplacement = 0
|
||||
let codeWhen = 'Current'
|
||||
if (codeArray[3] === 'previous') {
|
||||
propertyDisplacement++
|
||||
codeWhen = '1 Previous'
|
||||
}
|
||||
if (codeArray[4] === 'previous') {
|
||||
propertyDisplacement++
|
||||
codeWhen = '2 Previous'
|
||||
}
|
||||
if (codeArray[5] === 'previous') {
|
||||
propertyDisplacement++
|
||||
codeWhen = '3 Previous'
|
||||
}
|
||||
if (codeArray[6] === 'previous') {
|
||||
propertyDisplacement++
|
||||
codeWhen = '4 Previous'
|
||||
}
|
||||
if (codeArray[7] === 'previous') {
|
||||
propertyDisplacement++
|
||||
codeWhen = '5 Previous'
|
||||
}
|
||||
operator.whenPicker.setSelected(undefined, undefined, undefined, propertyDisplacement)
|
||||
|
||||
let codeProperty = codeArray[3 + propertyDisplacement]
|
||||
let codeValue = codeBArray[0].replace('"', '').replace('"', '')
|
||||
|
||||
let dataMines = Object.keys(operator.selector)
|
||||
for (let i = 0; i < dataMines.length; i++) {
|
||||
let dataMine = dataMines[i]
|
||||
let dataMineObject = operator.selector[dataMine]
|
||||
let bots = Object.keys(dataMineObject)
|
||||
for (let j = 0; j < bots.length; j++) {
|
||||
let bot = bots[j]
|
||||
let botObject = dataMineObject[bot]
|
||||
let products = Object.keys(botObject)
|
||||
for (let k = 0; k < products.length; k++) {
|
||||
let product = products[k]
|
||||
let productObject = botObject[product]
|
||||
if (codeProduct === product) {
|
||||
operator.dataMinePicker.setSelected(dataMines, operator.selector, undefined, i)
|
||||
operator.botPicker.setSelected(bots, dataMineObject, operator.selector, j)
|
||||
operator.productPicker.setSelected(products, botObject, dataMineObject, k)
|
||||
let properties = Object.keys(productObject.properties)
|
||||
for (let m = 0; m < properties.length; m++) {
|
||||
let property = properties[m]
|
||||
let propertyObject = productObject.properties[property]
|
||||
if (codeProperty === property) {
|
||||
operator.propertyPicker.setSelected(properties, productObject.properties, botObject, m)
|
||||
let values = propertyObject.possibleValues
|
||||
for (let n = 0; n < values.length; n++) {
|
||||
let value = values[n]
|
||||
let valueObject = propertyObject[value]
|
||||
if (codeValue === value) {
|
||||
operator.valuePicker.setSelected(values, propertyObject, productObject, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let timeFrames = productObject.validTimeFrames
|
||||
for (let m = 0; m < timeFrames.length; m++) {
|
||||
let timeFrame = timeFrames[m]
|
||||
let timeFrameObject = productObject.validTimeFrames[timeFrame]
|
||||
if (codeTimeFrame === timeFrame) {
|
||||
operator.timeFramePicker.setSelected(timeFrames, productObject, botObject, m)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function scanDataMines () {
|
||||
@@ -90,18 +296,32 @@ function newConditionEditor () {
|
||||
let productName = loadPropertyFromNodeConfig(product.payload, 'singularVariableName')
|
||||
if (productName === undefined) { continue }
|
||||
let selectorProduct = selectorDataMine[botName]
|
||||
selectorProduct[productName] = {}
|
||||
selectorProduct[productName] = {
|
||||
properties: {}
|
||||
}
|
||||
if (product.record === undefined) { continue }
|
||||
for (let m = 0; m < product.record.properties.length; m++) {
|
||||
let property = product.record.properties[m]
|
||||
let propertyName = loadPropertyFromNodeConfig(property.payload, 'codeName')
|
||||
let selectorProperty = selectorProduct[productName]
|
||||
selectorProperty = selectorProperty.properties
|
||||
selectorProperty[propertyName] = {}
|
||||
let possibleValues = loadPropertyFromNodeConfig(property.payload, 'possibleValues')
|
||||
if (possibleValues === undefined) { possibleValues = [] }
|
||||
let selectorPossibleValue = selectorProperty[propertyName]
|
||||
selectorPossibleValue.possibleValues = possibleValues
|
||||
}
|
||||
let allPossibleTimeFrames = []
|
||||
for (let m = 0; m < product.datasets.length; m++) {
|
||||
let dataset = product.datasets[m]
|
||||
let validTimeFrames = loadPropertyFromNodeConfig(dataset.payload, 'validTimeFrames')
|
||||
if (validTimeFrames !== undefined) {
|
||||
allPossibleTimeFrames = allPossibleTimeFrames.concat(validTimeFrames)
|
||||
}
|
||||
}
|
||||
let selectorValidTimeFrames = selectorProduct[productName]
|
||||
selectorValidTimeFrames.validTimeFrames = allPossibleTimeFrames
|
||||
|
||||
let productKeys = Object.keys(selectorProduct[productName])
|
||||
if (productKeys.length === 0) {
|
||||
selectorProduct[productName] = undefined
|
||||
@@ -121,25 +341,302 @@ function newConditionEditor () {
|
||||
operatorB.selector = JSON.parse(JSON.stringify(selector))
|
||||
}
|
||||
|
||||
function setUpPickers () {
|
||||
operatorA.dataMinePicker = newPicker()
|
||||
operatorA.dataMinePicker.container.connectToParent(thisObject.container)
|
||||
operatorA.dataMinePicker.container.frame.position.x = 0 - operatorA.dataMinePicker.container.frame.width / 2
|
||||
operatorA.dataMinePicker.container.frame.position.y = 0 - operatorA.dataMinePicker.container.frame.height / 2
|
||||
operatorA.dataMinePicker.initialize(Object.keys(operatorA.selector))
|
||||
function initializePickers () {
|
||||
initializeOperator(operatorA, -1)
|
||||
initializeOperator(operatorB, 1)
|
||||
|
||||
operationPicker = newPicker()
|
||||
operationPicker.name = 'Data Mine'
|
||||
operationPicker.container.connectToParent(thisObject.container)
|
||||
operationPicker.container.frame.position.x = 0 - operationPicker.container.frame.width / 2
|
||||
operationPicker.container.frame.position.y = 0 - operationPicker.container.frame.height / 2
|
||||
current = ['Greater Than', 'Less Than', 'Greater or Equal Than', 'Less or Equal Than', 'Equal To']
|
||||
operationPicker.initialize(current, current)
|
||||
|
||||
operationPicker.eventSuscriptionId = operationPicker.container.eventHandler.listenToEvent('onParentChanged', onParentChanged)
|
||||
}
|
||||
|
||||
function initializeOperator (operator, ySign) {
|
||||
let properties
|
||||
let parent
|
||||
let current
|
||||
|
||||
operator.whenPicker = newPicker()
|
||||
operator.whenPicker.name = 'When'
|
||||
operator.whenPicker.container.connectToParent(thisObject.container)
|
||||
operator.whenPicker.container.frame.position.x = 0 - operator.whenPicker.container.frame.width / 2 - operator.whenPicker.container.frame.width * 0.5
|
||||
operator.whenPicker.container.frame.position.y = 0 - operator.whenPicker.container.frame.height / 2 + operator.whenPicker.container.frame.height * ySign
|
||||
current = ['Current', '1 Previous', '2 Previous', '3 Previous', '4 Previous', '5 Previous']
|
||||
operator.whenPicker.initialize(current, current)
|
||||
operator.whenPicker.visible = true
|
||||
|
||||
operator.dataMinePicker = newPicker()
|
||||
operator.dataMinePicker.name = 'Data Mine'
|
||||
operator.dataMinePicker.container.connectToParent(thisObject.container)
|
||||
operator.dataMinePicker.container.frame.position.x = 0 - operator.dataMinePicker.container.frame.width / 2 - operator.dataMinePicker.container.frame.width * 2.5
|
||||
operator.dataMinePicker.container.frame.position.y = 0 - operator.dataMinePicker.container.frame.height / 2 + operator.dataMinePicker.container.frame.height * ySign
|
||||
current = operator.selector
|
||||
properties = Object.keys(current)
|
||||
operator.dataMinePicker.initialize(properties, current)
|
||||
parent = current
|
||||
operator.dataMinePicker.visible = true
|
||||
|
||||
operator.botPicker = newPicker()
|
||||
operator.botPicker.name = 'Bot'
|
||||
operator.botPicker.container.connectToParent(thisObject.container)
|
||||
operator.botPicker.container.frame.position.x = 0 - operator.botPicker.container.frame.width / 2 - operator.botPicker.container.frame.width * 1.5
|
||||
operator.botPicker.container.frame.position.y = 0 - operator.botPicker.container.frame.height / 2 + operator.dataMinePicker.container.frame.height * ySign
|
||||
current = parent[properties[0]]
|
||||
properties = Object.keys(current)
|
||||
operator.botPicker.initialize(properties, current, parent)
|
||||
parent = current
|
||||
operator.botPicker.visible = true
|
||||
|
||||
operator.productPicker = newPicker()
|
||||
operator.productPicker.name = 'Product'
|
||||
operator.productPicker.container.connectToParent(thisObject.container)
|
||||
operator.productPicker.container.frame.position.x = 0 - operator.productPicker.container.frame.width / 2 + operator.productPicker.container.frame.width * 0.5
|
||||
operator.productPicker.container.frame.position.y = 0 - operator.productPicker.container.frame.height / 2 + operator.dataMinePicker.container.frame.height * ySign
|
||||
current = parent[properties[0]]
|
||||
properties = Object.keys(current)
|
||||
operator.productPicker.initialize(properties, current, parent)
|
||||
parent = current
|
||||
operator.productPicker.visible = true
|
||||
|
||||
let productParent = parent
|
||||
let productProperties = properties
|
||||
|
||||
operator.propertyPicker = newPicker()
|
||||
operator.propertyPicker.name = 'Property'
|
||||
operator.propertyPicker.container.connectToParent(thisObject.container)
|
||||
operator.propertyPicker.container.frame.position.x = 0 - operator.propertyPicker.container.frame.width / 2 + operator.propertyPicker.container.frame.width * 1.5
|
||||
operator.propertyPicker.container.frame.position.y = 0 - operator.propertyPicker.container.frame.height / 2 + operator.dataMinePicker.container.frame.height * ySign
|
||||
current = productParent[productProperties[0]]
|
||||
current = current.properties
|
||||
properties = Object.keys(current)
|
||||
operator.propertyPicker.initialize(properties, current, productParent, 'properties')
|
||||
parent = current
|
||||
operator.propertyPicker.visible = true
|
||||
|
||||
operator.valuePicker = newPicker()
|
||||
operator.valuePicker.name = 'Value'
|
||||
operator.valuePicker.container.connectToParent(thisObject.container)
|
||||
operator.valuePicker.container.frame.position.x = 0 - operator.valuePicker.container.frame.width / 2
|
||||
operator.valuePicker.container.frame.position.y = 0 - operator.valuePicker.container.frame.height / 2 + operator.valuePicker.container.frame.height * 1
|
||||
current = parent[properties[0]]
|
||||
properties = current.possibleValues
|
||||
operator.valuePicker.initialize(properties, current, parent, 'possibleValues')
|
||||
parent = current
|
||||
operator.valuePicker.visible = false
|
||||
|
||||
operator.timeFramePicker = newPicker()
|
||||
operator.timeFramePicker.name = 'Time Frame'
|
||||
operator.timeFramePicker.container.connectToParent(thisObject.container)
|
||||
operator.timeFramePicker.container.frame.position.x = 0 - operator.timeFramePicker.container.frame.width / 2 + operator.timeFramePicker.container.frame.width * 2.5
|
||||
operator.timeFramePicker.container.frame.position.y = 0 - operator.timeFramePicker.container.frame.height / 2 + operator.timeFramePicker.container.frame.height * ySign
|
||||
current = productParent[productProperties[0]]
|
||||
properties = current.validTimeFrames
|
||||
operator.timeFramePicker.initialize(properties, current, productParent, 'validTimeFrames')
|
||||
parent = current
|
||||
operator.timeFramePicker.visible = true
|
||||
|
||||
operator.botPicker.eventSuscriptionId = operator.dataMinePicker.container.eventHandler.listenToEvent('onParentChanged', operator.botPicker.onParentChanged)
|
||||
operator.productPicker.eventSuscriptionId = operator.botPicker.container.eventHandler.listenToEvent('onParentChanged', operator.productPicker.onParentChanged)
|
||||
operator.propertyPicker.eventSuscriptionId = operator.productPicker.container.eventHandler.listenToEvent('onParentChanged', operator.propertyPicker.onParentChanged)
|
||||
operator.valuePicker.eventSuscriptionId = operator.propertyPicker.container.eventHandler.listenToEvent('onParentChanged', operator.valuePicker.onParentChanged)
|
||||
operator.timeFramePicker.eventSuscriptionId = operator.productPicker.container.eventHandler.listenToEvent('onParentChanged', operator.timeFramePicker.onParentChanged)
|
||||
}
|
||||
|
||||
function finalizePickers () {
|
||||
finalizeOperator(operatorA)
|
||||
finalizeOperator(operatorB)
|
||||
|
||||
operatorA = undefined
|
||||
operatorB = undefined
|
||||
|
||||
if (operationPicker !== undefined) {
|
||||
operationPicker.container.eventHandler.stopListening(operationPicker.eventSuscriptionId)
|
||||
operationPicker.finalize()
|
||||
operationPicker = undefined
|
||||
}
|
||||
}
|
||||
|
||||
function finalizeOperator (operator) {
|
||||
if (operator === undefined) { return }
|
||||
|
||||
if (operator.whenPicker !== undefined) {
|
||||
operator.whenPicker.finalize()
|
||||
operator.whenPicker = undefined
|
||||
}
|
||||
|
||||
if (operator.dataMinePicker !== undefined) {
|
||||
operator.dataMinePicker.container.eventHandler.stopListening(operator.botPicker.eventSuscriptionId)
|
||||
operator.dataMinePicker.finalize()
|
||||
operator.dataMinePicker = undefined
|
||||
}
|
||||
|
||||
if (operator.botPicker !== undefined) {
|
||||
operator.botPicker.container.eventHandler.stopListening(operator.productPicker.eventSuscriptionId)
|
||||
operator.botPicker.finalize()
|
||||
operator.botPicker = undefined
|
||||
}
|
||||
|
||||
if (operator.productPicker !== undefined) {
|
||||
operator.productPicker.container.eventHandler.stopListening(operator.propertyPicker.eventSuscriptionId)
|
||||
operator.productPicker.container.eventHandler.stopListening(operator.timeFramePicker.eventSuscriptionId)
|
||||
operator.productPicker.finalize()
|
||||
operator.productPicker = undefined
|
||||
}
|
||||
|
||||
if (operator.propertyPicker !== undefined) {
|
||||
operator.propertyPicker.container.eventHandler.stopListening(operator.valuePicker.eventSuscriptionId)
|
||||
operator.propertyPicker.finalize()
|
||||
operator.propertyPicker = undefined
|
||||
}
|
||||
|
||||
if (operator.valuePicker !== undefined) {
|
||||
operator.valuePicker.finalize()
|
||||
operator.valuePicker = undefined
|
||||
}
|
||||
|
||||
if (operator.timeFramePicker !== undefined) {
|
||||
operator.timeFramePicker.finalize()
|
||||
operator.timeFramePicker = undefined
|
||||
}
|
||||
}
|
||||
|
||||
function onParentChanged (event) {
|
||||
if (event.selected === 4) {
|
||||
// this means Equal To
|
||||
|
||||
operatorA.valuePicker.visible = true
|
||||
operatorB.whenPicker.visible = false
|
||||
operatorB.dataMinePicker.visible = false
|
||||
operatorB.botPicker.visible = false
|
||||
operatorB.productPicker.visible = false
|
||||
operatorB.propertyPicker.visible = false
|
||||
operatorB.timeFramePicker.visible = false
|
||||
} else {
|
||||
operatorA.valuePicker.visible = false
|
||||
operatorB.whenPicker.visible = true
|
||||
operatorB.dataMinePicker.visible = true
|
||||
operatorB.botPicker.visible = true
|
||||
operatorB.productPicker.visible = true
|
||||
operatorB.propertyPicker.visible = true
|
||||
operatorB.timeFramePicker.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
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 code 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 (operationPicker !== undefined) {
|
||||
container = operationPicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true, false) === true) {
|
||||
if (operatorA !== undefined) {
|
||||
if (operatorA.whenPicker !== undefined) {
|
||||
if (operatorA.whenPicker.visible === true) {
|
||||
container = operatorA.whenPicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorA.dataMinePicker !== undefined) {
|
||||
if (operatorA.dataMinePicker.visible === true) {
|
||||
container = operatorA.dataMinePicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorA.botPicker !== undefined) {
|
||||
if (operatorA.botPicker.visible === true) {
|
||||
container = operatorA.botPicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorA.productPicker !== undefined) {
|
||||
if (operatorA.productPicker.visible === true) {
|
||||
container = operatorA.productPicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorA.propertyPicker !== undefined) {
|
||||
if (operatorA.propertyPicker.visible === true) {
|
||||
container = operatorA.propertyPicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorA.valuePicker !== undefined) {
|
||||
if (operatorA.valuePicker.visible === true) {
|
||||
container = operatorA.valuePicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorA.timeFramePicker !== undefined) {
|
||||
if (operatorA.timeFramePicker.visible === true) {
|
||||
container = operatorA.timeFramePicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (operatorB !== undefined) {
|
||||
if (operatorB.whenPicker !== undefined) {
|
||||
if (operatorB.whenPicker.visible === true) {
|
||||
container = operatorB.whenPicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorB.dataMinePicker !== undefined) {
|
||||
if (operatorB.dataMinePicker.visible === true) {
|
||||
container = operatorB.dataMinePicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorB.botPicker !== undefined) {
|
||||
if (operatorB.botPicker.visible === true) {
|
||||
container = operatorB.botPicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorB.productPicker !== undefined) {
|
||||
if (operatorB.productPicker.visible === true) {
|
||||
container = operatorB.productPicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorB.propertyPicker !== undefined) {
|
||||
if (operatorB.propertyPicker.visible === true) {
|
||||
container = operatorB.propertyPicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorB.valuePicker !== undefined) {
|
||||
if (operatorB.valuePicker.visible === true) {
|
||||
container = operatorB.valuePicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
|
||||
if (operatorB.timeFramePicker !== undefined) {
|
||||
if (operatorB.timeFramePicker.visible === true) {
|
||||
container = operatorB.timeFramePicker.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
return thisObject.container
|
||||
} else {
|
||||
return undefined
|
||||
@@ -149,29 +646,52 @@ function newConditionEditor () {
|
||||
|
||||
function physics () {
|
||||
thisObjectphysics()
|
||||
operatorsPhysics()
|
||||
operatorsPhysics(operatorA)
|
||||
operatorsPhysics(operatorB)
|
||||
|
||||
if (operationPicker !== undefined) {
|
||||
operationPicker.physics()
|
||||
}
|
||||
}
|
||||
|
||||
function operatorsPhysics () {
|
||||
if (operatorA.dataMinePicker !== undefined) {
|
||||
operatorA.dataMinePicker.physics()
|
||||
function selectionPhysics () {
|
||||
|
||||
}
|
||||
|
||||
function operatorsPhysics (operator) {
|
||||
if (operator === undefined) { return }
|
||||
|
||||
if (operator.whenPicker !== undefined) {
|
||||
operator.whenPicker.physics()
|
||||
}
|
||||
|
||||
if (operator.dataMinePicker !== undefined) {
|
||||
operator.dataMinePicker.physics()
|
||||
}
|
||||
|
||||
if (operator.botPicker !== undefined) {
|
||||
operator.botPicker.physics()
|
||||
}
|
||||
|
||||
if (operator.productPicker !== undefined) {
|
||||
operator.productPicker.physics()
|
||||
}
|
||||
|
||||
if (operator.propertyPicker !== undefined) {
|
||||
operator.propertyPicker.physics()
|
||||
}
|
||||
|
||||
if (operator.valuePicker !== undefined) {
|
||||
operator.valuePicker.physics()
|
||||
}
|
||||
|
||||
if (operator.timeFramePicker !== undefined) {
|
||||
operator.timeFramePicker.physics()
|
||||
}
|
||||
}
|
||||
|
||||
function thisObjectphysics () {
|
||||
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 * 2
|
||||
thisObject.container.frame.height = thisObject.container.frame.radius * 1 * 2
|
||||
}
|
||||
|
||||
function drawBackground () {
|
||||
@@ -180,8 +700,57 @@ function newConditionEditor () {
|
||||
}
|
||||
|
||||
function childrenDrawBackground () {
|
||||
if (operatorA.dataMinePicker !== undefined) {
|
||||
operatorA.dataMinePicker.drawBackground()
|
||||
operatorDrawBackground(operatorA)
|
||||
operatorDrawBackground(operatorB)
|
||||
|
||||
if (operationPicker !== undefined) {
|
||||
operationPicker.drawBackground()
|
||||
}
|
||||
}
|
||||
|
||||
function operatorDrawBackground (operator) {
|
||||
if (operator === undefined) { return }
|
||||
|
||||
if (operator.whenPicker !== undefined) {
|
||||
if (operator.whenPicker.visible === true) {
|
||||
operator.whenPicker.drawBackground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.dataMinePicker !== undefined) {
|
||||
if (operator.dataMinePicker.visible === true) {
|
||||
operator.dataMinePicker.drawBackground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.botPicker !== undefined) {
|
||||
if (operator.botPicker.visible === true) {
|
||||
operator.botPicker.drawBackground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.productPicker !== undefined) {
|
||||
if (operator.productPicker.visible === true) {
|
||||
operator.productPicker.drawBackground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.propertyPicker !== undefined) {
|
||||
if (operator.propertyPicker.visible === true) {
|
||||
operator.propertyPicker.drawBackground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.valuePicker !== undefined) {
|
||||
if (operator.valuePicker.visible === true) {
|
||||
operator.valuePicker.drawBackground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.timeFramePicker !== undefined) {
|
||||
if (operator.timeFramePicker.visible === true) {
|
||||
operator.timeFramePicker.drawBackground()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,21 +763,19 @@ function newConditionEditor () {
|
||||
|
||||
position = thisObject.container.frame.frameThisPoint(position)
|
||||
|
||||
let radius = thisObject.container.frame.radius * 1
|
||||
let radius = thisObject.container.frame.radius
|
||||
|
||||
if (radius > 0.5) {
|
||||
browserCanvasContext.beginPath()
|
||||
browserCanvasContext.arc(position.x, position.y, radius * 1.3 + 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 + 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 * 1.3, 0, Math.PI * 2, true)
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREY + ', ' + 1 + ')'
|
||||
browserCanvasContext.fill()
|
||||
}
|
||||
browserCanvasContext.beginPath()
|
||||
browserCanvasContext.arc(position.x, position.y, radius, 0, Math.PI * 2, true)
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREY + ', ' + 1 + ')'
|
||||
browserCanvasContext.fill()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,42 +785,61 @@ function newConditionEditor () {
|
||||
}
|
||||
|
||||
function childrenDrawForeground () {
|
||||
if (operatorA.dataMinePicker !== undefined) {
|
||||
operatorA.dataMinePicker.drawForeground()
|
||||
operatorDrawForeground(operatorA)
|
||||
operatorDrawForeground(operatorB)
|
||||
|
||||
if (operationPicker !== undefined) {
|
||||
operationPicker.drawForeground()
|
||||
}
|
||||
}
|
||||
|
||||
function operatorDrawForeground (operator) {
|
||||
if (operator === undefined) { return }
|
||||
|
||||
if (operator.whenPicker !== undefined) {
|
||||
if (operator.whenPicker.visible === true) {
|
||||
operator.whenPicker.drawForeground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.dataMinePicker !== undefined) {
|
||||
if (operator.dataMinePicker.visible === true) {
|
||||
operator.dataMinePicker.drawForeground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.botPicker !== undefined) {
|
||||
if (operator.botPicker.visible === true) {
|
||||
operator.botPicker.drawForeground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.productPicker !== undefined) {
|
||||
if (operator.productPicker.visible === true) {
|
||||
operator.productPicker.drawForeground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.propertyPicker !== undefined) {
|
||||
if (operator.propertyPicker.visible === true) {
|
||||
operator.propertyPicker.drawForeground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.valuePicker !== undefined) {
|
||||
if (operator.valuePicker.visible === true) {
|
||||
operator.valuePicker.drawForeground()
|
||||
}
|
||||
}
|
||||
|
||||
if (operator.timeFramePicker !== undefined) {
|
||||
if (operator.timeFramePicker.visible === true) {
|
||||
operator.timeFramePicker.drawForeground()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function thisObjectDrawForeground () {
|
||||
let iconPosition = {
|
||||
x: 0,
|
||||
y: thisObject.currentRadius * 1
|
||||
}
|
||||
|
||||
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 (label !== undefined && 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ function newPicker () {
|
||||
let thisObject = {
|
||||
container: undefined,
|
||||
selectedItem: 0,
|
||||
onParentChanged: onParentChanged,
|
||||
getSelected: getSelected,
|
||||
setSelected: setSelected,
|
||||
physics: physics,
|
||||
drawBackground: drawBackground,
|
||||
drawForeground: drawForeground,
|
||||
@@ -17,23 +20,93 @@ function newPicker () {
|
||||
thisObject.container.initialize(MODULE_NAME)
|
||||
thisObject.container.isClickeable = false
|
||||
thisObject.container.isDraggeable = false
|
||||
thisObject.container.isWheelable = true
|
||||
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
|
||||
thisObject.container.frame.width = 250
|
||||
thisObject.container.frame.height = 120
|
||||
|
||||
let optionsList
|
||||
let parent
|
||||
let current
|
||||
let parentSelected = 0
|
||||
let propertyName
|
||||
let selected = 0
|
||||
let lastSelected = 0
|
||||
let onMouseWheelEventSubscriptionId
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
thisObject.container.eventHandler.stopListening(onMouseWheelEventSubscriptionId)
|
||||
thisObject.container.finalize()
|
||||
thisObject.container = undefined
|
||||
optionsList = undefined
|
||||
parent = undefined
|
||||
current = undefined
|
||||
}
|
||||
|
||||
function initialize (pOptionsList) {
|
||||
function initialize (pOptionsList, pCurrent, pParent, pPropertyName) {
|
||||
optionsList = pOptionsList
|
||||
current = pCurrent
|
||||
parent = pParent
|
||||
propertyName = pPropertyName
|
||||
onMouseWheelEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
|
||||
}
|
||||
|
||||
function getSelected () {
|
||||
return optionsList[selected]
|
||||
}
|
||||
|
||||
function setSelected (pOptionsList, pCurrent, pParent, pSelected) {
|
||||
if (pOptionsList !== undefined) {
|
||||
optionsList = pOptionsList
|
||||
}
|
||||
if (pCurrent !== undefined) {
|
||||
current = pCurrent
|
||||
}
|
||||
if (pParent !== undefined) {
|
||||
parent = pParent
|
||||
}
|
||||
if (pSelected !== undefined) {
|
||||
selected = pSelected
|
||||
}
|
||||
raiseEventParentChanged()
|
||||
}
|
||||
|
||||
function onParentChanged (event) {
|
||||
if (event.parent !== undefined) {
|
||||
parent = event.parent
|
||||
}
|
||||
parentSelected = event.selected
|
||||
|
||||
selected = 0
|
||||
let parentKeys
|
||||
|
||||
parentKeys = Object.keys(parent)
|
||||
checkPropertyName()
|
||||
|
||||
function checkPropertyName () {
|
||||
if (propertyName === undefined) {
|
||||
current = parent[parentKeys[parentSelected]]
|
||||
checkArray()
|
||||
} else {
|
||||
current = parent[parentKeys[parentSelected]]
|
||||
current = current[propertyName]
|
||||
checkArray()
|
||||
}
|
||||
}
|
||||
|
||||
function checkArray () {
|
||||
if (Array.isArray(current) === false) {
|
||||
optionsList = Object.keys(current)
|
||||
} else {
|
||||
optionsList = current
|
||||
}
|
||||
}
|
||||
|
||||
raiseEventParentChanged()
|
||||
}
|
||||
|
||||
function getContainer (point) {
|
||||
@@ -44,6 +117,39 @@ function newPicker () {
|
||||
}
|
||||
}
|
||||
|
||||
function getSelected () {
|
||||
return optionsList[selected]
|
||||
}
|
||||
|
||||
function onMouseWheel () {
|
||||
delta = event.wheelDelta
|
||||
if (delta > 0) {
|
||||
delta = -1
|
||||
} else {
|
||||
delta = 1
|
||||
}
|
||||
|
||||
selected = selected + delta
|
||||
if (selected < 0) { selected = 0 }
|
||||
if (selected > optionsList.length - 1) {
|
||||
selected = optionsList.length - 1
|
||||
}
|
||||
|
||||
if (selected !== lastSelected) {
|
||||
lastSelected = selected
|
||||
raiseEventParentChanged()
|
||||
}
|
||||
}
|
||||
|
||||
function raiseEventParentChanged () {
|
||||
let event = {
|
||||
selected: selected,
|
||||
parent: current,
|
||||
propertyName: propertyName
|
||||
}
|
||||
thisObject.container.eventHandler.raiseEvent('onParentChanged', event)
|
||||
}
|
||||
|
||||
function physics () {
|
||||
|
||||
}
|
||||
@@ -53,10 +159,43 @@ function newPicker () {
|
||||
}
|
||||
|
||||
function drawForeground () {
|
||||
const FONT_SIZE = 15
|
||||
const FONT_SIZE = 22
|
||||
const VISIBLE_LABELS = 5
|
||||
let fontSize
|
||||
let fontColor
|
||||
let opacity
|
||||
|
||||
for (let i = 0; i < optionsList.length; i++) {
|
||||
drawLabel(optionsList[i], 1 / 2, i / optionsList.length, 0, 0, FONT_SIZE, thisObject.container, UI_COLOR.WHITE, undefined, undefined)
|
||||
for (let i = 0; i < VISIBLE_LABELS; i++) {
|
||||
let index = i - 2 + selected
|
||||
let label = ''
|
||||
if (index >= 0 && index < optionsList.length) {
|
||||
label = optionsList[index]
|
||||
}
|
||||
fontColor = UI_COLOR.LIGHT_GREY
|
||||
switch (i) {
|
||||
case 0:
|
||||
fontSize = FONT_SIZE - 12
|
||||
opacity = 0.4
|
||||
break
|
||||
case 1:
|
||||
fontSize = FONT_SIZE - 8
|
||||
opacity = 0.5
|
||||
break
|
||||
case 2:
|
||||
fontSize = FONT_SIZE - 0
|
||||
fontColor = UI_COLOR.BLACK
|
||||
opacity = 1
|
||||
break
|
||||
case 3:
|
||||
fontSize = FONT_SIZE - 8
|
||||
opacity = 0.5
|
||||
break
|
||||
case 4:
|
||||
fontSize = FONT_SIZE - 12
|
||||
opacity = 0.4
|
||||
break
|
||||
}
|
||||
drawLabel(label, 1 / 2, i / VISIBLE_LABELS, 0, 0, fontSize, thisObject.container, fontColor, undefined, undefined, opacity)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ function newUiObject () {
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
if (thisObject.container.frame.isThisPointHere(point, true, true) === true) {
|
||||
return thisObject.container
|
||||
} else {
|
||||
return undefined
|
||||
|
||||
@@ -412,26 +412,26 @@ function newUiObjectConstructor () {
|
||||
if (nodeDefinition.editors.config === true) {
|
||||
uiObject.configEditor = newConfigEditor()
|
||||
uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction
|
||||
uiObject.configEditor.initialize()
|
||||
uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false)
|
||||
uiObject.configEditor.initialize()
|
||||
}
|
||||
if (nodeDefinition.editors.code === true) {
|
||||
uiObject.codeEditor = newCodeEditor()
|
||||
uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction
|
||||
uiObject.codeEditor.initialize()
|
||||
uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false)
|
||||
uiObject.codeEditor.initialize()
|
||||
}
|
||||
if (nodeDefinition.editors.formula === true) {
|
||||
uiObject.formulaEditor = newFormulaEditor()
|
||||
uiObject.formulaEditor.isVisibleFunction = uiObject.isVisibleFunction
|
||||
uiObject.formulaEditor.initialize()
|
||||
uiObject.formulaEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false)
|
||||
uiObject.formulaEditor.initialize()
|
||||
}
|
||||
if (nodeDefinition.editors.condition === true) {
|
||||
uiObject.conditionEditor = newConditionEditor()
|
||||
uiObject.conditionEditor.isVisibleFunction = uiObject.isVisibleFunction
|
||||
uiObject.conditionEditor.container.connectToParent(uiObject.container, false, false, false, true, false, false, false, false)
|
||||
uiObject.conditionEditor.initialize()
|
||||
uiObject.conditionEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false)
|
||||
}
|
||||
}
|
||||
if (nodeDefinition.addLeftIcons === true) {
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ function newFrame () {
|
||||
/* Now we check if the resulting point is whin the current Frame. */
|
||||
if (isNaN(checkPoint.x) || isNaN(checkPoint.y)) { return false }
|
||||
if (thisObject.type === 'Circle') {
|
||||
let distance = Math.sqrt(Math.pow(thisObject.position.x - point.x, 2) + Math.pow(thisObject.position.y - point.y, 2))
|
||||
let distance = Math.sqrt(Math.pow(thisObject.position.x - checkPoint.x, 2) + Math.pow(thisObject.position.y - checkPoint.y, 2))
|
||||
|
||||
if (distance < thisObject.radius) {
|
||||
return true
|
||||
|
||||
@@ -122,7 +122,7 @@ function newSplashScreen () {
|
||||
|
||||
fontSize = 35
|
||||
|
||||
title = 'Beta'
|
||||
title = 'Beta 4'
|
||||
|
||||
titlePoint = {
|
||||
x: thisObject.container.frame.width / 2 - title.length / 2 * fontSize * FONT_ASPECT_RATIO - 20,
|
||||
|
||||
@@ -105,10 +105,11 @@ function roundedCornersBackground (params) {
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
function drawLabel (label, xFactor, yFactor, xOffset, yOffset, fontSize, container, fontColor, noFrameX, noFrameY) {
|
||||
function drawLabel (label, xFactor, yFactor, xOffset, yOffset, fontSize, container, fontColor, noFrameX, noFrameY, opacity) {
|
||||
if (label === undefined) { return }
|
||||
if (fontColor === undefined) { fontColor = UI_COLOR.WHITE }
|
||||
let fontOffset = label.length * fontSize * FONT_ASPECT_RATIO + 10
|
||||
if (opacity === undefined) { opacity = 1 }
|
||||
|
||||
let labelPoint = {
|
||||
x: container.frame.width * xFactor + xOffset - fontOffset / 2,
|
||||
@@ -126,7 +127,7 @@ function drawLabel (label, xFactor, yFactor, xOffset, yOffset, fontSize, contain
|
||||
}
|
||||
|
||||
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
|
||||
browserCanvasContext.fillStyle = 'rgba(' + fontColor + ', 1)'
|
||||
browserCanvasContext.fillStyle = 'rgba(' + fontColor + ', ' + opacity + ')'
|
||||
|
||||
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"type":"Data Mine","name":"Masters","code":"{\n\"codeName\": \"Masters\"\n}","sensorBots":[{"type":"Sensor Bot","name":"Exchange Raw Data","code":"{\n\"codeName\": \"Exchange-Raw-Data\",\n\"repo\": \"Exchange-Raw-Data-Sensor-Bot\"\n}","processes":[{"type":"Process Definition","name":"Historic-Trades","code":"{\n \"codeName\": \"Historic-Trades\",\n \"description\": \"Retrieves and saves the historical trades in batches going backwards from the current time until reaching the begining of the market.\",\n \"startMode\": {\n \"noTime\": {\n \"run\": \"true\"\n },\n \"fixedInterval\": {\n \"run\": \"false\",\n \"interval\": 0\n }\n },\n \"deadWaitTime\": 0,\n \"normalWaitTime\": 60000,\n \"retryWaitTime\": 10000\n}","processOutput":{"type":"Process Output","name":"New Process Output","outputDatasets":[],"id":"e3008f15-43ae-4452-9c28-bfbb6c1a5e84","savedPayload":{"position":{"x":13889.892304785908,"y":17976.7326423862},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"processDependencies":{"type":"Process Dependencies","name":"New Process Dependencies","statusDependencies":[{"type":"Status Dependency","name":"Self Reference","code":"{\n \"mainUtility\": \"Self Reference\"\n}","id":"f796022a-7871-4bde-bcc7-bcf2818f1eaf","savedPayload":{"position":{"x":14299.325525762739,"y":17993.12379366583},"targetPosition":{"x":13938.17907937083,"y":17993.12379366583},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":1,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Status Report","name":"New Status Report","id":"116834de-6646-4387-9f4b-4f711cea9235"}}}],"dataDependencies":[],"id":"1332b41e-7cd2-4e69-a40a-39ea47df67b5","savedPayload":{"position":{"x":13938.17907937083,"y":17993.12379366583},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"statusReport":{"type":"Status Report","name":"New Status Report","id":"116834de-6646-4387-9f4b-4f711cea9235","savedPayload":{"position":{"x":13983.913279342734,"y":18015.677405195172},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionStartedEvent":{"type":"Execution Started Event","name":"New Execution Started Event","id":"a9ea7169-fcd8-48c3-b0a9-b4e8941aa170","savedPayload":{"position":{"x":14026.312379860185,"y":18044.00757842793},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionFinishedEvent":{"type":"Execution Finished Event","name":"New Execution Finished Event","id":"51908884-c7a2-46ca-8a55-209070ae5fa6","savedPayload":{"position":{"x":14064.650920558077,"y":18077.62957624547},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"id":"7a6a9399-474f-4a93-bcbd-28a594ef1943","savedPayload":{"position":{"x":14351.93363503598,"y":18425.400341491753},"targetPosition":{"x":13888.04337325749,"y":18696.024787447222},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":3,"distanceToParent":2,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Process Definition","name":"Historic-OHLCVs","code":"{\n \"codeName\": \"Historic-OHLCVs\",\n \"description\": \"Retrieves and saves historical maket data\",\n \"startMode\": {\n \"noTime\": {\n \"run\": \"true\"\n },\n \"fixedInterval\": {\n \"run\": \"false\",\n \"interval\": 0\n }\n },\n \"deadWaitTime\": 0,\n \"normalWaitTime\": 60000,\n \"retryWaitTime\": 10000\n}","processOutput":{"type":"Process Output","name":"New Process Output","outputDatasets":[],"id":"dfe2556e-a765-4e38-9d30-7f91090c0069","savedPayload":{"position":{"x":14546.018334597831,"y":18039.39680205973},"targetPosition":{"x":14407.127481538195,"y":18558.43550715096},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"processDependencies":{"type":"Process Dependencies","name":"New Process Dependencies","statusDependencies":[{"type":"Status Dependency","name":"Exchange Raw Data Historic-OHLCVs","code":"{\n \"mainUtility\": \"Self ReferencLine truncated
|
||||
{"type":"Data Mine","name":"Masters","code":"{\n\"codeName\": \"Masters\"\n}","sensorBots":[{"type":"Sensor Bot","name":"Exchange Raw Data","code":"{\n\"codeName\": \"Exchange-Raw-Data\",\n\"repo\": \"Exchange-Raw-Data-Sensor-Bot\"\n}","processes":[{"type":"Process Definition","name":"Historic-Trades","code":"{\n \"codeName\": \"Historic-Trades\",\n \"description\": \"Retrieves and saves the historical trades in batches going backwards from the current time until reaching the begining of the market.\",\n \"startMode\": {\n \"noTime\": {\n \"run\": \"true\"\n },\n \"fixedInterval\": {\n \"run\": \"false\",\n \"interval\": 0\n }\n },\n \"deadWaitTime\": 0,\n \"normalWaitTime\": 60000,\n \"retryWaitTime\": 10000\n}","processOutput":{"type":"Process Output","name":"New Process Output","outputDatasets":[],"id":"e3008f15-43ae-4452-9c28-bfbb6c1a5e84","savedPayload":{"position":{"x":13889.892304785908,"y":17976.7326423862},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"processDependencies":{"type":"Process Dependencies","name":"New Process Dependencies","statusDependencies":[{"type":"Status Dependency","name":"Self Reference","code":"{\n \"mainUtility\": \"Self Reference\"\n}","id":"f796022a-7871-4bde-bcc7-bcf2818f1eaf","savedPayload":{"position":{"x":14299.325525762739,"y":17993.12379366583},"targetPosition":{"x":13938.17907937083,"y":17993.12379366583},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":1,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Status Report","name":"New Status Report","id":"116834de-6646-4387-9f4b-4f711cea9235"}}}],"dataDependencies":[],"id":"1332b41e-7cd2-4e69-a40a-39ea47df67b5","savedPayload":{"position":{"x":13938.17907937083,"y":17993.12379366583},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"statusReport":{"type":"Status Report","name":"New Status Report","id":"116834de-6646-4387-9f4b-4f711cea9235","savedPayload":{"position":{"x":13983.913279342734,"y":18015.677405195172},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionStartedEvent":{"type":"Execution Started Event","name":"New Execution Started Event","id":"a9ea7169-fcd8-48c3-b0a9-b4e8941aa170","savedPayload":{"position":{"x":14026.312379860185,"y":18044.00757842793},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionFinishedEvent":{"type":"Execution Finished Event","name":"New Execution Finished Event","id":"51908884-c7a2-46ca-8a55-209070ae5fa6","savedPayload":{"position":{"x":14064.650920558077,"y":18077.62957624547},"targetPosition":{"x":13788.99537092664,"y":18353.285125876908},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":4,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"id":"7a6a9399-474f-4a93-bcbd-28a594ef1943","savedPayload":{"position":{"x":14351.93363503598,"y":18425.400341491753},"targetPosition":{"x":13888.04337325749,"y":18696.024787447222},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":3,"distanceToParent":2,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Process Definition","name":"Historic-OHLCVs","code":"{\n \"codeName\": \"Historic-OHLCVs\",\n \"description\": \"Retrieves and saves historical maket data\",\n \"startMode\": {\n \"noTime\": {\n \"run\": \"true\"\n },\n \"fixedInterval\": {\n \"run\": \"false\",\n \"interval\": 0\n }\n },\n \"deadWaitTime\": 0,\n \"normalWaitTime\": 60000,\n \"retryWaitTime\": 10000\n}","processOutput":{"type":"Process Output","name":"New Process Output","outputDatasets":[],"id":"dfe2556e-a765-4e38-9d30-7f91090c0069","savedPayload":{"position":{"x":14546.018334597831,"y":18039.39680205973},"targetPosition":{"x":14407.127481538195,"y":18558.43550715096},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"processDependencies":{"type":"Process Dependencies","name":"New Process Dependencies","statusDependencies":[{"type":"Status Dependency","name":"Exchange Raw Data Historic-OHLCVs","code":"{\n \"mainUtility\": \"Self ReferencLine truncated
|
||||
Reference in new issue
Block a user