Algebraic

This commit is contained in:
Luis Fernando Molina committed 2020-04-30 19:59:46 +02:00
1 parent b024d110d7
commit 7f33925786
2 files changed
+58 -12

No files matched your search

+52 -6
View File
@@ -364,16 +364,25 @@ function newConditionEditor () {
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.x = 0 - operator.whenPicker.container.frame.width / 2 - operator.whenPicker.container.frame.width * 1.0
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.algebraicPicker = newPicker()
operator.algebraicPicker.name = 'Algebraic'
operator.algebraicPicker.container.connectToParent(thisObject.container)
operator.algebraicPicker.container.frame.position.x = 0 - operator.algebraicPicker.container.frame.width / 2 + operator.algebraicPicker.container.frame.width * 3.0
operator.algebraicPicker.container.frame.position.y = 0 - operator.algebraicPicker.container.frame.height / 2 + operator.algebraicPicker.container.frame.height * ySign
current = ['+ - * /', 'Plus', 'Minus', 'Times', 'Divided by']
operator.algebraicPicker.initialize(current, current)
operator.algebraicPicker.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.x = 0 - operator.dataMinePicker.container.frame.width / 2 - operator.dataMinePicker.container.frame.width * 3.0
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)
@@ -384,7 +393,7 @@ function newConditionEditor () {
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.x = 0 - operator.botPicker.container.frame.width / 2 - operator.botPicker.container.frame.width * 2.0
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)
@@ -395,7 +404,7 @@ function newConditionEditor () {
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.x = 0 - operator.productPicker.container.frame.width / 2 + operator.productPicker.container.frame.width * 0.0
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)
@@ -409,7 +418,7 @@ function newConditionEditor () {
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.x = 0 - operator.propertyPicker.container.frame.width / 2 + operator.propertyPicker.container.frame.width * 1.0
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
@@ -432,7 +441,7 @@ function newConditionEditor () {
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.x = 0 - operator.timeFramePicker.container.frame.width / 2 + operator.timeFramePicker.container.frame.width * 2.0
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
@@ -469,6 +478,11 @@ function newConditionEditor () {
operator.whenPicker = undefined
}
if (operator.algebraicPicker !== undefined) {
operator.algebraicPicker.finalize()
operator.algebraicPicker = undefined
}
if (operator.dataMinePicker !== undefined) {
operator.dataMinePicker.container.eventHandler.stopListening(operator.botPicker.eventSuscriptionId)
operator.dataMinePicker.finalize()
@@ -511,6 +525,7 @@ function newConditionEditor () {
operatorA.valuePicker.visible = true
operatorB.whenPicker.visible = false
operatorB.algebraicPicker.visible = false
operatorB.dataMinePicker.visible = false
operatorB.botPicker.visible = false
operatorB.productPicker.visible = false
@@ -519,6 +534,7 @@ function newConditionEditor () {
} else {
operatorA.valuePicker.visible = false
operatorB.whenPicker.visible = true
operatorB.algebraicPicker.visible = true
operatorB.dataMinePicker.visible = true
operatorB.botPicker.visible = true
operatorB.productPicker.visible = true
@@ -543,6 +559,13 @@ function newConditionEditor () {
}
}
if (operatorA.algebraicPicker !== undefined) {
if (operatorA.algebraicPicker.visible === true) {
container = operatorA.algebraicPicker.getContainer(point)
if (container !== undefined) { return container }
}
}
if (operatorA.dataMinePicker !== undefined) {
if (operatorA.dataMinePicker.visible === true) {
container = operatorA.dataMinePicker.getContainer(point)
@@ -593,6 +616,13 @@ function newConditionEditor () {
}
}
if (operatorB.algebraicPicker !== undefined) {
if (operatorB.algebraicPicker.visible === true) {
container = operatorB.algebraicPicker.getContainer(point)
if (container !== undefined) { return container }
}
}
if (operatorB.dataMinePicker !== undefined) {
if (operatorB.dataMinePicker.visible === true) {
container = operatorB.dataMinePicker.getContainer(point)
@@ -665,6 +695,10 @@ function newConditionEditor () {
operator.whenPicker.physics()
}
if (operator.algebraicPicker !== undefined) {
operator.algebraicPicker.physics()
}
if (operator.dataMinePicker !== undefined) {
operator.dataMinePicker.physics()
}
@@ -717,6 +751,12 @@ function newConditionEditor () {
}
}
if (operator.algebraicPicker !== undefined) {
if (operator.algebraicPicker.visible === true) {
operator.algebraicPicker.drawBackground()
}
}
if (operator.dataMinePicker !== undefined) {
if (operator.dataMinePicker.visible === true) {
operator.dataMinePicker.drawBackground()
@@ -802,6 +842,12 @@ function newConditionEditor () {
}
}
if (operator.algebraicPicker !== undefined) {
if (operator.algebraicPicker.visible === true) {
operator.algebraicPicker.drawForeground()
}
}
if (operator.dataMinePicker !== undefined) {
if (operator.dataMinePicker.visible === true) {
operator.dataMinePicker.drawForeground()
+6 -6
View File
@@ -25,7 +25,7 @@ function newPicker () {
thisObject.container.frame.radius = 0
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
thisObject.container.frame.width = 250
thisObject.container.frame.width = 200
thisObject.container.frame.height = 120
let isMouseOver
@@ -175,7 +175,7 @@ function newPicker () {
}
function drawForeground () {
const FONT_SIZE = 22
const FONT_SIZE = 20
const VISIBLE_LABELS = 5
let fontSize
let fontColor
@@ -190,11 +190,11 @@ function newPicker () {
fontColor = UI_COLOR.LIGHT_GREY
switch (i) {
case 0:
fontSize = FONT_SIZE - 12
fontSize = FONT_SIZE - 10
opacity = 0.4
break
case 1:
fontSize = FONT_SIZE - 8
fontSize = FONT_SIZE - 5
opacity = 0.5
break
case 2:
@@ -203,11 +203,11 @@ function newPicker () {
opacity = 1
break
case 3:
fontSize = FONT_SIZE - 8
fontSize = FONT_SIZE - 5
opacity = 0.5
break
case 4:
fontSize = FONT_SIZE - 12
fontSize = FONT_SIZE - 10
opacity = 0.4
break
}