Update CircularMenuItem.js

This commit is contained in:
Luis Fernando Molina committed 2021-10-06 12:37:00 +02:00
1 parent 540f18cd69
commit 2905730db6
1 file changed
+15 -1
@@ -39,6 +39,7 @@ function newCircularMenuItem() {
container: undefined,
payload: undefined,
relatedUiObject: undefined,
relatedUiObjectProject: undefined,
dontShowAtFullscreen: undefined,
isEnabled: true,
shorcutNumber: undefined,
@@ -267,12 +268,22 @@ function newCircularMenuItem() {
thisObject.iconOn = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName('Foundations', thisObject.secondaryIcon)
thisObject.iconOff = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName('Foundations', thisObject.secondaryIcon)
} else {
/*
TODO : This code needs to be cleaned and reorganized. It is not clear how a menu item icon is going to be selected.
*/
if (thisObject.relatedUiObject !== undefined && thisObject.iconProject !== undefined) {
thisObject.iconOn = UI.projects.foundations.spaces.designSpace.getIconByProjectAndType(thisObject.iconProject, thisObject.relatedUiObject)
thisObject.iconOff = UI.projects.foundations.spaces.designSpace.getIconByProjectAndType(thisObject.iconProject, thisObject.relatedUiObject)
} else if (thisObject.relatedUiObject !== undefined && thisObject.iconProject === undefined) {
if (thisObject.relatedUiObjectProject !== undefined) {
thisObject.iconOn = UI.projects.foundations.spaces.designSpace.getIconByProjectAndType(thisObject.relatedUiObjectProject, thisObject.relatedUiObject)
thisObject.iconOff = UI.projects.foundations.spaces.designSpace.getIconByProjectAndType(thisObject.relatedUiObjectProject, thisObject.relatedUiObject)
} else {
thisObject.iconOn = UI.projects.foundations.spaces.designSpace.getIconByProjectAndType(thisObject.payload.node.project, thisObject.relatedUiObject)
thisObject.iconOff = UI.projects.foundations.spaces.designSpace.getIconByProjectAndType(thisObject.payload.node.project, thisObject.relatedUiObject)
}
} else {
if (thisObject.iconPathOn !== undefined && thisObject.iconPathOff !== undefined && thisObject.iconProject !== undefined) {
thisObject.iconOn = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName(thisObject.iconProject, thisObject.iconPathOn)
@@ -491,8 +502,12 @@ function newCircularMenuItem() {
if (thisObject.icon === undefined) {
thisObject.icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName('Foundations', 'missing-image')
}
if (thisObject.icon !== undefined) {
if (thisObject.icon.canDrawIcon === true && thisObject.currentRadius > 1 && thisObject.isDeployed === true) {
browserCanvasContext.drawImage(thisObject.icon, menuPosition.x - iconSize, menuPosition.y - iconSize, iconSize * 2, iconSize * 2)
}
}
/* Menu Label */
if (thisObject.type === 'Icon & Text') {
@@ -519,4 +534,3 @@ function newCircularMenuItem() {
}
}
}
}