Skip to content

Commit 56081fd

Browse files
author
Kenneth Apeland
committed
Merge branch 'master' of https://github.com/kennidenni/INF219
2 parents 171aa5a + 6a74d10 commit 56081fd

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Heap/js/View.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,22 @@ var View = /** @class */ (function () {
113113
}
114114
};
115115
View.prototype.setSlow = function () {
116-
manager.delayTime = 1500;
116+
manager.delayTime = 2000;
117117
this.restartManager();
118118
};
119119
View.prototype.setMedium = function () {
120-
manager.delayTime = 1000;
120+
manager.delayTime = 1200;
121121
this.restartManager();
122122
};
123123
View.prototype.setFast = function () {
124124
manager.delayTime = 600;
125125
this.restartManager();
126126
};
127127
View.prototype.restartManager = function () {
128-
manager.pause();
129-
manager.start();
128+
if (this.playing) {
129+
manager.pause();
130+
manager.start();
131+
}
130132
};
131133
View.prototype.switchAlgorithm = function (algo) {
132134
$("#sortArray").hide();

Heap/js/View.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ class View {
131131
}
132132

133133
setSlow() {
134-
manager.delayTime = 1500;
134+
manager.delayTime = 2000;
135135
this.restartManager();
136136
}
137137

138138
setMedium() {
139-
manager.delayTime = 1000;
139+
manager.delayTime = 1200;
140140
this.restartManager();
141141
}
142142

@@ -146,8 +146,10 @@ class View {
146146
}
147147

148148
restartManager() {
149-
manager.pause();
150-
manager.start();
149+
if (this.playing) {
150+
manager.pause();
151+
manager.start();
152+
}
151153
}
152154

153155
switchAlgorithm(algo: string) {

0 commit comments

Comments
 (0)