efficient program to spit out SVG for guitar/uke chord frett diagram
- Fix empty bubble being drawn on cleared canvas.
ChordCharter.drawChord("chordy", 30, 25, "", "111111"); context.clearRect(0, 0, canvas.width, canvas.height); ChordCharter.drawChord("chordy", 30, 25, "", "222222"); now no longer leaves weird empty bubble behind.
Zach DeCook 2017-04-30
parent 8e08e1b · commit dffd1be
-rw-r--r--scripts/ccharter.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/ccharter.js b/scripts/ccharter.js
index 81c2dd4..353c081 100644
--- a/scripts/ccharter.js
+++ b/scripts/ccharter.js
@@ -13,7 +13,10 @@ var ChordCharter = {
var origin = { x: originX, y: originY };
var props = { width: 50, height: 60 };
-
+
+ // Reset previous path that may have been created.
+ ctx.beginPath();
+
// horizontals
for (counter in new Array(0, 1, 2, 3, 4)) {
@@ -96,4 +99,4 @@ var ChordCharter = {
ctx.fillText("3", origin.x - 10, origin.y + 41);
}
}
-}; \ No newline at end of file
+};