Optimizes header event handling and all-day display
Improves performance by early-exiting header event processing when no drag operation is active. Ensures the all-day container height is re-evaluated after the mouse leaves the header area, maintaining correct layout.
This commit is contained in:
parent
3b75e1cafc
commit
1538e8c460
2 changed files with 14 additions and 8 deletions
|
|
@ -51,6 +51,12 @@ export class AllDayManager {
|
||||||
console.log('🏗️ AllDayManager: Received request to ensure all-day container exists');
|
console.log('🏗️ AllDayManager: Received request to ensure all-day container exists');
|
||||||
this.ensureAllDayContainer();
|
this.ensureAllDayContainer();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Listen for header mouseleave to recalculate all-day container height
|
||||||
|
eventBus.on('header:mouseleave', () => {
|
||||||
|
console.log('🔄 AllDayManager: Received header:mouseleave, recalculating height');
|
||||||
|
this.checkAndAnimateAllDayHeight();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,14 @@ export class HeaderManager {
|
||||||
|
|
||||||
// Use mouseenter instead of mouseover to avoid continuous firing
|
// Use mouseenter instead of mouseover to avoid continuous firing
|
||||||
this.headerEventListener = (event: Event) => {
|
this.headerEventListener = (event: Event) => {
|
||||||
|
// OPTIMIZED: Check for active drag operation FIRST before doing any other work
|
||||||
|
const isDragActive = document.querySelector('.dragging') !== null;
|
||||||
|
|
||||||
|
if (!isDragActive) {
|
||||||
|
// Ingen drag operation, spring resten af funktionen over
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const target = event.target as HTMLElement;
|
const target = event.target as HTMLElement;
|
||||||
|
|
||||||
console.log('🖱️ HeaderManager: mouseenter detected on:', target.tagName, target.className);
|
console.log('🖱️ HeaderManager: mouseenter detected on:', target.tagName, target.className);
|
||||||
|
|
@ -74,14 +82,6 @@ export class HeaderManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allDayContainer) {
|
if (allDayContainer) {
|
||||||
// SMART CHECK: Only calculate target date if there's an active drag operation
|
|
||||||
const isDragActive = document.querySelector('.dragging') !== null;
|
|
||||||
|
|
||||||
if (!isDragActive) {
|
|
||||||
console.log('⏭️ HeaderManager: No active drag operation, skipping target date calculation');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('📍 HeaderManager: Active drag detected, calculating target date...');
|
console.log('📍 HeaderManager: Active drag detected, calculating target date...');
|
||||||
|
|
||||||
// Calculate target date from mouse X coordinate
|
// Calculate target date from mouse X coordinate
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue