Ensures accurate all-day event placement
Reorders operations to calculate grid position for all-day events before appending them to the DOM. This prevents the element from being incorrectly counted during position calculations, improving placement accuracy.
This commit is contained in:
parent
c9b9ac4cae
commit
35651be2f0
1 changed files with 9 additions and 15 deletions
|
|
@ -291,26 +291,20 @@ export class AllDayManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move clone element to all-day container
|
// Calculate position BEFORE adding to container (to avoid counting clone as existing event)
|
||||||
allDayContainer.appendChild(cloneElement);
|
|
||||||
|
|
||||||
// Add CSS class for all-day styling
|
|
||||||
cloneElement.classList.add('all-day-style');
|
|
||||||
|
|
||||||
// Store target date for positioning
|
|
||||||
cloneElement.dataset.allDayDate = targetDate;
|
|
||||||
|
|
||||||
// Calculate and set grid column based on targetDate
|
|
||||||
const columnIndex = this.getColumnIndexForDate(targetDate);
|
const columnIndex = this.getColumnIndexForDate(targetDate);
|
||||||
cloneElement.style.gridColumn = columnIndex.toString();
|
|
||||||
|
|
||||||
// Find available row and set grid row
|
|
||||||
const availableRow = this.findAvailableRow(targetDate);
|
const availableRow = this.findAvailableRow(targetDate);
|
||||||
cloneElement.style.gridRow = availableRow.toString();
|
|
||||||
|
|
||||||
// Show the element (ensure it's visible)
|
// Set all properties BEFORE adding to DOM
|
||||||
|
cloneElement.classList.add('all-day-style');
|
||||||
|
cloneElement.style.gridColumn = columnIndex.toString();
|
||||||
|
cloneElement.style.gridRow = availableRow.toString();
|
||||||
|
cloneElement.dataset.allDayDate = targetDate;
|
||||||
cloneElement.style.display = '';
|
cloneElement.style.display = '';
|
||||||
|
|
||||||
|
// NOW add to container (after all positioning is calculated)
|
||||||
|
allDayContainer.appendChild(cloneElement);
|
||||||
|
|
||||||
console.log('✅ AllDayManager: Converted to all-day style', {
|
console.log('✅ AllDayManager: Converted to all-day style', {
|
||||||
eventId: cloneElement.dataset.eventId,
|
eventId: cloneElement.dataset.eventId,
|
||||||
gridColumn: columnIndex,
|
gridColumn: columnIndex,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue