回答編集履歴

1

説明 追記

2018/11/17 02:31

投稿

colling
colling

スコア798

test CHANGED
@@ -18,11 +18,11 @@
18
18
 
19
19
  function fillTextLine (context, text, x, y) {
20
20
 
21
- var textList = text.split('\n');
21
+ var textList = text.split('\n');//\nで分割して配列にします。
22
22
 
23
23
  var lineHeight = context.measureText("あ").width;// あ はフォントのサイズを取得するのに利用しているだけです。
24
24
 
25
- textList.forEach(function(text, i) {
25
+ textList.forEach(function(text, i) {//配列を順番に読み出して、y(高さ)を計算しながら描画していきます。
26
26
 
27
27
  context.fillText(text, x, y+lineHeight*i);
28
28