Skip to content

Commit

Permalink
close jumartin#86 visible CGRect is wrong when creating event
Browse files Browse the repository at this point in the history
  • Loading branch information
zhjuncai committed May 22, 2017
1 parent eb87812 commit 9d7c480
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CalendarLib/MGCDayPlannerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1142,9 +1142,10 @@ - (CGRect)rectForNewEventOfType:(MGCEventType)type atDate:(NSDate*)date
CGFloat x = section * self.dayColumnSize.width;

if (type == MGCTimedEventType) {
CGFloat y = [self offsetFromTime:self.durationForNewTimedEvent rounding:0];
CGRect rect = CGRectMake(x, y, self.dayColumnSize.width, self.interactiveCellTimedEventHeight);
return [self convertRect:rect fromView:self.timedEventsView];
NSDateComponents *comp = [self.calendar components:NSCalendarUnitHour|NSCalendarUnitMinute fromDate:date];
CGFloat y = [self offsetFromTime:(comp.hour*3600. + comp.minute*60.) rounding:0];
CGRect rect = CGRectMake(x, y, self.dayColumnSize.width, self.hourSlotHeight);
return [self convertRect:rect fromView:self.timedEventsView];
}
else if (type == MGCAllDayEventType) {
CGRect rect = CGRectMake(x, 0, self.dayColumnSize.width, self.allDayEventCellHeight);
Expand Down

0 comments on commit 9d7c480

Please sign in to comment.