Skip to content

Commit 96a7c5f

Browse files
author
Kenneth Apeland
committed
la til timeout for backwards slik at det ikke er bugs + sletting av filer
1 parent 8b3e19b commit 96a7c5f

34 files changed

+321
-33741
lines changed

.idea/workspace.xml

+242-330
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Graphs/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
<button id="reset" class="btn btn-primary" onclick="resetAll();">Reset</button>
3232
<br>
3333
<br>
34-
<button id="backward" class="btn btn-primary" onclick="manager.previous();">Previous</button>
35-
<button id="forward" class="btn btn-primary" onclick="manager.next();">Next</button>
34+
<button id="backward" class="btn btn-primary" onclick="stepBackwards();">Previous</button>
35+
<button id="forward" class="btn btn-primary" onclick="stepForward();">Next</button>
3636
<button id="Test1" class="btn btn-primary" onclick="exampleGraphStar();">Example1</button>
3737
<button id="Test2" class="btn btn-primary" onclick="exampleGraphAllConnected();">Example2</button>
3838
<br>

Graphs/js/dfsBfsController.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,10 @@ function dfs(v) {
124124
if (visited[adjacent[i]])
125125
continue;
126126
setHighlightEdge(getEdgeId(v, adjacent[i]), true, color[i]);
127-
console.log(color);
128127
color[i] = true;
129128
dfs(adjacent[i]);
130129
setHighlightEdge(getEdgeId(v, adjacent[i]), false, color[i]);
131130
color[i] = false;
132-
console.log(color);
133131
visit(v);
134132
}
135133
}
@@ -218,3 +216,17 @@ function expandAdjacencyList(index) {
218216
}
219217
$("#adjList" + index).animate({ left: 65 }, 350);
220218
}
219+
function stepForward() {
220+
$('#forward').attr('disabled', 'disabled');
221+
manager.next();
222+
setTimeout(function () {
223+
$('#forward').removeAttr('disabled');
224+
}, 350);
225+
}
226+
function stepBackwards() {
227+
$('#backward').attr('disabled', 'disabled');
228+
manager.previous();
229+
setTimeout(function () {
230+
$('#backward').removeAttr('disabled');
231+
}, 350);
232+
}

Graphs/js/dfsBfsController.ts

+16
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,20 @@ function expandAdjacencyList(index: number) {
244244
}
245245

246246
$("#adjList" + index).animate({left: 65}, 350);
247+
}
248+
249+
function stepForward() {
250+
$('#forward').attr('disabled', 'disabled');
251+
manager.next();
252+
setTimeout(function () {
253+
$('#forward').removeAttr('disabled');
254+
}, 350);
255+
}
256+
257+
function stepBackwards() {
258+
$('#backward').attr('disabled', 'disabled');
259+
manager.previous();
260+
setTimeout(function () {
261+
$('#backward').removeAttr('disabled');
262+
}, 350);
247263
}

Heap/js/View.js

+8
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ var View = /** @class */ (function () {
6464
return;
6565
if (control.getAlgoName() === "MaxHeapFree" || control.getAlgoName() === "MaxHeap")
6666
this.setPause(true);
67+
$('#forward').attr('disabled', 'disabled');
68+
setTimeout(function () {
69+
$('#forward').removeAttr('disabled');
70+
}, 350);
6771
this.clickedPlay = false;
6872
manager.next();
6973
};
@@ -77,8 +81,12 @@ var View = /** @class */ (function () {
7781
firstSelected = -1;
7882
}
7983
else {
84+
$('#backward').attr('disabled', 'disabled');
8085
lockPlay(false);
8186
manager.previous();
87+
setTimeout(function () {
88+
$('#backward').removeAttr('disabled');
89+
}, 350);
8290
}
8391
};
8492
View.prototype.resetAll = function () {

Heap/js/View.ts

+9
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ class View {
7979
if (control.getAlgoName() === "MaxHeapFree" || control.getAlgoName() === "MaxHeap")
8080
this.setPause(true);
8181

82+
$('#forward').attr('disabled', 'disabled');
83+
setTimeout(function () {
84+
$('#forward').removeAttr('disabled');
85+
}, 350);
86+
8287
this.clickedPlay = false;
8388
manager.next();
8489
}
@@ -92,8 +97,12 @@ class View {
9297
selectIndex(firstSelected, false);
9398
firstSelected = -1;
9499
} else {
100+
$('#backward').attr('disabled', 'disabled');
95101
lockPlay(false);
96102
manager.previous();
103+
setTimeout(function () {
104+
$('#backward').removeAttr('disabled');
105+
}, 350);
97106
}
98107
}
99108

MergeSort/assets/pause.png

-2.17 KB
Binary file not shown.

MergeSort/assets/up_arrow.png

-294 Bytes
Binary file not shown.

MergeSort/index.html

-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ <h1 id="header">MergeSort</h1>
2727
<ul id='arrayUl' class='insElements'>
2828
<img id="leftBracket" class="bracket" src="assets/square_left.png"/>
2929
<img id="rightBracket" class="bracket" src="assets/square_right.png"/>
30-
<div id="leftArrow" class="arrow hidden"><img src="assets/up_arrow.png"/>
31-
<div class="arrowText"></div>
32-
</div>
3330
</ul>
3431
</div>
3532

MergeSort/js/View.js

+4
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ var view = /** @class */ (function () {
147147
manager.next();
148148
};
149149
view.prototype.backward = function () {
150+
$('#backward').attr('disabled', 'disabled');
150151
manager.previous();
152+
setTimeout(function () {
153+
$('#backward').removeAttr('disabled');
154+
}, 300);
151155
};
152156
view.prototype.slow = function () {
153157
manager.slow();

MergeSort/js/View.ts

+8
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,19 @@ class view {
177177
}
178178

179179
forward() {
180+
$('#forward').attr('disabled', 'disabled');
180181
manager.next();
182+
setTimeout(function () {
183+
$('#forward').removeAttr('disabled');
184+
}, 350);
181185
}
182186

183187
backward() {
188+
$('#backward').attr('disabled', 'disabled');
184189
manager.previous();
190+
setTimeout(function () {
191+
$('#backward').removeAttr('disabled');
192+
}, 350);
185193
}
186194

187195
slow() {

MergeSort/js/bootstrap.min.js

-7
This file was deleted.

0 commit comments

Comments
 (0)