From 475fef7323b9f4e8c81ad58bca38194ed68c570d Mon Sep 17 00:00:00 2001 From: Lewis Hemens Date: Mon, 20 Jan 2014 22:10:37 +0000 Subject: [PATCH] Added move tool documentation --- js-lib/draw.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js-lib/draw.js b/js-lib/draw.js index 16d32ff..0c7cca6 100644 --- a/js-lib/draw.js +++ b/js-lib/draw.js @@ -246,6 +246,11 @@ ascii.DrawMove.prototype.end = function(position) { this.state.commitDraw(); }; +/** + * Follows a line in a given direction from the startPosition. + * Returns a list of positions that were line 'junctions'. This is a bit of a + * loose definition, but basically means a point around which we resize things. + */ ascii.DrawMove.prototype.followLine = function(startPosition, direction) { var endPosition = startPosition.clone(); var junctions = []; @@ -257,6 +262,8 @@ ascii.DrawMove.prototype.followLine = function(startPosition, direction) { } endPosition = nextEnd; var context = this.state.getContext(nextEnd); + // TODO: Would be nice to skip over 4 way junctions here, but need to avoid + // clearing them too if we decide to do that. if (!(context.left && context.right && !context.up && !context.down) && !(!context.left && !context.right && context.up && context.down)) { junctions.push(endPosition);