質問編集履歴
1
mouseDown処理を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -52,6 +52,8 @@
|
|
52
52
|
|
53
53
|
area.addEventListener('mousedown', function(event){
|
54
54
|
|
55
|
+
mouseDown = true;
|
56
|
+
|
55
57
|
position = {
|
56
58
|
|
57
59
|
x: event.clientX - area.offsetLeft,
|
@@ -65,6 +67,8 @@
|
|
65
67
|
|
66
68
|
|
67
69
|
document.addEventListener('mouseup', function(){
|
70
|
+
|
71
|
+
mouseDown = false;
|
68
72
|
|
69
73
|
|
70
74
|
|
@@ -132,6 +136,8 @@
|
|
132
136
|
|
133
137
|
document.addEventListener('mousemove', function(event){
|
134
138
|
|
139
|
+
if(mouseDown !== true) return;
|
140
|
+
|
135
141
|
var x = event.clientX - area.offsetLeft;
|
136
142
|
|
137
143
|
var y = event.clientY - area.offsetTop;
|