feat: More dynamic styling for placeholder
- Create global setAttributesAccordingToPosition - Change style of placeholder to show snap side
This commit is contained in:
parent
53897754e2
commit
a18b42bb2a
2 changed files with 53 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue