Skip to content

Commit 6717b48

Browse files
committed
chore: add comments
1 parent 5442c6a commit 6717b48

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/components/mid-panel/ProgressBar.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class ProgressBar extends React.Component {
3131
handleMouseMove(e) {
3232
e.preventDefault();
3333
let chunkNum;
34+
35+
// how far around mouse on X to look for viewable chunk
3436
let searchRadius = 10;
3537
let rect = this.inner.getBoundingClientRect();
3638
let width = rect.right - rect.left;
@@ -43,6 +45,7 @@ class ProgressBar extends React.Component {
4345
chunkNum = this.max - 1;
4446

4547
} else {
48+
// translate to viewable chunk array index
4649
x = Math.round((x / width) * this.max);
4750
if (x === this.current) {
4851
return;
@@ -70,6 +73,7 @@ class ProgressBar extends React.Component {
7073
}
7174
}
7275

76+
// move to chunk
7377
if (this.viewable[chunkNum]) {
7478
if (chunkNum > this.current) {
7579
this.next({stopAt: chunkNum, playing: false});
@@ -124,6 +128,7 @@ class ProgressBar extends React.Component {
124128
}
125129
}
126130

131+
// set the progress bar body
127132
const setProgress = (ref, val) => {
128133
setTransform(ref, `scaleX(${val})`);
129134
}
@@ -132,6 +137,7 @@ class ProgressBar extends React.Component {
132137
setTransform(ref, `scaleX(${val})`);
133138
}
134139

140+
// set the slider thumb position
135141
const setThumb = (thumb, value) => {
136142
if (thumb !== null) {
137143
const { style } = thumb;

src/context/actions.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ function addLineExplanation(procedurePseudocode) {
211211
}
212212
}
213213

214-
// get the list showing which chunks can be viewed
214+
/**
215+
* Get the array of viewable state of chunks
216+
* @param {object} chunker: current chunker instance
217+
* @param {object} pseudocode: pseudocode of current algorithm
218+
* @param {object} collapse: collapse state of pseudocode
219+
*/
215220
function viewableChunks(chunker, pseudocode, collapse) {
216221
let currChunkNum = 0;
217222
let viewable = Array(chunker.chunks.length).fill(false);

0 commit comments

Comments
 (0)