Skip to content

Commit

Permalink
fix safeComputeTop, wont include nowindicator when offscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Apr 8, 2020
1 parent d044bcd commit 933eeff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/DateProfileGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { computeVisibleDayRange } from './util/misc'


export interface DateProfile {
currentRange: DateRange
currentRange: DateRange // TODO: does this include slotMinTime/slotMaxTime?
currentRangeUnit: string
isRangeAllDay: boolean
validRange: OpenDateRange
Expand Down
16 changes: 13 additions & 3 deletions packages/timegrid/src/TimeColsSlatsCoords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,19 @@ export default class TimeColsSlatsCoords {
}


safeComputeTop(date: DateMarker) {
if (rangeContainsMarker(this.dateProfile.currentRange, date)) {
return this.computeDateTop(date)
safeComputeTop(date: DateMarker) { // TODO: DRY with computeDateTop
let { dateProfile } = this

if (rangeContainsMarker(dateProfile.currentRange, date)) {
let startOfDayDate = startOfDay(date)
let timeMs = date.valueOf() - startOfDayDate.valueOf()

if (
timeMs >= asRoughMs(dateProfile.slotMinTime) &&
timeMs < asRoughMs(dateProfile.slotMaxTime)
) {
return this.computeTimeTop(createDuration(timeMs))
}
}
}

Expand Down

0 comments on commit 933eeff

Please sign in to comment.