feat: More dynamic styling for placeholder

- Create global setAttributesAccordingToPosition
- Change style of placeholder to show snap side
This commit is contained in:
sthag 2025-11-02 12:22:08 +01:00
parent 53897754e2
commit a18b42bb2a
2 changed files with 53 additions and 21 deletions

View file

@ -370,6 +370,18 @@ function centerElementUnderCursor(event, element) {
element.style.top = `${y}px`;
}
function setAttributesAccordingToPosition(element, position, attributes) {
element.classList.remove(...Object.values(attributes).map(pos => pos.className));
Object.keys(attributes[position].styles).forEach(key => {
element.style[key] = '';
});
element.classList.add(attributes[position].className);
Object.entries(attributes[position].styles).forEach(([key, value]) => {
element.style[key] = value;
});
}
// CONCEPTS
// NOTE: Benutzt private Zuweisungen