Centralize menu button coordinate logic and replace popupwindows with dropdownmenu.
This commit is contained in:
@@ -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");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user