From 313f8c66da09a1b958cf9bc39db78a339b5f8ea4 Mon Sep 17 00:00:00 2001 From: Ada Date: Sun, 17 May 2026 07:28:39 +1000 Subject: [PATCH 1/5] Show visually when a context menu action is hovered --- scripts/communityScripts/contextMenu.js | 41 ++++++++++++++++++++----- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/scripts/communityScripts/contextMenu.js b/scripts/communityScripts/contextMenu.js index 7552b12dd64..c636d0c0e42 100644 --- a/scripts/communityScripts/contextMenu.js +++ b/scripts/communityScripts/contextMenu.js @@ -172,7 +172,7 @@ const targetingPick = [ ]; let currentMenuOpen = false; -let currentMenuEntities = new Set(); +let currentMenuEntities = new Map(); let currentMenuActionFuncs = []; let currentMenuTarget = Uuid.NONE; let currentMenuTargetIsAvatar = false; @@ -183,7 +183,9 @@ let disableCounter = 0; let prevClickTime = Date.now(); function ContextMenu_DeleteMenu() { - currentMenuEntities.forEach((_, e) => Entities.deleteEntity(e)); + for (const [e, _] of currentMenuEntities) { + Entities.deleteEntity(e); + } currentMenuEntities.clear(); currentMenuActionFuncs = []; currentMenuOpen = false; @@ -218,8 +220,10 @@ function ContextMenu_EntityClick(eid, event) { if (!(CONTEXT_MENU_SETTINGS.noSfx ?? false)) { Audio.playSystemSound(SOUND_CLICK); } } -function ContextMenu_EntityHover(eid, _event) { - if (!currentMenuEntities.has(eid)) { return; } +function ContextMenu_EntityHoverEnter(eid, _event) { + const entityAction = currentMenuEntities.get(eid); + + if (!entityAction) { return; } try { const data = JSON.parse(Entities.getEntityProperties(eid, "userData").userData); @@ -227,6 +231,24 @@ function ContextMenu_EntityHover(eid, _event) { if (!(CONTEXT_MENU_SETTINGS.noSfx ?? false)) { Audio.playSystemSound(SOUND_HOVER); } } } catch (e) {} + + Entities.editEntity(eid, { + textColor: entityAction.backgroundColor ?? [0, 0, 0], + backgroundColor: entityAction.textColor ?? [255, 255, 255], + textEffectColor: entityAction.textColor ?? [255, 255, 255], + }); +} + +function ContextMenu_EntityHoverLeave(eid, _event) { + const entityAction = currentMenuEntities.get(eid); + + if (!entityAction) { return; } + + Entities.editEntity(eid, { + backgroundColor: entityAction.backgroundColor ?? [0, 0, 0], + textEffectColor: entityAction.backgroundColor ?? [0, 0, 0], + textColor: entityAction.textColor ?? [255, 255, 255], + }); } function ContextMenu_FindTarget(hand = 1) { @@ -431,6 +453,7 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { }); actionEnts.push({ + action: hasPages && page > 0 ? {} : undefined, grab: {grabbable: false}, type: "Text", position: Vec3.sum(origin, Vec3.multiplyQbyV(angle, [-0.13 * scale, yPos, 0])), @@ -454,6 +477,7 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { }); actionEnts.push({ + action: hasPages && page < maxPages ? {} : undefined, grab: {grabbable: false}, type: "Text", position: Vec3.sum(origin, Vec3.multiplyQbyV(angle, [0.13 * scale, yPos, 0])), @@ -484,6 +508,7 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { let pos = Vec3.sum(origin, Vec3.multiplyQbyV(angle, [0, yPos, 0])); actionEnts.push({ + action, grab: {grabbable: false}, type: "Text", position: pos, @@ -586,7 +611,7 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { a.fadeOutMode = "disabled"; const e = Entities.addEntity(a, (CONTEXT_MENU_SETTINGS.public ?? false) ? "avatar" : "local"); - currentMenuEntities.add(e); + currentMenuEntities.set(e, a.action ?? null); } currentMenuOpen = true; @@ -804,7 +829,8 @@ Controller.inputEvent.connect(ContextMenu_ActionEvent); Controller.mousePressEvent.connect(ContextMenu_MousePressEvent); Controller.mouseReleaseEvent.connect(ContextMenu_MouseReleaseEvent); Entities.mousePressOnEntity.connect(ContextMenu_EntityClick); -Entities.hoverEnterEntity.connect(ContextMenu_EntityHover); +Entities.hoverEnterEntity.connect(ContextMenu_EntityHoverEnter); +Entities.hoverLeaveEntity.connect(ContextMenu_EntityHoverLeave); //Script.update.connect(ContextMenu_Update); for (const pick of targetingPick) { @@ -826,7 +852,8 @@ Script.scriptEnding.connect(() => { Controller.mousePressEvent.disconnect(ContextMenu_MousePressEvent); Controller.mouseReleaseEvent.disconnect(ContextMenu_MouseReleaseEvent); Entities.mousePressOnEntity.disconnect(ContextMenu_EntityClick); - Entities.hoverEnterEntity.disconnect(ContextMenu_EntityHover); + Entities.hoverEnterEntity.disconnect(ContextMenu_EntityHoverEnter); + Entities.hoverLeaveEntity.disconnect(ContextMenu_EntityHoverLeave); //Script.update.disconnect(ContextMenu_Update); Picks.removePick(targetingPick[0]); Picks.removePick(targetingPick[1]); From 4069c4191faa6c9c63fa04fc5f8b38d4e0997acb Mon Sep 17 00:00:00 2001 From: Ada Date: Sun, 17 May 2026 07:43:12 +1000 Subject: [PATCH 2/5] History up button --- scripts/communityScripts/contextMenu.js | 34 +++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/scripts/communityScripts/contextMenu.js b/scripts/communityScripts/contextMenu.js index c636d0c0e42..e1d3b721488 100644 --- a/scripts/communityScripts/contextMenu.js +++ b/scripts/communityScripts/contextMenu.js @@ -181,6 +181,7 @@ let currentMenuTargetLine = Uuid.NONE; let mouseWasCaptured = false; let disableCounter = 0; let prevClickTime = Date.now(); +let actionSetHistory = []; function ContextMenu_DeleteMenu() { for (const [e, _] of currentMenuEntities) { @@ -193,6 +194,7 @@ function ContextMenu_DeleteMenu() { currentMenuTargetIsAvatar = false; currentMenuTarget = Uuid.NONE; currentMenuTargetLine = Uuid.NONE; + actionSetHistory = []; Camera.captureMouse = mouseWasCaptured; } @@ -207,7 +209,12 @@ function ContextMenu_EntityClick(eid, event) { try { const data = JSON.parse(Entities.getEntityProperties(eid, "userData").userData); if (data.nextPage !== undefined && data.actionSetName !== undefined) { - ContextMenu_OpenActions(data.actionSetName, data.nextPage); + if (data.type === "historyBack") { + const history = actionSetHistory.pop(); + ContextMenu_OpenActions(history[0], history[1]); + } else { + ContextMenu_OpenActions(data.actionSetName, data.nextPage); + } } else { const func = data.actionFunc; currentMenuActionFuncs[func][0](currentMenuTarget, eid); @@ -452,14 +459,28 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { textEffectThickness: 0.3, }); + let backHasPages = hasPages && page > 0; + let backHasHistory = !backHasPages && actionSetHistory.length > 0; + let backUserData; + let backText = ""; + + if (backHasHistory) { + const history = actionSetHistory[actionSetHistory.length - 1]; + backUserData = { actionSetName: history[0], nextPage: history[1], type: "historyBack" }; + backText = "^"; + } else if (backHasPages) { + backUserData = { nextPage: page - 1, actionSetName: actionSetName }; + backText = "<"; + } + actionEnts.push({ - action: hasPages && page > 0 ? {} : undefined, + action: (backHasPages || backHasHistory) ? {} : undefined, grab: {grabbable: false}, type: "Text", position: Vec3.sum(origin, Vec3.multiplyQbyV(angle, [-0.13 * scale, yPos, 0])), rotation: angle, localDimensions: [0.04 * scale, 0.04 * scale, 0.01 * scale], - text: hasPages && page > 0 ? "<" : "", + text: backText, textColor: [230, 230, 230], backgroundColor: [0, 0, 0], backgroundAlpha: 0.9, @@ -470,7 +491,7 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { triggerable: false, leftMargin: 0.003 * lineScale, topMargin: -0.008 * lineScale, - userData: hasPages && page > 0 ? JSON.stringify({nextPage: page - 1, actionSetName: actionSetName}) : undefined, + userData: backUserData ? JSON.stringify(backUserData) : undefined, textEffect: "outline fill", textEffectColor: [0, 0, 0], textEffectThickness: 0.3, @@ -546,7 +567,10 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { let clickFunc = EMPTY_FUNCTION; if (action.submenu) { if (registeredActionSets[action.submenu]) { - clickFunc = _target => ContextMenu_OpenActions(action.submenu); + clickFunc = _target => { + actionSetHistory.push([actionSetName, page]); + ContextMenu_OpenActions(action.submenu); + }; } else { console.error(`Action "${action.text}" referencing unregistered submenu action set "${action.submenu}"`); } From be648997e4829b882bca9d7405ea880d0a890488 Mon Sep 17 00:00:00 2001 From: Ada Date: Sun, 17 May 2026 07:43:58 +1000 Subject: [PATCH 3/5] the formatting is wrong but it's slightly less wrong now lol --- scripts/communityScripts/contextMenu.js | 96 ++++++++++++------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/scripts/communityScripts/contextMenu.js b/scripts/communityScripts/contextMenu.js index e1d3b721488..c151b8eb454 100644 --- a/scripts/communityScripts/contextMenu.js +++ b/scripts/communityScripts/contextMenu.js @@ -1,11 +1,11 @@ // SPDX-License-Identifier: Apache-2.0 "use strict"; const CONTEXT_MENU_SETTINGS = Settings.getValue("Context Menu", { - actionsPerPage: 6, - font: "Roboto", - noSfx: false, - parented: true, - public: false, + actionsPerPage: 6, + font: "Roboto", + noSfx: false, + parented: true, + public: false, }); const ACTIONS_PER_PAGE = CONTEXT_MENU_SETTINGS["actionsPerPage"] ?? 6; @@ -184,9 +184,9 @@ let prevClickTime = Date.now(); let actionSetHistory = []; function ContextMenu_DeleteMenu() { - for (const [e, _] of currentMenuEntities) { - Entities.deleteEntity(e); - } + for (const [e, _] of currentMenuEntities) { + Entities.deleteEntity(e); + } currentMenuEntities.clear(); currentMenuActionFuncs = []; currentMenuOpen = false; @@ -194,7 +194,7 @@ function ContextMenu_DeleteMenu() { currentMenuTargetIsAvatar = false; currentMenuTarget = Uuid.NONE; currentMenuTargetLine = Uuid.NONE; - actionSetHistory = []; + actionSetHistory = []; Camera.captureMouse = mouseWasCaptured; } @@ -209,12 +209,12 @@ function ContextMenu_EntityClick(eid, event) { try { const data = JSON.parse(Entities.getEntityProperties(eid, "userData").userData); if (data.nextPage !== undefined && data.actionSetName !== undefined) { - if (data.type === "historyBack") { - const history = actionSetHistory.pop(); - ContextMenu_OpenActions(history[0], history[1]); - } else { - ContextMenu_OpenActions(data.actionSetName, data.nextPage); - } + if (data.type === "historyBack") { + const history = actionSetHistory.pop(); + ContextMenu_OpenActions(history[0], history[1]); + } else { + ContextMenu_OpenActions(data.actionSetName, data.nextPage); + } } else { const func = data.actionFunc; currentMenuActionFuncs[func][0](currentMenuTarget, eid); @@ -228,7 +228,7 @@ function ContextMenu_EntityClick(eid, event) { } function ContextMenu_EntityHoverEnter(eid, _event) { - const entityAction = currentMenuEntities.get(eid); + const entityAction = currentMenuEntities.get(eid); if (!entityAction) { return; } @@ -239,23 +239,23 @@ function ContextMenu_EntityHoverEnter(eid, _event) { } } catch (e) {} - Entities.editEntity(eid, { - textColor: entityAction.backgroundColor ?? [0, 0, 0], - backgroundColor: entityAction.textColor ?? [255, 255, 255], - textEffectColor: entityAction.textColor ?? [255, 255, 255], - }); + Entities.editEntity(eid, { + textColor: entityAction.backgroundColor ?? [0, 0, 0], + backgroundColor: entityAction.textColor ?? [255, 255, 255], + textEffectColor: entityAction.textColor ?? [255, 255, 255], + }); } function ContextMenu_EntityHoverLeave(eid, _event) { - const entityAction = currentMenuEntities.get(eid); + const entityAction = currentMenuEntities.get(eid); if (!entityAction) { return; } - Entities.editEntity(eid, { - backgroundColor: entityAction.backgroundColor ?? [0, 0, 0], - textEffectColor: entityAction.backgroundColor ?? [0, 0, 0], - textColor: entityAction.textColor ?? [255, 255, 255], - }); + Entities.editEntity(eid, { + backgroundColor: entityAction.backgroundColor ?? [0, 0, 0], + textEffectColor: entityAction.backgroundColor ?? [0, 0, 0], + textColor: entityAction.textColor ?? [255, 255, 255], + }); } function ContextMenu_FindTarget(hand = 1) { @@ -459,22 +459,22 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { textEffectThickness: 0.3, }); - let backHasPages = hasPages && page > 0; - let backHasHistory = !backHasPages && actionSetHistory.length > 0; - let backUserData; - let backText = ""; - - if (backHasHistory) { - const history = actionSetHistory[actionSetHistory.length - 1]; - backUserData = { actionSetName: history[0], nextPage: history[1], type: "historyBack" }; - backText = "^"; - } else if (backHasPages) { - backUserData = { nextPage: page - 1, actionSetName: actionSetName }; - backText = "<"; - } + let backHasPages = hasPages && page > 0; + let backHasHistory = !backHasPages && actionSetHistory.length > 0; + let backUserData; + let backText = ""; + + if (backHasHistory) { + const history = actionSetHistory[actionSetHistory.length - 1]; + backUserData = { actionSetName: history[0], nextPage: history[1], type: "historyBack" }; + backText = "^"; + } else if (backHasPages) { + backUserData = { nextPage: page - 1, actionSetName: actionSetName }; + backText = "<"; + } actionEnts.push({ - action: (backHasPages || backHasHistory) ? {} : undefined, + action: (backHasPages || backHasHistory) ? {} : undefined, grab: {grabbable: false}, type: "Text", position: Vec3.sum(origin, Vec3.multiplyQbyV(angle, [-0.13 * scale, yPos, 0])), @@ -498,7 +498,7 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { }); actionEnts.push({ - action: hasPages && page < maxPages ? {} : undefined, + action: hasPages && page < maxPages ? {} : undefined, grab: {grabbable: false}, type: "Text", position: Vec3.sum(origin, Vec3.multiplyQbyV(angle, [0.13 * scale, yPos, 0])), @@ -529,7 +529,7 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { let pos = Vec3.sum(origin, Vec3.multiplyQbyV(angle, [0, yPos, 0])); actionEnts.push({ - action, + action, grab: {grabbable: false}, type: "Text", position: pos, @@ -568,9 +568,9 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { if (action.submenu) { if (registeredActionSets[action.submenu]) { clickFunc = _target => { - actionSetHistory.push([actionSetName, page]); - ContextMenu_OpenActions(action.submenu); - }; + actionSetHistory.push([actionSetName, page]); + ContextMenu_OpenActions(action.submenu); + }; } else { console.error(`Action "${action.text}" referencing unregistered submenu action set "${action.submenu}"`); } @@ -635,7 +635,7 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { a.fadeOutMode = "disabled"; const e = Entities.addEntity(a, (CONTEXT_MENU_SETTINGS.public ?? false) ? "avatar" : "local"); - currentMenuEntities.set(e, a.action ?? null); + currentMenuEntities.set(e, a.action ?? null); } currentMenuOpen = true; @@ -877,7 +877,7 @@ Script.scriptEnding.connect(() => { Controller.mouseReleaseEvent.disconnect(ContextMenu_MouseReleaseEvent); Entities.mousePressOnEntity.disconnect(ContextMenu_EntityClick); Entities.hoverEnterEntity.disconnect(ContextMenu_EntityHoverEnter); - Entities.hoverLeaveEntity.disconnect(ContextMenu_EntityHoverLeave); + Entities.hoverLeaveEntity.disconnect(ContextMenu_EntityHoverLeave); //Script.update.disconnect(ContextMenu_Update); Picks.removePick(targetingPick[0]); Picks.removePick(targetingPick[1]); From 9828a1e9124433c90abf93575a20381581a584cd Mon Sep 17 00:00:00 2001 From: Ada Date: Fri, 19 Jun 2026 20:56:42 +1000 Subject: [PATCH 4/5] document globals, remove unused target line --- scripts/communityScripts/contextMenu.js | 76 +++++++------------------ 1 file changed, 19 insertions(+), 57 deletions(-) diff --git a/scripts/communityScripts/contextMenu.js b/scripts/communityScripts/contextMenu.js index c151b8eb454..52492438228 100644 --- a/scripts/communityScripts/contextMenu.js +++ b/scripts/communityScripts/contextMenu.js @@ -172,15 +172,33 @@ const targetingPick = [ ]; let currentMenuOpen = false; + +/** + * List of all entities owned by the context menu, + * as well as a map to a function for when they're clicked. + * @type Map void> + */ let currentMenuEntities = new Map(); +/** + * Callback actions for each action button. + * @type Array<(target: Uuid) => void> + */ let currentMenuActionFuncs = []; +/** + * The selected target for the context menu, set by + * holding down click on something when opening the menu. + * @type Uuid + */ let currentMenuTarget = Uuid.NONE; let currentMenuTargetIsAvatar = false; let currentMenuInSubmenu = false; -let currentMenuTargetLine = Uuid.NONE; let mouseWasCaptured = false; let disableCounter = 0; let prevClickTime = Date.now(); +/** + * Stack of submenu action sets to allow going to previously open ones + * @type Array<[actionSetName: string, page: number]> + */ let actionSetHistory = []; function ContextMenu_DeleteMenu() { @@ -193,7 +211,6 @@ function ContextMenu_DeleteMenu() { currentMenuInSubmenu = false; currentMenuTargetIsAvatar = false; currentMenuTarget = Uuid.NONE; - currentMenuTargetLine = Uuid.NONE; actionSetHistory = []; Camera.captureMouse = mouseWasCaptured; } @@ -277,7 +294,6 @@ function ContextMenu_FindTarget(hand = 1) { function ContextMenu_OpenActions(actionSetName, page = 0) { currentMenuEntities.forEach((_, e) => Entities.deleteEntity(e)); - currentMenuTargetLine = Uuid.NONE; currentMenuActionFuncs = []; currentMenuInSubmenu = true; @@ -351,37 +367,6 @@ function ContextMenu_OpenActions(actionSetName, page = 0) { let yPos = Math.max(1, activeActions.length) * 0.02 * scale; let bgHeight = (yPos / 2.0) - (0.03 * scale); - // FIXME: Highlight laser doesn't work on camera or sensor-matrix joint - /*if (!Uuid.isNull(currentMenuTarget)) { - let targetPos; - if (currentMenuTargetIsAvatar) { - targetPos = AvatarList.getAvatar(currentMenuTarget).position; - } else { - targetPos = Entities.getEntityProperties(currentMenuTarget, "position").position; - } - - currentMenuTargetLine = Entities.addEntity({ - type: "PolyLine", - grab: {grabbable: false}, - parentID: (CONTEXT_MENU_SETTINGS.parented ?? true) ? myAvatar : undefined, - parentJointIndex: HMD.active ? SENSOR_TO_WORLD_MATRIX_INDEX : CAMERA_MATRIX_INDEX, - position: origin, - linePoints: [ - [0, 0, 0], - [targetPos.x - origin.x, targetPos.y - origin.y, targetPos.z - origin.z], - ], - normals: [ - [0, 0, 1], - [0, 0, 1], - ], - strokeWidths: [0.02, 0], - color: [127, 255, 255], - faceCamera: true, - glow: true, - }, (CONTEXT_MENU_SETTINGS.public ?? false) ? "avatar" : "local"); - currentMenuEntities.add(currentMenuTargetLine); - }*/ - let titleText; let descriptionText; if (currentMenuTargetIsAvatar) { @@ -783,27 +768,6 @@ function ContextMenu_ActionEvent(action, value) { } } -// FIXME: Highlight laser doesn't work on camera or sensor-matrix joint -/*function ContextMenu_Update() { - if (!Uuid.isNull(currentMenuTargetLine)) { - if (currentMenuTargetIsAvatar) { - targetPos = AvatarList.getAvatar(currentMenuTarget).position; - } else { - targetPos = Entities.getEntityProperties(currentMenuTarget, "position").position; - } - - const myPos = Entities.getEntityProperties(currentMenuTargetLine, "position").position; - - Entities.editEntity(currentMenuTargetLine, { - linePoints: [ - [0, 0, 0], - [targetPos.x - myPos.x, targetPos.y - myPos.y, targetPos.z - myPos.z], - ], - rotation: Quat.IDENTITY, - }); - } -}*/ - function ContextMenu_Message(channel, msg, _senderID, _localOnly) { if (channel === MAIN_CHANNEL) { let data; try { data = JSON.parse(msg); } catch (e) {} @@ -855,7 +819,6 @@ Controller.mouseReleaseEvent.connect(ContextMenu_MouseReleaseEvent); Entities.mousePressOnEntity.connect(ContextMenu_EntityClick); Entities.hoverEnterEntity.connect(ContextMenu_EntityHoverEnter); Entities.hoverLeaveEntity.connect(ContextMenu_EntityHoverLeave); -//Script.update.connect(ContextMenu_Update); for (const pick of targetingPick) { Picks.setIgnoreItems(pick, [MyAvatar.sessionUUID]); @@ -878,7 +841,6 @@ Script.scriptEnding.connect(() => { Entities.mousePressOnEntity.disconnect(ContextMenu_EntityClick); Entities.hoverEnterEntity.disconnect(ContextMenu_EntityHoverEnter); Entities.hoverLeaveEntity.disconnect(ContextMenu_EntityHoverLeave); - //Script.update.disconnect(ContextMenu_Update); Picks.removePick(targetingPick[0]); Picks.removePick(targetingPick[1]); ContextMenu_DeleteMenu(); From ec807f3cc453c1343d3a21e6270abd25f1eab14f Mon Sep 17 00:00:00 2001 From: Ada Date: Fri, 19 Jun 2026 21:19:26 +1000 Subject: [PATCH 5/5] make hovered actions slightly lightened rather than inverted --- scripts/communityScripts/contextMenu.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/communityScripts/contextMenu.js b/scripts/communityScripts/contextMenu.js index 52492438228..b62aab2ba5d 100644 --- a/scripts/communityScripts/contextMenu.js +++ b/scripts/communityScripts/contextMenu.js @@ -256,10 +256,17 @@ function ContextMenu_EntityHoverEnter(eid, _event) { } } catch (e) {} + // make the background a little lighter on hovered actions + // NOTE: the spread operator is necessary here to get a copy, + // otherwise we'll be modifying entityAction.backgroundColor itself + let bgColor = [...entityAction.backgroundColor ?? [0, 0, 0]]; + bgColor[0] = Math.min(bgColor[0] + 48, 255); + bgColor[1] = Math.min(bgColor[1] + 48, 255); + bgColor[2] = Math.min(bgColor[2] + 48, 255); + Entities.editEntity(eid, { - textColor: entityAction.backgroundColor ?? [0, 0, 0], - backgroundColor: entityAction.textColor ?? [255, 255, 255], - textEffectColor: entityAction.textColor ?? [255, 255, 255], + backgroundColor: bgColor, + textEffectColor: bgColor, }); } @@ -268,10 +275,11 @@ function ContextMenu_EntityHoverLeave(eid, _event) { if (!entityAction) { return; } + const bgColor = entityAction.backgroundColor ?? [0, 0, 0]; + Entities.editEntity(eid, { - backgroundColor: entityAction.backgroundColor ?? [0, 0, 0], - textEffectColor: entityAction.backgroundColor ?? [0, 0, 0], - textColor: entityAction.textColor ?? [255, 255, 255], + backgroundColor: bgColor, + textEffectColor: bgColor }); }