Centralize menu button coordinate logic and replace popupwindows with dropdownmenu.

This commit is contained in:
Jas Singh
2024-07-14 15:13:09 -07:00
parent 6062164652
commit 7a2fdf8647
21 changed files with 89 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
const battery = await Service.import("battery");
import { closeAllMenus } from "../index.js";
import { openMenu } from "../utils.js";
const BatteryLabel = () => {
const isVis = Variable(battery.available);
@@ -54,14 +54,8 @@ const BatteryLabel = () => {
}),
isVis,
props: {
on_primary_click: (_, event) => {
const clickPos = event.get_root_coords();
const coords = [clickPos[1], clickPos[2]];
globalMousePos.value = coords;
closeAllMenus();
App.toggleWindow("energymenu");
on_primary_click: (clicked, event) => {
openMenu(clicked, event, "energymenu");
},
},
};