Moves event positioning to renderer
Relocates event CSS positioning logic from the `SwpEventElement` to the `DateEventRenderer`. This improves separation of concerns, making the renderer responsible for event layout.
This commit is contained in:
parent
5fae433afb
commit
57bf122675
2 changed files with 11 additions and 12 deletions
|
|
@ -182,7 +182,17 @@ export class DateEventRenderer implements EventRendererStrategy {
|
|||
}
|
||||
|
||||
private renderEvent(event: CalendarEvent): HTMLElement {
|
||||
return SwpEventElement.fromCalendarEvent(event);
|
||||
const element = SwpEventElement.fromCalendarEvent(event);
|
||||
|
||||
// Apply positioning (moved from SwpEventElement.applyPositioning)
|
||||
const position = this.calculateEventPosition(event);
|
||||
element.style.position = 'absolute';
|
||||
element.style.top = `${position.top + 1}px`;
|
||||
element.style.height = `${position.height - 3}px`;
|
||||
element.style.left = '2px';
|
||||
element.style.right = '2px';
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
protected calculateEventPosition(event: CalendarEvent): { top: number; height: number } {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue