Skip to content

Commit 2bc9c7d

Browse files
committed
changed resizeAndPositionTimetableIndicator to correct positioning using parentElement for better clarity
1 parent dfcb129 commit 2bc9c7d

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

client/src/components/time_indicator.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ export function resizeAndPositionTimeIndicator() {
4646
visible.left - now_label_rect.width - separator_rect.width;
4747
const now_label_top = time_top - now_label_rect.height / 2;
4848

49-
now_label.style.left = now_label_left - content_rect.left + "px";
50-
now_label.style.top = now_label_top - content_rect.top + "px";
49+
const parent_rect = time_indicator.parentElement?.getBoundingClientRect();
50+
if (parent_rect == undefined) return;
51+
52+
now_label.style.left = now_label_left - parent_rect.left + "px";
53+
now_label.style.top = now_label_top - parent_rect.top + "px";
5154
}
5255

5356
/*

client/src/components/timetable.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ import TimetableTask, {
1212
TimetableTaskProps,
1313
} from "@/components/timetable_task";
1414

15-
/*
16-
NOTES:
17-
- Should use element.parentElement for position adjusting for more clarity.
18-
*/
19-
2015
/*
2116
Returns a rect {left, right, top, bottom, width, height} of the visible area of
2217
the timetable where timetable tasks are to be rendered.

0 commit comments

Comments
 (0)