clearRect is apparently not perfect. Just clear everything to avoid leaving turds. And fix the markup a bit so that the textarea doesn't float.
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 12 Dec 2008 17:06:59 -0500
changeset 13 51e58ba88e40
parent 12 e50e4b275149
child 14 696ec5de44cc
push id3
push userbsmedberg@mozilla.com
push date2008-12-12 22:07 +0000
clearRect is apparently not perfect. Just clear everything to avoid leaving turds. And fix the markup a bit so that the textarea doesn't float.
wordmap.html
wordmap.js
--- a/wordmap.html
+++ b/wordmap.html
@@ -17,16 +17,17 @@
   &lt;canvas&gt; element</a> and
   JavaScript.
 
   <p>Note: currently requires Firefox 3.1. If you'd like to host it
   yourself, or hack it, <a
   href="http://hg.mozilla.org/users/bsmedberg_mozilla.com/wordmap">get
   the code here</a>.
 
+  <div>
   <textarea id="inputtext" cols="80" rows="10">
 
 Inasmuch as many have undertaken to compile a narrative of the things which have been accomplished among us,
 just as they were delivered to us by those who from the beginning were eyewitnesses and ministers of the word,
 it seemed good to me also, having followed all things closely for some time past, to write an orderly account for you, most excellent The-oph'ilus,
 that you may know the truth concerning the things of which you have been informed.
 
 
@@ -243,27 +244,28 @@ And when they saw him they were astonish
 And he said to them, "How is it that you sought me? Did you not know that I must be in my Father's house?"
 And they did not understand the saying which he spoke to them.
 And he went down with them and came to Nazareth, and was obedient to them; and his mother kept all these things in her heart.
 
 And Jesus increased in wisdom and in stature, and in favor with God
 and man.
 
   </textarea>
+  </div>
   <div>
   <input type="button" onclick="asyncTextMap()" value="Generate
   wordmap from this Text">
   
   <input type="button" value="Wordmap of BSBlog" onclick="asyncFeedMap()">
   Choose a font:
   <input type="text" value="Papyrus, URW Palladio L" id="font" onchange="setFont()">
   </div>
   <div>
+    <input type="button" value="Stop" onclick="cancel()">
     Status: <span id="status"></span>
-    <input type="button" value="Stop" onclick="cancel()">
   </div>
   
   <canvas width="800" height="800" id="cc"
     style="border: 1px solid black; display: block"></canvas>
 
   <canvas width="800" height="800" id="chidden" style="display: none"></canvas>
   <iframe src="about:blank" id="i" style="display: none"></iframe>
 
--- a/wordmap.js
+++ b/wordmap.js
@@ -319,22 +319,22 @@ function drawWord(cx, word, size, vertic
 
     cx.textAlign = 'left';
 
     _go = function() {
       cx.fillText(word, size, size);
     }
   }
 
-  cx.clearRect(0, 0, getw, geth);
+  cx.clearRect(0, 0, kWidth, kHeight);
   cx.shadowBlur = 0;
   _go();
   let noshadow = cx.getImageData(0, 0, getw, geth);
 
-  cx.clearRect(0, 0, getw, geth);
+  cx.clearRect(0, 0, kWidth, kHeight);
   cx.shadowBlur = size / 4;
   _go();
   let shadow = cx.getImageData(0, 0, getw, geth);
 
   return [noshadow, shadow];
 }
 
 function simpletest(cx, imgdata)