-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrenderer.js
More file actions
26 lines (22 loc) · 870 Bytes
/
renderer.js
File metadata and controls
26 lines (22 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
window.addEventListener('DOMContentLoaded', () => {
const gear = document.getElementById('gear');
let tooltipVisible = false;
gear.addEventListener('click', (event) => {
event.stopPropagation(); // prevent triggering document click
if (!tooltipVisible) {
const rect = gear.getBoundingClientRect();
const mouseX = window.screenX + rect.left + rect.width / 2;
const mouseY = window.screenY + rect.top + rect.height;
window.electronAPI.showTooltip(parseInt(mouseX), parseInt(mouseY));
} else {
window.electronAPI.hideTooltip();
}
tooltipVisible = !tooltipVisible;
});
document.addEventListener('click', (event) => {
if (tooltipVisible) {
window.electronAPI.hideTooltip();
tooltipVisible = false;
}
});
});