feat: Change placeholder while dragging

- Move edge detection to global function
- Change placeholder style during mouse move
This commit is contained in:
sthag 2025-11-02 11:40:54 +01:00
parent 0f561d360a
commit aa5d095e64
2 changed files with 40 additions and 24 deletions

View file

@ -339,6 +339,27 @@ class DateDisplay {
}
}
function checkButtonAndTarget(event, element, button = 0) {
return (
event.button === button &&
event.target === element
);
}
function getClosestEdge(element) {
const rect = element.getBoundingClientRect();
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
const distances = {
top: rect.top,
right: windowWidth - rect.right,
bottom: windowHeight - rect.bottom,
left: rect.left
};
return Object.keys(distances).reduce((a, b) => distances[a] < distances[b] ? a : b);
}
// CONCEPTS
// NOTE: Benutzt private Zuweisungen
@ -524,10 +545,3 @@ function gigabytes(percent, total, round) {
return g;
}
function checkButtonAndTarget(event, element, button = 0) {
return (
event.button === button &&
event.target === element
);
}