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
7dd4709d
Commit
7dd4709d
authored
6 months ago
by
Shraddha Raghuram
Browse files
Options
Downloads
Patches
Plain Diff
fix horiontal line function
parent
3d4fe30b
No related branches found
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
+84
-34
84 additions, 34 deletions
static/homepage-roadmap.js
with
84 additions
and
34 deletions
static/homepage-roadmap.js
+
84
−
34
View file @
7dd4709d
...
...
@@ -138,48 +138,98 @@ function horizontalLine(x1, x2, y, ctx, canvas_h, typeID, lineID) {
if
(
typeID
==
1
)
{
if
(
current_line
>=
y
&&
canvas_h
>=
y
){
if
(
canDraw
(
y
-
150
,
y
+
150
))
ctx
.
moveTo
(
x1
,
y
);
if
(
canDraw
(
y
-
150
,
y
+
150
)
&&
x1
!=
lines
[
lineID
])
ctx
.
lineTo
(
lines
[
lineID
],
y
);
if
(
lines
[
lineID
]
<
x2
){
lines
[
lineID
]
+=
10
;
}
if
(
lines
[
lineID
]
<
x2
){
setTimeout
(
"
draw()
"
,
120
);
}
}
if
(
canvas_h
<
y
&&
lines
[
lineID
]
>
x1
&&
current_line
==
y
){
if
(
canDraw
(
y
-
150
,
y
+
150
))
ctx
.
moveTo
(
x1
,
y
);
if
(
canDraw
(
y
-
150
,
y
+
150
)
&&
x1
!=
lines
[
lineID
])
ctx
.
lineTo
(
lines
[
lineID
],
y
);
if
(
lines
[
lineID
]
>
x1
){
lines
[
lineID
]
-=
10
;
}
if
(
lines
[
lineID
]
>
x1
){
setTimeout
(
"
draw()
"
,
80
);
}
if
(
canDraw
(
y
-
150
,
y
+
150
))
ctx
.
lineTo
(
x2
,
y
);
// Ensure line ends at x2
// Remove or comment out these lines to prevent the branches from extending
// if (lines[lineID] < x2){
// lines[lineID] += 10;
// }
// if (lines[lineID] < x2){
// setTimeout("draw()", 120);
// }
}
// Remove or comment out these lines to avoid extending in reverse scroll
// if (canvas_h < y && lines[lineID] > x1 && current_line == y){
// if (canDraw(y - 150, y + 150)) ctx.moveTo(x1, y);
// if (canDraw(y - 150, y + 150) && x1 != lines[lineID]) ctx.lineTo(lines[lineID], y);
// if (lines[lineID] > x1){
// lines[lineID] -= 10;
// }
// if (lines[lineID] > x1){
// setTimeout("draw()", 80);
// }
// }
}
else
if
(
typeID
==
2
)
{
if
(
current_line
>=
y
&&
canvas_h
>=
y
){
if
(
canDraw
(
y
-
150
,
y
+
150
))
ctx
.
moveTo
(
x1
,
y
);
if
(
canDraw
(
y
-
150
,
y
+
150
)
&&
x1
!=
lines
[
lineID
])
ctx
.
lineTo
(
lines
[
lineID
],
y
);
if
(
lines
[
lineID
]
>
x2
){
lines
[
lineID
]
-=
10
;
}
if
(
lines
[
lineID
]
>
x2
){
setTimeout
(
"
draw()
"
,
120
);
}
}
if
(
canvas_h
<
y
&&
lines
[
lineID
]
<
x1
&&
current_line
==
y
){
if
(
canDraw
(
y
-
150
,
y
+
150
))
ctx
.
moveTo
(
x1
,
y
);
if
(
canDraw
(
y
-
150
,
y
+
150
)
&&
x1
!=
lines
[
lineID
])
ctx
.
lineTo
(
lines
[
lineID
],
y
);
if
(
lines
[
lineID
]
<
x1
){
lines
[
lineID
]
+=
10
;
}
if
(
lines
[
lineID
]
<
x1
){
setTimeout
(
"
draw()
"
,
80
);
}
if
(
canDraw
(
y
-
150
,
y
+
150
))
ctx
.
lineTo
(
x2
,
y
);
// Ensure line ends at x2
// Remove or comment out these lines to prevent the branches from extending
// if (lines[lineID] > x2){
// lines[lineID] -= 10;
// }
// if (lines[lineID] > x2){
// setTimeout("draw()", 120);
// }
}
// Remove or comment out these lines to avoid extending in reverse scroll
// if (canvas_h < y && lines[lineID] < x1 && current_line == y){
// if (canDraw(y - 150, y + 150)) ctx.moveTo(x1, y);
// if (canDraw(y - 150, y + 150) && x1 != lines[lineID]) ctx.lineTo(lines[lineID], y);
// if (lines[lineID] < x1){
// lines[lineID] += 10;
// }
// if (lines[lineID] < x1){
// setTimeout("draw()", 80);
// }
// }
}
}
// function horizontalLine(x1, x2, y, ctx, canvas_h, typeID, lineID) {
// if (typeID == 1) {
// if (current_line >= y && canvas_h >= y){
// if (canDraw(y - 150, y + 150)) ctx.moveTo(x1, y);
// if (canDraw(y - 150, y + 150) && x1 != lines[lineID]) ctx.lineTo(lines[lineID], y);
// if (lines[lineID] < x2){
// lines[lineID] += 10;
// }
// if (lines[lineID] < x2){
// setTimeout("draw()", 120);
// }
// }
// if (canvas_h < y && lines[lineID] > x1 && current_line == y){
// if (canDraw(y - 150, y + 150)) ctx.moveTo(x1, y);
// if (canDraw(y - 150, y + 150) && x1 != lines[lineID]) ctx.lineTo(lines[lineID], y);
// if (lines[lineID] > x1){
// lines[lineID] -= 10;
// }
// if (lines[lineID] > x1){
// setTimeout("draw()", 80);
// }
// }
// }
// else if (typeID == 2) {
// if (current_line >= y && canvas_h >= y){
// if (canDraw(y - 150, y + 150)) ctx.moveTo(x1, y);
// if (canDraw(y - 150, y + 150) && x1 != lines[lineID]) ctx.lineTo(lines[lineID], y);
// if (lines[lineID] > x2){
// lines[lineID] -= 10;
// }
// if (lines[lineID] > x2){
// setTimeout("draw()", 120);
// }
// }
// if (canvas_h < y && lines[lineID] < x1 && current_line == y){
// if (canDraw(y - 150, y + 150)) ctx.moveTo(x1, y);
// if (canDraw(y - 150, y + 150) && x1 != lines[lineID]) ctx.lineTo(lines[lineID], y);
// if (lines[lineID] < x1){
// lines[lineID] += 10;
// }
// if (lines[lineID] < x1){
// setTimeout("draw()", 80);
// }
// }
// }
// }
function
draw
(){
/** @type {HTMLCanvasElement} */
let
scrTop
=
document
.
documentElement
.
scrollTop
;
...
...
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