Skip to content

Commit 56c5a08

Browse files
committed
Improved display of complexities and control buttons.
1 parent 4d4aff3 commit 56c5a08

10 files changed

+75
-17
lines changed

css/stylesheet.css

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,4 +484,19 @@ input[type=number]::-webkit-inner-spin-button,
484484
input[type=number]::-webkit-outer-spin-button {
485485
-webkit-appearance: none;
486486
margin: 0;
487-
}
487+
}
488+
489+
.complexity {
490+
margin: 10px 0px;
491+
}
492+
.complexity-type {
493+
font-weight: bold;
494+
}
495+
496+
.buttons button.active {
497+
font-weight: bold;
498+
}
499+
500+
.buttons button.active .fa {
501+
color: #76ff03;
502+
}

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ <h3>
3838
</div>
3939
</div>
4040
<button id="btn_run">
41-
<i class="fa fa-play" aria-hidden="true"></i>
41+
<i class="fa fa-play" aria-hidden="true"></i>
4242
<span class="btn-text">Run</span>
4343
</button>
4444
<button id="btn_prev">
45-
<i class="fa fa-chevron-left" aria-hidden="true"></i>
45+
<i class="fa fa-chevron-left" aria-hidden="true"></i>
4646
<span class="btn-text">Prev</span>
4747
</button>
4848
<button id="btn_pause">
@@ -147,4 +147,4 @@ <h3>
147147
</script>
148148
</body>
149149

150-
</html>
150+
</html>

js/dom/setup/setup_top_menu.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,34 @@ module.exports = () => {
2424

2525
// control
2626

27-
$('#btn_run').click(() => {
27+
$('#btn_run').click(function() {
2828
$('#btn_trace').click();
29+
$('#btn_pause').removeClass('active');
30+
$(this).addClass('active');
2931
var err = app.getEditor().execute();
3032
if (err) {
3133
console.error(err);
3234
Toast.showErrorToast(err);
3335
}
3436
});
3537
$('#btn_pause').click(function() {
38+
$('#btn_run').removeClass('active');
39+
$(this).addClass('active');
3640
if (app.getTracerManager().isPause()) {
3741
app.getTracerManager().resumeStep();
3842
} else {
3943
app.getTracerManager().pauseStep();
4044
}
4145
});
4246
$('#btn_prev').click(() => {
47+
$('#btn_run').removeClass('active');
48+
$('#btn_pause').addClass('active');
4349
app.getTracerManager().pauseStep();
4450
app.getTracerManager().prevStep();
4551
});
4652
$('#btn_next').click(() => {
53+
$('#btn_run').removeClass('active');
54+
$('#btn_pause').addClass('active');
4755
app.getTracerManager().pauseStep();
4856
app.getTracerManager().nextStep();
4957
});
@@ -64,4 +72,4 @@ module.exports = () => {
6472
$(this).addClass('active');
6573
});
6674

67-
};
75+
};

js/dom/show_description.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ module.exports = (data) => {
3636
$container.append($ul);
3737

3838
each(value, (prop) => {
39-
$ul.append($('<li>').append($('<strong>').html(prop)).append(` ${value[prop]}`));
39+
const $wrapper = $('<div class="complexity">');
40+
const $type = $('<span class="complexity-type">').html(`${prop}: `);
41+
const $value = $('<span class="complexity-value">').html(`${value[prop]}`);
42+
43+
$wrapper.append($type).append($value);
44+
45+
$ul.append($('<li>').append($wrapper));
4046
});
4147
}
4248
});
43-
};
49+
};

public/algorithm_visualizer.css

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,4 +613,19 @@ input[type=number]::-webkit-inner-spin-button,
613613
input[type=number]::-webkit-outer-spin-button {
614614
-webkit-appearance: none;
615615
margin: 0;
616-
}
616+
}
617+
618+
.complexity {
619+
margin: 10px 0px;
620+
}
621+
.complexity-type {
622+
font-weight: bold;
623+
}
624+
625+
.buttons button.active {
626+
font-weight: bold;
627+
}
628+
629+
.buttons button.active .fa {
630+
color: #76ff03;
631+
}

public/algorithm_visualizer.js

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)