Skip to content

Commit d0867b7

Browse files
fix: sort menu values
1 parent 8c0fbfb commit d0867b7

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/backend/menus/sortContextMenu.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,14 @@ export function setupSortContextMenu() {
9090
];
9191

9292
const menu = Menu.buildFromTemplate(template);
93-
menu.popup({
94-
x,
95-
y,
96-
});
93+
94+
try {
95+
menu.popup({
96+
x,
97+
y,
98+
});
99+
} catch (error) {
100+
console.error("Error popping up sort context menu", error);
101+
}
97102
});
98103
}

src/frontend/features/notes/components/NotesHeader.tsx

+14-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,23 @@ export function NotesHeader() {
2323
const headerElement = document.getElementById("notes-header");
2424
if (headerElement) {
2525
const rect = headerElement.getBoundingClientRect();
26+
27+
const roundedRect = {
28+
left: Math.round(rect.left),
29+
top: Math.round(rect.top),
30+
right: Math.round(rect.right),
31+
bottom: Math.round(rect.bottom),
32+
};
33+
2634
if (activeNotebookId) {
2735
const notebook = await window.api.getNotebook(activeNotebookId);
28-
window.api.notebookSortContextMenu(notebook, rect.left, rect.bottom);
36+
window.api.notebookSortContextMenu(
37+
notebook,
38+
roundedRect.left + 24,
39+
roundedRect.bottom,
40+
);
2941
} else {
30-
window.api.sortContextMenu(rect.left, rect.bottom);
42+
window.api.sortContextMenu(roundedRect.left + 24, roundedRect.bottom);
3143
}
3244
}
3345
}

0 commit comments

Comments
 (0)