-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsettings.js
83 lines (65 loc) · 1.45 KB
/
settings.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
function touchStarted() {
getAudioContext().state == "running" ? '' : getAudioContext().resume();
state = 1;
}
function touchEnded() {
state = 0;
if (state == -2) {
if (mouseX < width / 2) {
state = 0;
rrr = Math.floor(Math.random() * 100);
} else {
state = -1;
for (var e = 0; e < mm[drawsN].length; e++) {
var dra = new Draw(e, mm[drawsN][e]);
draws[e] = dra;
}
}
}
var t = frameCount;
// addSnapshot(t);
if (touches.length !== 0) {
ts = [];
} else {
ts.push(t);
}
if (ts.length > 2) {
ts.splice(0, 1);
}
if (ts[1] - ts[0] < 12) {
doubleClick = true;
} else {
doubleClick = false;
}
if (doubleClick) {}
}
function keyPressed() {
if (keyCode == 189 || keyCode == 187) {}
}
function addSnapshot(id) {
var dumps = [];
// for(var mm =0; mm<draws.length; mm++){
// var dump = draws[mm].mp.map( function( element )
// {
// return { x : element.x , y : element.y }
// })
// dumps.push(dump);
// }
console.log(dumps);
localStorage.setItem("canvas-" + id, JSON.stringify(dumps))
}
function removeSnapshot(id) {
localStorage.removeItem("canvas-" + id);
}
function getSnapshot(id) {
var canvas = JSON.parse(localStorage.getItem("canvas-" + id));
// var canvas = JSON.parse(myJSON);
return canvas;
}
function resetAllSnapshots() {
localStorage.clear();
}
function windowResized() {
location.reload();
// setup();
}