-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhereClick.jQuery.js
50 lines (42 loc) · 1.27 KB
/
whereClick.jQuery.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
var whereClick = {};
whereClick.mouseDown = false;
whereClick.xCords = 0;
whereClick.yCords = 0;
whereClick.color = "red";
whereClick.startDrawing = function(){
if(whereClick.mouseDown){
setTimeout(function(){
$('body').append('<div class="shanes-thing" style="display:block; height: 10px; width: 10px; background: ' + whereClick.color + '; position: absolute; left: ' + whereClick.xCords + 'px; top: ' + whereClick.yCords + 'px; border-radius: 50%"></div>');
whereClick.startDrawing();
}, 1);
}
}
$(document).mousemove(function(event){
whereClick.xCords = event.pageX
whereClick.yCords = event.pageY;
});
$(document).on('click', function(event){
event.preventDefault();
});
$(document).on('mousedown', function(event){
if(event.ctrlKey){
whereClick.color = "blue";
} else if(event.shiftKey){
whereClick.color = "green";
} else {
whereClick.color = "red";
}
whereClick.mouseDown = true;
whereClick.startDrawing();
});
$(document).on('mouseup', function(event){
whereClick.mouseDown = false;
});
$('*').css({
'-webkit-touch-callout': 'none',
'-webkit-user-select': 'none',
'-khtml-user-select': 'none',
'-moz-user-select': 'none',
'-ms-user-select': 'none',
'user-select': 'none'
});