回答編集履歴

2

コード提示

2019/03/01 16:39

投稿

yu-smc
yu-smc

スコア610

test CHANGED
@@ -15,3 +15,25 @@
15
15
 
16
16
 
17
17
  eはeventの略で、このように書かないと取得できません。
18
+
19
+
20
+
21
+ <追記>
22
+
23
+ ```js
24
+
25
+ //wrong
26
+
27
+ ctx.fillRect = (col * canvas_magnification, row * canvas_magnification,
28
+
29
+ canvas_magnification, canvas_magnification);
30
+
31
+
32
+
33
+ //correct
34
+
35
+ ctx.fillRect(col * canvas_magnification, row * canvas_magnification,
36
+
37
+ canvas_magnification, canvas_magnification);
38
+
39
+ ```

1

misu

2019/03/01 16:39

投稿

yu-smc
yu-smc

スコア610

test CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  document.addEventListener("click", function(e){
4
4
 
5
+ var rect = e.target.getBoundingClientRect();
5
6
 
7
+ mouseX = e.clientX - rect.left;
8
+
9
+ mouseY = e.clientY - rect.top;
6
10
 
7
11
  })
8
12