/
bug.html
76 lines (63 loc) · 1.56 KB
/
bug.html
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
<!doctype html>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<div class=wrapper><canvas id=a></canvas></div>
<script>
a.width = innerWidth;
a.height = innerHeight;
c = a.getContext("2d");
onmousemove = ontouchmove = function(e){
xy(e);
a.width = a.width;
c.fillStyle = "blue";
c.fillRect(X, Y, 30, 30);
e.preventDefault();
}
onmouseup = ontouchend = function(e){
e.preventDefault()
}
onmousedown = ontouchstart = function(e){
e.preventDefault();
}
ondrag = onscroll = function(e){
e.preventDefault();
}
onclick = function(e){
e.preventDefault();
}
xy = function(e){
// Mobile
if(e.changedTouches){
var r = a.getBoundingClientRect();
X = e.changedTouches[0].clientX;
Y = e.changedTouches[0].clientY;
}
// Desktop
else{
X = e.pageX;
Y = e.pageY;
}
}
</script>
<style>
/* Make the canvas fullscreen */
.wrapper { cursor: pointer; position: fixed; top: 0; left: 0; }
/* No highlight on mobile */
* {
margin: 0;
padding: 0;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-overflow-scrolling: touch;
overflow: hidden;
overscroll-behavior: none;
}
</style>