Skip to content

Commit 2ffef62

Browse files
authored
Minor fixes
1 parent 38c99e3 commit 2ffef62

File tree

1 file changed

+6
-10
lines changed
  • Assignment 6.3/Starter Files

1 file changed

+6
-10
lines changed

Assignment 6.3/Starter Files/main.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,11 @@ function calcPageFillRadius(x, y) {
3535
}
3636

3737
function addClickListeners() {
38-
document.addEventListener("touchstart", handleEvent);
39-
document.addEventListener("mousedown", handleEvent);
38+
document.addEventListener("click", handleEvent);
39+
document.addEventListener("click", handleEvent);
4040
};
4141

4242
function handleEvent(e) {
43-
if (e.touches) {
44-
e.preventDefault();
45-
e = e.touches[0];
46-
}
4743
let currentColor = pickColor.current();
4844
let nextColor = pickColor.next();
4945
let targetR = calcPageFillRadius(e.pageX, e.pageY);
@@ -89,7 +85,7 @@ function handleEvent(e) {
8985

9086

9187
function extend(a, b){
92-
for(var key in b) {
88+
for(let key in b) {
9389
if(b.hasOwnProperty(key)) {
9490
a[key] = b[key];
9591
}
@@ -161,11 +157,11 @@ function handleInactiveUser() {
161157
function clearInactiveTimeout() {
162158
clearTimeout(inactive);
163159
document.removeEventListener("mousedown", clearInactiveTimeout);
164-
document.removeEventListener("touchstart", clearInactiveTimeout);
160+
document.removeEventListener("click", clearInactiveTimeout);
165161
}
166162

167163
document.addEventListener("mousedown", clearInactiveTimeout);
168-
document.addEventListener("touchstart", clearInactiveTimeout);
164+
document.addEventListener("click", clearInactiveTimeout);
169165
}
170166

171167
function startFauxClicking() {
@@ -180,4 +176,4 @@ function NoClick(x, y) {
180176
NoClick.pageX = x;
181177
NoClick.pageY = y;
182178
document.dispatchEvent(NoClick);
183-
}
179+
}

0 commit comments

Comments
 (0)