Skip to content

Commit a112328

Browse files
committed
Har fikset pause og hastighet i ports + død kode
1 parent dae11f4 commit a112328

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

SimpleSort/css/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ img.bracket {
7373
}
7474

7575
img#leftBracket {
76-
left: 20px;
76+
left: 150px;
7777
}
7878

7979
img#rightBracket {
80-
left: 1110px;
80+
left: 980px;
8181
}
8282

8383
img#paused {

SimpleSort/js/InsertionSort.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var n = 10;
1111
* Check if an algorithm is already running - if that is the case reset the view
1212
*/
1313
function checkIfAlreadyRunning() {
14+
k.hide();
1415
var arr = setRandomArray();
1516
setArray(viewer.serializeArray(arr));
1617
manager.clear();
@@ -21,7 +22,6 @@ function checkIfAlreadyRunning() {
2122
*/
2223
function startInsertionSort() {
2324
checkIfAlreadyRunning();
24-
viewer.setPause();
2525
control.hideK();
2626
control.setHeadText("Insertion Sort");
2727
var j; // Elements sorted, starting on second position
@@ -45,7 +45,6 @@ function startInsertionSort() {
4545
control.setJElement(i + 1, false);
4646
control.setElementBeingComparedTo(j - 1, false);
4747
}
48-
manager.start();
4948
}
5049
function startShellSort() {
5150
checkIfAlreadyRunning();
@@ -79,7 +78,6 @@ function startShellSort() {
7978
control.setKValue(k);
8079
}
8180
control.hideK();
82-
manager.start();
8381
}
8482
/**
8583
* Fill the array with random integers

SimpleSort/js/InsertionSort.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const n = 10;
1414
* Check if an algorithm is already running - if that is the case reset the view
1515
*/
1616
function checkIfAlreadyRunning() {
17-
17+
k.hide();
1818
let arr = setRandomArray();
1919
setArray(viewer.serializeArray(arr));
2020
manager.clear();
@@ -26,7 +26,6 @@ function checkIfAlreadyRunning() {
2626
*/
2727
function startInsertionSort() {
2828
checkIfAlreadyRunning();
29-
viewer.setPause();
3029
control.hideK();
3130
control.setHeadText("Insertion Sort");
3231
let j: number; // Elements sorted, starting on second position
@@ -50,7 +49,6 @@ function startInsertionSort() {
5049
control.setJElement(i + 1, false);
5150
control.setElementBeingComparedTo(j - 1, false);
5251
}
53-
manager.start();
5452
}
5553

5654
function startShellSort() {
@@ -91,7 +89,6 @@ function startShellSort() {
9189
control.setKValue(k);
9290
}
9391
control.hideK();
94-
manager.start()
9592
}
9693

9794
/**

SimpleSort/js/fillWithListElements.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function setArray(serializedArray) {
77
$("#arrayUl li, #indices p").each(function () {
88
$(this).remove();
99
});
10+
$("#arrayUl").remove();
1011
// Insert new elements
1112
array = serializedArray.split('|'); // Deserialize array
1213
$("#array").append("<ul id='arrayUl' class='insElements'></ul>"); // TODO: this adds arrayUl without deleting it

SimpleSort/js/fillWithListElements.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function setArray(serializedArray: any) {
88
$("#arrayUl li, #indices p").each(function () {
99
$(this).remove();
1010
});
11+
$("#arrayUl").remove();
1112
// Insert new elements
1213
array = serializedArray.split('|'); // Deserialize array
1314
$("#array").append("<ul id='arrayUl' class='insElements'></ul>"); // TODO: this adds arrayUl without deleting it

0 commit comments

Comments
 (0)