質問編集履歴
1
mouseDown処理を追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,6 +25,7 @@
|
|
25
25
|
var log = [];
|
26
26
|
|
27
27
|
area.addEventListener('mousedown', function(event){
|
28
|
+
mouseDown = true;
|
28
29
|
position = {
|
29
30
|
x: event.clientX - area.offsetLeft,
|
30
31
|
y: event.clientY - area.offsetTop
|
@@ -32,6 +33,7 @@
|
|
32
33
|
});
|
33
34
|
|
34
35
|
document.addEventListener('mouseup', function(){
|
36
|
+
mouseDown = false;
|
35
37
|
|
36
38
|
if(log.length == 0) return;
|
37
39
|
|
@@ -65,6 +67,7 @@
|
|
65
67
|
});
|
66
68
|
|
67
69
|
document.addEventListener('mousemove', function(event){
|
70
|
+
if(mouseDown !== true) return;
|
68
71
|
var x = event.clientX - area.offsetLeft;
|
69
72
|
var y = event.clientY - area.offsetTop;
|
70
73
|
logPosition(x, y);
|