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

@@ -29,13 +29,18 @@ const moveBoxToCursor = (self, fixed) => {
marginRight = fixed ? marginRight - monWidth / 2 : marginRight - value[0];
let marginLeft = monWidth - currentWidth - marginRight;
if (marginRight < 0) {
marginRight = 13;
marginLeft = monWidth - currentWidth - 13;
} else if (marginRight < 13) {
marginRight = 13;
marginLeft = monWidth - currentWidth - 13;
const minimumMargin = 0;
if (marginRight < minimumMargin) {
marginRight = minimumMargin;
marginLeft = monWidth - currentWidth - minimumMargin;
}
if (marginLeft < minimumMargin) {
marginLeft = minimumMargin;
marginRight = monWidth - currentWidth - minimumMargin;
}
const marginTop = 45;
const marginBottom = monHeight - marginTop;
self.set_margin_left(marginLeft);

View File

@@ -1,14 +1,12 @@
import PopupWindow from "../PopupWindow.js";
import DropdownMenu from "../DropdownMenu.js";
import { TimeWidget } from "./time/index.js";
import { CalendarWidget } from "./calendar.js";
import { WeatherWidget } from "./weather/index.js";
export default () => {
return PopupWindow({
return DropdownMenu({
name: "calendarmenu",
visible: false,
transition: "crossfade",
layout: "top-right",
child: Widget.Box({
class_name: "calendar-menu-content",
css: "padding: 1px; margin: -1px;",

View File

@@ -1,4 +1,4 @@
import PopupWindow from "../PopupWindow.js";
import DropdownMenu from "../DropdownMenu.js";
import { Profile } from "./profile/index.js";
import { Shortcuts } from "./shortcuts/index.js";
import { Controls } from "./controls/index.js";
@@ -6,11 +6,9 @@ import { Stats } from "./stats/index.js";
import { Directories } from "./directories/index.js";
export default () => {
return PopupWindow({
return DropdownMenu({
name: "dashboardmenu",
visible: false,
transition: "crossfade",
layout: "top-left",
child: Widget.Box({
class_name: "dashboard-menu-content",
css: "padding: 1px; margin: -1px;",

View File

@@ -1,11 +1,9 @@
import PopupWindow from "../PopupWindow.js";
import DropdownMenu from "../DropdownMenu.js";
import { Media } from "./media.js";
export default () => {
return PopupWindow({
return DropdownMenu({
name: "mediamenu",
layout: "top-center",
visible: false,
transition: "crossfade",
child: Widget.Box({
class_name: "menu-items",

View File

@@ -1,4 +1,3 @@
const network = await Service.import("network");
import DropdownMenu from "../DropdownMenu.js";
import { Ethernet } from "./ethernet/index.js";
import { Wifi } from "./wifi/index.js";

View File

@@ -1,14 +1,12 @@
import PopupWindow from "../PopupWindow.js";
import DropdownMenu from "../DropdownMenu.js";
const notifs = await Service.import("notifications");
import { Controls } from "./controls/index.js";
import { NotificationCard } from "./notification/index.js";
export default () => {
return PopupWindow({
return DropdownMenu({
name: "notificationsmenu",
visible: false,
transition: "crossfade",
layout: "top-right",
child: Widget.Box({
class_name: "notification-menu-content",
css: "padding: 1px; margin: -1px;",