Tyding into a folder
This commit is contained in:
1 parent
2de41a3ae9
commit
c5a5b3365b
1 file changed
+1
-1
@@ -0,0 +1,55 @@
|
||||
function newUIControl () {
|
||||
let thisObject = {
|
||||
drawFunction: undefined,
|
||||
paramsArray: undefined,
|
||||
container: undefined,
|
||||
draw: draw,
|
||||
parentContainer: undefined,
|
||||
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
|
||||
initialize: initialize
|
||||
}
|
||||
|
||||
let isInitialized = false
|
||||
/* Cointainer stuff */
|
||||
|
||||
let container = newContainer()
|
||||
|
||||
container.name = 'UI Control'
|
||||
container.initialize()
|
||||
|
||||
container.isClickeable = true
|
||||
|
||||
thisObject.container = container
|
||||
thisObject.container.frame.containerName = 'Panel Tab Button'
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize () {
|
||||
isInitialized = true
|
||||
}
|
||||
|
||||
function draw () {
|
||||
if (isInitialized === false) { return }
|
||||
|
||||
if (thisObject.drawFunction !== undefined && thisObject.paramsArray !== undefined) {
|
||||
thisObject.drawFunction(thisObject.paramsArray)
|
||||
}
|
||||
}
|
||||
|
||||
function getContainer (point) {
|
||||
let container
|
||||
|
||||
/* First we check if thisObject point is inside thisObject space. */
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
/* Now we see which is the inner most container that has it */
|
||||
|
||||
return thisObject.container
|
||||
} else {
|
||||
/* This point does not belong to thisObject space. */
|
||||
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user