Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TU-Delft
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2024 Competition
TU-Delft
Commits
97477f87
Commit
97477f87
authored
6 months ago
by
Shraddha Raghuram
Browse files
Options
Downloads
Patches
Plain Diff
roadmap
parent
172d8ccb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
static/homepage-roadmap.js
+9
-7
9 additions, 7 deletions
static/homepage-roadmap.js
with
9 additions
and
7 deletions
static/homepage-roadmap.js
+
9
−
7
View file @
97477f87
...
...
@@ -273,11 +273,13 @@ let branchPositions = [600, 1200, 1800, 2400]; // The vertical positions where
let
totalHeight
=
3000
;
// Total height for the vertical line
function
verticalLine
(
x
,
y1
,
y2
,
ctx
)
{
// Draw the vertical line from y1 to the current height y2
ctx
.
moveTo
(
x
,
y1
);
ctx
.
lineTo
(
x
,
y2
);
}
function
circularArc
(
x
,
y
,
ctx
,
typeID
)
{
// Draw arcs for the branches
if
(
typeID
==
1
)
{
ctx
.
arc
(
x
,
y
,
30
,
Math
.
PI
,
Math
.
PI
/
2
,
true
);
// top-left curve
}
...
...
@@ -293,6 +295,7 @@ function circularArc(x, y, ctx, typeID) {
}
function
horizontalLine
(
x1
,
x2
,
y
,
ctx
)
{
// Draw the horizontal lines (branches)
ctx
.
moveTo
(
x1
,
y
);
ctx
.
lineTo
(
x2
,
y
);
}
...
...
@@ -318,7 +321,7 @@ function drawBranch(ctx, index) {
horizontalLine
(
centerX
+
30
,
centerX
+
400
,
2430
,
ctx
);
}
branchesDrawn
[
index
]
=
true
;
branchesDrawn
[
index
]
=
true
;
// Mark the branch as drawn
}
function
draw
()
{
...
...
@@ -337,18 +340,17 @@ function draw() {
ctx
.
lineJoin
=
'
round
'
;
ctx
.
beginPath
();
var
scrTop
=
document
.
documentElement
.
scrollTop
;
// Get the scroll position
var
canvas_h
=
ctx
.
canvas
.
height
;
var
maxLineHeight
=
Math
.
min
(
scrTop
+
window
.
innerHeight
*
0.8
,
totalHeight
);
// Limit vertical line growth to the total height
var
scrTop
=
document
.
documentElement
.
scrollTop
;
// Get the current scroll position
var
maxLineHeight
=
Math
.
min
(
scrTop
+
window
.
innerHeight
*
0.8
,
totalHeight
);
// Limit the growth of the vertical line
// Draw the vertical line
as it
grow
s
with scrolling
// Draw the vertical line
,
grow
ing
with scrolling
var
centerX
=
canvas
.
width
/
2
;
verticalLine
(
centerX
,
200
,
maxLineHeight
,
ctx
);
verticalLine
(
centerX
,
200
,
maxLineHeight
,
ctx
);
// Vertical line grows with scroll
// Draw branches as the user scrolls past their designated positions
branchPositions
.
forEach
((
pos
,
index
)
=>
{
if
(
scrTop
>
pos
-
window
.
innerHeight
*
0.8
&&
!
branchesDrawn
[
index
])
{
drawBranch
(
ctx
,
index
);
drawBranch
(
ctx
,
index
);
// Draw the branch if the user has scrolled past its position
}
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment