Removes redundant event visibility filtering
Eliminates unnecessary event visibility check in layout engine Assumes events are pre-filtered before reaching the layout calculation, simplifying the processing logic and reducing computational overhead Removes local `isEventVisible` method and directly processes all input events
This commit is contained in:
parent
be551f88e5
commit
d53af317bb
1 changed files with 2 additions and 20 deletions
|
|
@ -30,11 +30,9 @@ export class AllDayLayoutEngine {
|
||||||
// Reset tracks for new calculation
|
// Reset tracks for new calculation
|
||||||
this.tracks = [new Array(this.columnIdentifiers.length).fill(false)];
|
this.tracks = [new Array(this.columnIdentifiers.length).fill(false)];
|
||||||
|
|
||||||
// Filter to only visible events
|
|
||||||
const visibleEvents = events.filter(event => this.isEventVisible(event));
|
|
||||||
|
|
||||||
// Process events in input order (no sorting)
|
// Process events in input order (no sorting)
|
||||||
for (const event of visibleEvents) {
|
// Events are already filtered by DataSource before reaching this engine
|
||||||
|
for (const event of events) {
|
||||||
const startDay = this.getEventStartDay(event);
|
const startDay = this.getEventStartDay(event);
|
||||||
const endDay = this.getEventEndDay(event);
|
const endDay = this.getEventEndDay(event);
|
||||||
|
|
||||||
|
|
@ -157,22 +155,6 @@ export class AllDayLayoutEngine {
|
||||||
return endIndex;
|
return endIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if event is visible in the current date range
|
|
||||||
*/
|
|
||||||
private isEventVisible(event: ICalendarEvent): boolean {
|
|
||||||
if (this.columnIdentifiers.length === 0) return false;
|
|
||||||
|
|
||||||
const eventStartDate = this.formatDate(event.start);
|
|
||||||
const eventEndDate = this.formatDate(event.end);
|
|
||||||
const firstVisibleDate = this.columnIdentifiers[0];
|
|
||||||
const lastVisibleDate = this.columnIdentifiers[this.columnIdentifiers.length - 1];
|
|
||||||
|
|
||||||
// Event overlaps if it doesn't end before visible range starts
|
|
||||||
// AND doesn't start after visible range ends
|
|
||||||
return !(eventEndDate < firstVisibleDate || eventStartDate > lastVisibleDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format date to YYYY-MM-DD string using local date
|
* Format date to YYYY-MM-DD string using local date
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue