Add support for column annotations
authorKris Kowal <kris.kowal@cixar.com>
Sat, 11 Apr 2015 22:47:46 +0000 (15:47 -0700)
committerKris Kowal <kris.kowal@cixar.com>
Sat, 11 Apr 2015 22:47:46 +0000 (15:47 -0700)
column.js

index 5850d01..d25dd7d 100644 (file)
--- a/column.js
+++ b/column.js
@@ -1,10 +1,10 @@
 
 module.exports = makeColumn;
-function makeColumn(font, tengwa) {
-    return new Column(font, tengwa);
+function makeColumn(font, tengwa, tengwaNote) {
+    return new Column(font, tengwa, tengwaNote);
 };
 
-var Column = function (font, tengwa) {
+var Column = function (font, tengwa, tengwaNote) {
     this.font = font;
     this.above = void 0;
     this.tildeAbove = void 0;
@@ -13,6 +13,13 @@ var Column = function (font, tengwa) {
     this.below = void 0;
     this.following = void 0;
     this.error = void 0;
+
+    this.aboveNote = void 0;
+    this.tildeAboveNote = void 0;
+    this.tengwaNote = tengwaNote;
+    this.tildeBelowNote = void 0;
+    this.belowNote = void 0;
+    this.followingNote = void 0;
 };
 
 Column.prototype.canAddAbove = function (tehta, reversed) {
@@ -23,11 +30,12 @@ Column.prototype.canAddAbove = function (tehta, reversed) {
     );
 };
 
-Column.prototype.addAbove = function (above) {
+Column.prototype.addAbove = function (above, aboveNote) {
     if (!this.font.tehtaForTengwa(this.tengwa, above)) {
         this.reverse();
     }
     this.above = above;
+    this.aboveNote = aboveNote;
     return this;
 };
 
@@ -39,21 +47,24 @@ Column.prototype.canAddBelow = function (tehta, reversed) {
     );
 };
 
-Column.prototype.addBelow = function (below) {
+Column.prototype.addBelow = function (below, belowNote) {
     if (!this.font.tehtaForTengwa(this.tengwa, below)) {
         this.reverse();
     }
     this.below = below;
+    this.belowNote = belowNote;
     return this;
 };
 
-Column.prototype.addTildeAbove = function () {
+Column.prototype.addTildeAbove = function (tildeAboveNote) {
     this.tildeAbove = true;
+    this.tildeAboveNote = tildeAboveNote;
     return this;
 };
 
-Column.prototype.addTildeBelow = function () {
+Column.prototype.addTildeBelow = function (tildeBelowNote) {
     this.tildeBelow = true;
+    this.tildeBelowNote = tildeBelowNote;
     return this;
 };
 
@@ -61,8 +72,9 @@ Column.prototype.canAddFollowing = function (following) {
     return !this.following && !!this.font.tehtaForTengwa(this.tengwa, following);
 };
 
-Column.prototype.addFollowing = function (following) {
+Column.prototype.addFollowing = function (following, followingNote) {
     this.following = following;
+    this.followingNote = followingNote;
     return this;
 };
 
@@ -72,11 +84,11 @@ Column.prototype.reversed = function () {
 
 Column.prototype.clone = function () {
     var column = new Column(this.font, this.tengwa);
-    if (this.above) column.addAbove(this.above);
-    if (this.below) column.addBelow(this.below);
-    if (this.following) column.addFollowing(this.following);
-    if (this.tildeBelow) column.addTildeBelow();
-    if (this.tildeAbove) column.addTildeAbove();
+    if (this.above) column.addAbove(this.above, this.aboveNote);
+    if (this.below) column.addBelow(this.below, this.belowNote);
+    if (this.following) column.addFollowing(this.following, this.followingNote);
+    if (this.tildeBelow) column.addTildeBelow(this.tildeBelowNote);
+    if (this.tildeAbove) column.addTildeAbove(this.tildeAboveNote);
     return column;
 };