Skip to content

Commit 283c50e

Browse files
author
Matt Lewis
committed
fix(monthView): don't fire dayClicked output when clicking on an event and using hammerjs
Closes #318
1 parent b2a9d9b commit 283c50e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/components/month/calendarMonthView.component.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ import { CalendarUtils } from '../../providers/calendarUtils.provider';
6464
[tooltipAppendToBody]="tooltipAppendToBody"
6565
[tooltipTemplate]="tooltipTemplate"
6666
[customTemplate]="cellTemplate"
67-
(click)="dayClicked.emit({day: day})"
67+
(click)="handleDayClick($event, day)"
6868
(highlightDay)="toggleDayHighlight($event.event, true)"
6969
(unhighlightDay)="toggleDayHighlight($event.event, false)"
7070
mwlDroppable
@@ -314,6 +314,16 @@ export class CalendarMonthViewComponent
314314
this.eventTimesChanged.emit({ event, newStart, newEnd });
315315
}
316316

317+
/**
318+
* @hidden
319+
*/
320+
handleDayClick(clickEvent: any, day: MonthViewDay) {
321+
// when using hammerjs, stopPropagation doesn't work. See https://github.com/mattlewis92/angular-calendar/issues/318
322+
if (!clickEvent.target.classList.contains('cal-event')) {
323+
this.dayClicked.emit({ day });
324+
}
325+
}
326+
317327
private refreshHeader(): void {
318328
this.columnHeaders = this.utils.getWeekViewHeader({
319329
viewDate: this.viewDate,

0 commit comments

Comments
 (0)