Fucking working finally

This commit is contained in:
Luis Fernando Molina committed 2020-04-28 18:04:34 +02:00
1 parent d0ffb72fcc
commit 431e063326
2 files changed
+90 -25

No files matched your search

+53 -10
View File
@@ -148,45 +148,60 @@ function newConditionEditor () {
let current
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 * 1.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)
operator.dataMinePicker.initialize(properties, current)
parent = current
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 * 0.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, parent)
operator.botPicker.initialize(properties, current, parent)
parent = current
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, parent)
operator.productPicker.initialize(properties, current, parent)
parent = current
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 = parent[properties[0]]
current = current.properties
properties = Object.keys(current)
operator.propertyPicker.initialize(properties, parent, 'properties')
operator.propertyPicker.initialize(properties, current, parent, 'properties')
parent = current
operator.dataMinePicker.eventSuscriptionId = operator.dataMinePicker.container.eventHandler.listenToEvent('onParentChanged', operator.botPicker.onParentChanged)
operator.botPicker.eventSuscriptionId = operator.botPicker.container.eventHandler.listenToEvent('onParentChanged', operator.productPicker.onParentChanged)
operator.productPicker.eventSuscriptionId = operator.productPicker.container.eventHandler.listenToEvent('onParentChanged', operator.propertyPicker.onParentChanged)
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.width * 2.5
operator.valuePicker.container.frame.position.y = 0 - operator.valuePicker.container.frame.height / 2 + operator.valuePicker.container.frame.height * ySign
current = parent[properties[0]]
properties = current.possibleValues
operator.valuePicker.initialize(properties, current, parent, 'possibleValues')
parent = current
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)
}
function finalizePickers () {
@@ -196,19 +211,20 @@ function newConditionEditor () {
function finalizeOperator (operator) {
if (operator.dataMinePicker !== undefined) {
operator.dataMinePicker.container.eventHandler.stopListening(operator.dataMinePicker.eventSuscriptionId)
operator.dataMinePicker.container.eventHandler.stopListening(operator.botPicker.eventSuscriptionId)
operator.dataMinePicker.finalize()
operator.dataMinePicker = undefined
}
if (operator.botPicker !== undefined) {
operator.botPicker.container.eventHandler.stopListening(operator.botPicker.eventSuscriptionId)
operator.botPicker.container.eventHandler.stopListening(operator.productPicker.eventSuscriptionId)
operator.botPicker.finalize()
operator.botPicker = undefined
}
if (operator.productPicker !== undefined) {
operator.productPicker.container.eventHandler.stopListening(operator.productPicker.eventSuscriptionId)
operator.productPicker.container.eventHandler.stopListening(operator.propertyPicker.eventSuscriptionId)
operator.productPicker.container.eventHandler.stopListening(operator.valuePicker.eventSuscriptionId)
operator.productPicker.finalize()
operator.productPicker = undefined
}
@@ -217,6 +233,11 @@ function newConditionEditor () {
operator.propertyPicker.finalize()
operator.propertyPicker = undefined
}
if (operator.valuePicker !== undefined) {
operator.valuePicker.finalize()
operator.valuePicker = undefined
}
}
function getContainer (point) {
@@ -242,6 +263,11 @@ function newConditionEditor () {
if (container !== undefined) { return container }
}
if (operatorA.valuePicker !== undefined) {
container = operatorA.valuePicker.getContainer(point)
if (container !== undefined) { return container }
}
if (operatorB.dataMinePicker !== undefined) {
container = operatorB.dataMinePicker.getContainer(point)
if (container !== undefined) { return container }
@@ -262,6 +288,11 @@ function newConditionEditor () {
if (container !== undefined) { return container }
}
if (operatorB.valuePicker !== undefined) {
container = operatorB.valuePicker.getContainer(point)
if (container !== undefined) { return container }
}
if (thisObject.container.frame.isThisPointHere(point, true, false) === true) {
return thisObject.container
} else {
@@ -296,6 +327,10 @@ function newConditionEditor () {
if (operator.propertyPicker !== undefined) {
operator.propertyPicker.physics()
}
if (operator.valuePicker !== undefined) {
operator.valuePicker.physics()
}
}
function thisObjectphysics () {
@@ -340,6 +375,10 @@ function newConditionEditor () {
if (operator.propertyPicker !== undefined) {
operator.propertyPicker.drawBackground()
}
if (operator.valuePicker !== undefined) {
operator.valuePicker.drawBackground()
}
}
function thisObjectDrawBackground () {
@@ -395,6 +434,10 @@ function newConditionEditor () {
if (operator.propertyPicker !== undefined) {
operator.propertyPicker.drawForeground()
}
if (operator.valuePicker !== undefined) {
operator.valuePicker.drawForeground()
}
}
function thisObjectDrawForeground () {
+37 -15
View File
@@ -28,6 +28,8 @@ function newPicker () {
let optionsList
let parent
let current
let parentSelected = 0
let propertyName
let selected = 0
let lastSelected = 0
@@ -41,10 +43,12 @@ function newPicker () {
thisObject.container = undefined
optionsList = undefined
parent = undefined
current = undefined
}
function initialize (pOptionsList, pParent, pPropertyName) {
function initialize (pOptionsList, pCurrent, pParent, pPropertyName) {
optionsList = pOptionsList
current = pCurrent
parent = pParent
propertyName = pPropertyName
onMouseWheelEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
@@ -54,22 +58,34 @@ function newPicker () {
if (event.parent !== undefined) {
parent = event.parent
}
parentSelected = event.selected
selected = 0
let parentKeys = Object.keys(parent)
let parentKeys
if (propertyName !== undefined) {
optionsList = parent[parentKeys[event.selected]]
optionsList = Object.keys(optionsList[propertyName])
} else {
optionsList = Object.keys(parent[parentKeys[event.selected]])
parentKeys = Object.keys(parent)
checkPropertyName()
function checkPropertyName () {
if (propertyName === undefined) {
current = parent[parentKeys[parentSelected]]
checkArray()
} else {
current = parent[parentKeys[parentSelected]]
current = current[propertyName]
checkArray()
}
}
event = {
selected: selected,
parent: parent[parentKeys[event.selected]]
function checkArray () {
if (Array.isArray(current) === false) {
optionsList = Object.keys(current)
} else {
optionsList = current
}
}
thisObject.container.eventHandler.raiseEvent('onParentChanged', event)
raiseEventParentChanged()
}
function getContainer (point) {
@@ -99,14 +115,20 @@ function newPicker () {
}
if (selected !== lastSelected) {
let event = {
selected: selected
}
thisObject.container.eventHandler.raiseEvent('onParentChanged', event)
lastSelected = selected
raiseEventParentChanged()
}
}
function raiseEventParentChanged () {
let event = {
selected: selected,
parent: current,
propertyName: propertyName
}
thisObject.container.eventHandler.raiseEvent('onParentChanged', event)
}
function physics () {
}