Menu Item Ready to get the icons dinamically
This commit is contained in:
1 parent
4f469bc28f
commit
f045312dcb
3 files changed
+23
-9
No files matched your search
@@ -64,6 +64,7 @@ function newCircularMenu () {
|
||||
menuItem.currentRadius = menuItemInitialValue.currentRadius
|
||||
menuItem.angle = menuItemInitialValue.angle
|
||||
menuItem.currentStatus = menuItemInitialValue.currentStatus
|
||||
menuItem.relatedStrategyPart = menuItemInitialValue.relatedStrategyPart
|
||||
|
||||
if (menuItem.label === undefined) {
|
||||
menuItem.type = 'Icon Only'
|
||||
|
||||
@@ -23,6 +23,7 @@ function newCircularMenuItem () {
|
||||
angle: undefined,
|
||||
container: undefined,
|
||||
payload: undefined,
|
||||
relatedStrategyPart: undefined,
|
||||
physics: physics,
|
||||
drawBackground: drawBackground,
|
||||
drawForeground: drawForeground,
|
||||
@@ -72,16 +73,8 @@ function newCircularMenuItem () {
|
||||
|
||||
function initialize (pPayload) {
|
||||
thisObject.payload = pPayload
|
||||
/* Load Menu Images */
|
||||
|
||||
thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.iconPathOn)
|
||||
thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.iconPathOff)
|
||||
|
||||
if (thisObject.currentStatus === true) {
|
||||
thisObject.icon = thisObject.iconOn
|
||||
} else {
|
||||
thisObject.icon = thisObject.iconOff
|
||||
}
|
||||
iconPhysics()
|
||||
|
||||
selfMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
|
||||
selfMouseClickEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
|
||||
@@ -130,6 +123,18 @@ function newCircularMenuItem () {
|
||||
backgroundColorToUse = defaultBackgroudColor
|
||||
}
|
||||
|
||||
iconPhysics()
|
||||
}
|
||||
|
||||
function iconPhysics () {
|
||||
if (thisObject.relatedStrategyPart !== undefined) {
|
||||
thisObject.iconOn = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart)
|
||||
thisObject.iconOff = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart)
|
||||
} else {
|
||||
thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.iconPathOn)
|
||||
thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.iconPathOff)
|
||||
}
|
||||
|
||||
/* Current Status sets the icon to be used */
|
||||
|
||||
if (thisObject.currentStatus === true) {
|
||||
|
||||
@@ -105,6 +105,7 @@ function newStrategyPartConstructor () {
|
||||
visible: false,
|
||||
iconPathOn: 'quality',
|
||||
iconPathOff: 'quality',
|
||||
relatedStrategyPart: 'Strategy',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
@@ -187,6 +188,7 @@ function newStrategyPartConstructor () {
|
||||
visible: false,
|
||||
iconPathOn: 'attractive',
|
||||
iconPathOff: 'attractive',
|
||||
relatedStrategyPart: 'Situation',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
@@ -216,6 +218,7 @@ function newStrategyPartConstructor () {
|
||||
visible: false,
|
||||
iconPathOn: 'attractive',
|
||||
iconPathOff: 'attractive',
|
||||
relatedStrategyPart: 'Situation',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
@@ -245,6 +248,7 @@ function newStrategyPartConstructor () {
|
||||
visible: false,
|
||||
iconPathOn: 'attractive',
|
||||
iconPathOff: 'attractive',
|
||||
relatedStrategyPart: 'Situation',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
@@ -274,6 +278,7 @@ function newStrategyPartConstructor () {
|
||||
visible: false,
|
||||
iconPathOn: 'placeholder',
|
||||
iconPathOff: 'placeholder',
|
||||
relatedStrategyPart: 'Phase',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
@@ -303,6 +308,7 @@ function newStrategyPartConstructor () {
|
||||
visible: false,
|
||||
iconPathOn: 'placeholder',
|
||||
iconPathOff: 'placeholder',
|
||||
relatedStrategyPart: 'Phase',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
@@ -349,6 +355,7 @@ function newStrategyPartConstructor () {
|
||||
visible: false,
|
||||
iconPathOn: 'attractive',
|
||||
iconPathOff: 'attractive',
|
||||
relatedStrategyPart: 'Situation',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
@@ -390,6 +397,7 @@ function newStrategyPartConstructor () {
|
||||
visible: false,
|
||||
iconPathOn: 'testing',
|
||||
iconPathOff: 'testing',
|
||||
relatedStrategyPart: 'Condition',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
|
||||
Reference in new issue
Block a user