All finalize functions implemented

This commit is contained in:
Luis Fernando Molina committed 2019-05-06 18:12:42 +02:00
1 parent cf3097d62e
commit 7a571383ec
9 files changed
+115 -216

No files matched your search

+22 -6
View File
@@ -9,6 +9,7 @@ function newCircularMenu () {
drawBackground: drawBackground,
drawForeground: drawForeground,
getContainer: getContainer,
finalize: finalize,
initialize: initialize
}
@@ -20,14 +21,29 @@ function newCircularMenu () {
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
let menuItemsInitialValues = []
let menuItems = []
let payload
let selfFocusEventSubscriptionId
let selfNotFocuskEventSubscriptionId
return thisObject
function initialize (menuItemsInitialValues, pPayload) {
payload = pPayload
function finalize () {
thisObject.container.eventHandler.stopListening(selfFocusEventSubscriptionId)
thisObject.container.eventHandler.stopListening(selfNotFocuskEventSubscriptionId)
thisObject.container.finalize()
thisObject.container = undefined
for (let i = 0; i < menuItems.length; i++) {
let menuItem = menuItems[i]
menuItem.finalize()
}
menuItems = undefined
}
function initialize (menuItemsInitialValues, payload) {
/* Create the array of Menu Items */
for (let i = 0; i < menuItemsInitialValues.length; i++) {
@@ -49,8 +65,8 @@ function newCircularMenu () {
menuItems.push(menuItem)
}
thisObject.container.eventHandler.listenToEvent('onFocus', onFocus)
thisObject.container.eventHandler.listenToEvent('onNotFocus', onNotFocus)
selfFocusEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onFocus', onFocus)
selfNotFocuskEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onNotFocus', onNotFocus)
}
function getContainer (point) {