@@ -14,7 +14,7 @@ import TimetableTask, {
1414
1515/*
1616NOTES:
17- - Should rename timetable-barrier to timetable-content to be more descriptive.
17+ - Should rename timetable-content to timetable-content to be more descriptive.
1818- Should use element.parentElement for position adjusting for more clarity.
1919*/
2020
@@ -23,13 +23,13 @@ Returns a rect {left, right, top, bottom, width, height} of the visible area of
2323the timetable where timetable tasks are to be rendered.
2424
2525Visible area is the area:
26- - Within timetable-barrier 's bounding client rect
26+ - Within timetable-content 's bounding client rect
2727- Right of timetable-separator (right of time labels)
2828- Below time-header(s))
2929
3030Returns nothing if any of the required elements are not found (that is, elements
31- with id: time-header, timetable-barrier , timetable-separator, and
32- timetable-barrier ).
31+ with id: time-header, timetable-content , timetable-separator, and
32+ timetable-content ).
3333*/
3434export function getVisibleTimetableRect ( ) {
3535 const time_header = document . getElementById ( "Time-Header" ) ;
@@ -40,19 +40,19 @@ export function getVisibleTimetableRect() {
4040 if ( time_labels == null ) return ;
4141 const time_labels_rect = time_labels . getBoundingClientRect ( ) ;
4242
43- const timetable_barrier = document . getElementById ( "timetable-barrier " ) ;
44- if ( timetable_barrier == null ) return ;
45- const timetable_barrier_rect = timetable_barrier . getBoundingClientRect ( ) ;
43+ const timetable_content = document . getElementById ( "timetable-content " ) ;
44+ if ( timetable_content == null ) return ;
45+ const timetable_content_rect = timetable_content . getBoundingClientRect ( ) ;
4646
4747 const timetable_separator = document . getElementById ( "timetable-separator" ) ;
4848 if ( timetable_separator == null ) return ;
4949 const timetable_separator_rect = timetable_separator . getBoundingClientRect ( ) ;
5050
5151 const rect = {
5252 left : time_labels_rect . right + timetable_separator_rect . width ,
53- right : timetable_barrier_rect . left + timetable_barrier . clientWidth ,
53+ right : timetable_content_rect . left + timetable_content . clientWidth ,
5454 top : time_header_rect . bottom ,
55- bottom : timetable_barrier_rect . top + timetable_barrier . clientHeight ,
55+ bottom : timetable_content_rect . top + timetable_content . clientHeight ,
5656 width : 0 ,
5757 height : 0 ,
5858 } ;
@@ -104,21 +104,21 @@ export function getDayLeftPosition(day: string) {
104104
105105/*
106106Sync the timetable-foreground element's position and size with the
107- timetable-barrier element. Ensures foreground elements inhabit the same area
107+ timetable-content element. Ensures foreground elements inhabit the same area
108108as the background elements.
109109*/
110110function resizeAndPositionTimetableForeground ( ) {
111111 const foreground = document . getElementById ( "timetable-foreground" ) ;
112112 if ( foreground == null ) return ;
113113
114- const barrier = document . getElementById ( "timetable-barrier " ) ;
115- if ( barrier == null ) return ;
116- const barrier_rect = barrier . getBoundingClientRect ( ) ;
114+ const content = document . getElementById ( "timetable-content " ) ;
115+ if ( content == null ) return ;
116+ const content_rect = content . getBoundingClientRect ( ) ;
117117
118- foreground . style . top = barrier_rect . top + "px" ;
119- foreground . style . left = barrier_rect . left + "px" ;
120- foreground . style . width = barrier . clientWidth + "px" ;
121- foreground . style . height = barrier . clientHeight + "px" ;
118+ foreground . style . top = content_rect . top + "px" ;
119+ foreground . style . left = content_rect . left + "px" ;
120+ foreground . style . width = content . clientWidth + "px" ;
121+ foreground . style . height = content . clientHeight + "px" ;
122122}
123123
124124/*
@@ -130,9 +130,9 @@ function resizeAndPositionTimetableHeaders() {
130130 if ( timetable_headers == null ) return ;
131131 const headers = timetable_headers . children ;
132132
133- const barrier = document . getElementById ( "timetable-barrier " ) ;
134- if ( barrier == null ) return ;
135- const barrier_rect = barrier . getBoundingClientRect ( ) ;
133+ const content = document . getElementById ( "timetable-content " ) ;
134+ if ( content == null ) return ;
135+ const content_rect = content . getBoundingClientRect ( ) ;
136136
137137 for ( let i = 0 ; i < headers . length ; i ++ ) {
138138 const header_id = headers [ i ] . id ;
@@ -145,7 +145,7 @@ function resizeAndPositionTimetableHeaders() {
145145 const col_rect = col . getBoundingClientRect ( ) ;
146146
147147 header . style . top = "0px" ;
148- header . style . left = col_rect . left - barrier_rect . left + "px" ;
148+ header . style . left = col_rect . left - content_rect . left + "px" ;
149149 header . style . width = col_rect . width + "px" ;
150150 }
151151
@@ -167,11 +167,11 @@ function resizeAndPositionTimetableTimeLabels() {
167167 if ( time_col == null ) return ;
168168 const time_col_rect = time_col . getBoundingClientRect ( ) ;
169169
170- const timetable_barrier = document . getElementById ( "timetable-barrier " ) ;
171- if ( timetable_barrier == null ) return ;
172- const barrier_rect = timetable_barrier . getBoundingClientRect ( ) ;
170+ const timetable_content = document . getElementById ( "timetable-content " ) ;
171+ if ( timetable_content == null ) return ;
172+ const content_rect = timetable_content . getBoundingClientRect ( ) ;
173173
174- time_labels . style . top = time_col_rect . top - barrier_rect . top + "px" ;
174+ time_labels . style . top = time_col_rect . top - content_rect . top + "px" ;
175175 time_labels . style . left = "0px" ;
176176
177177 time_labels . style . width = time_col_rect . width + "px" ;
@@ -196,13 +196,13 @@ function resizeAndPositionTimetableSeparator() {
196196 if ( time_header == null ) return ;
197197 const header_rect = time_header . getBoundingClientRect ( ) ;
198198
199- const barrier_rect = document
200- . getElementById ( "timetable-barrier " )
199+ const content_rect = document
200+ . getElementById ( "timetable-content " )
201201 ?. getBoundingClientRect ( ) ;
202- if ( barrier_rect == undefined ) return ;
202+ if ( content_rect == undefined ) return ;
203203
204- separator . style . top = header_rect . top - barrier_rect . top + "px" ;
205- separator . style . left = col_rect . right - barrier_rect . left + "px" ;
204+ separator . style . top = header_rect . top - content_rect . top + "px" ;
205+ separator . style . left = col_rect . right - content_rect . left + "px" ;
206206 separator . style . height = col_rect . height + "px" ;
207207}
208208
@@ -215,16 +215,16 @@ function resizeAndPositionTimetableTaskArea() {
215215 const task_container = document . getElementById ( "timetable-tasks" ) ;
216216 if ( task_container == null ) return ;
217217
218- const barrier_rect = document
219- . getElementById ( "timetable-barrier " )
218+ const content_rect = document
219+ . getElementById ( "timetable-content " )
220220 ?. getBoundingClientRect ( ) ;
221- if ( barrier_rect == undefined ) return ;
221+ if ( content_rect == undefined ) return ;
222222
223223 const visible = getVisibleTimetableRect ( ) ;
224224 if ( visible == undefined ) return ;
225225
226- task_container . style . top = visible . top - barrier_rect . top + "px" ;
227- task_container . style . left = visible . left - barrier_rect . left + "px" ;
226+ task_container . style . top = visible . top - content_rect . top + "px" ;
227+ task_container . style . left = visible . left - content_rect . left + "px" ;
228228 task_container . style . width = visible . width + "px" ;
229229 task_container . style . height = visible . height + "px" ;
230230}
@@ -244,7 +244,7 @@ export function resizeAndPositionTimetableElements() {
244244}
245245
246246/*
247- Sets the vertical scroll of the timetable-barrier to make the current time
247+ Sets the vertical scroll of the timetable-content to make the current time
248248visible.
249249
250250@param align: An optional string argument indicating where the now position
@@ -253,9 +253,9 @@ sets the now position to the center of the visible area, can additionally be
253253specified "top" or "bottom".
254254*/
255255export function scrollToCurrentTime ( align ?: string ) {
256- const timetable_barrier = document . getElementById ( "timetable-barrier " ) ;
257- if ( timetable_barrier == null ) return ;
258- const barrier_rect = timetable_barrier . getBoundingClientRect ( ) ;
256+ const timetable_content = document . getElementById ( "timetable-content " ) ;
257+ if ( timetable_content == null ) return ;
258+ const content_rect = timetable_content . getBoundingClientRect ( ) ;
259259
260260 const visible = getVisibleTimetableRect ( ) ;
261261 if ( visible == undefined ) return ;
@@ -270,14 +270,14 @@ export function scrollToCurrentTime(align?: string) {
270270 let target_top ;
271271 if ( align === "top" ) target_top = visible . top ;
272272 else if ( align === "bottom" ) target_top = visible . bottom ;
273- else target_top = barrier_rect . top + barrier_rect . height / 2 ;
273+ else target_top = content_rect . top + content_rect . height / 2 ;
274274
275275 const scroll_amount = now_top - target_top ;
276- timetable_barrier . scrollTop += scroll_amount ;
276+ timetable_content . scrollTop += scroll_amount ;
277277}
278278
279279/*
280- Sets the horizontal scroll position of the timetable-barrier to display the
280+ Sets the horizontal scroll position of the timetable-content to display the
281281column of the current day positioned in the center/left/right specified by
282282align argument.
283283
@@ -287,8 +287,8 @@ of the visible timetable area. By default center, otherwise can be specified
287287"left" or "right".
288288*/
289289export function scrollToCurrentDay ( align ?: string ) {
290- const timetable_barrier = document . getElementById ( "timetable-barrier " ) ;
291- if ( timetable_barrier == null ) return ;
290+ const timetable_content = document . getElementById ( "timetable-content " ) ;
291+ if ( timetable_content == null ) return ;
292292
293293 const visible = getVisibleTimetableRect ( ) ;
294294 if ( visible == undefined ) return ;
@@ -322,11 +322,11 @@ export function scrollToCurrentDay(align?: string) {
322322 else target_left = visible . left + visible . width / 2 - row_width / 2 ;
323323
324324 const scroll_amount = today_left - target_left ;
325- timetable_barrier . scrollLeft += scroll_amount ;
325+ timetable_content . scrollLeft += scroll_amount ;
326326}
327327
328328/*
329- Scrolls the vertical and horizonal scroll of timetable-barrier to position
329+ Scrolls the vertical and horizonal scroll of timetable-content to position
330330the current time and current day within the visible area of the timetable.
331331
332332Calls scrollToCurrentTime and scrollToCurrentDay.
@@ -369,7 +369,7 @@ function Timetable({ timetable_tasks_props }: TimetableProps) {
369369 className = "h-full w-full rounded-lg bg-slate-900 p-3"
370370 >
371371 < div
372- id = "timetable-barrier "
372+ id = "timetable-content "
373373 className = "h-full w-full overflow-auto overscroll-none"
374374 onScroll = { resizeAndPositionTimetableElements }
375375 >
0 commit comments