2014-01-19 14:23:17 +00:00
|
|
|
/**
|
|
|
|
* All drawing classes and functions.
|
2014-01-18 00:28:46 +00:00
|
|
|
*/
|
|
|
|
|
2014-01-19 14:23:17 +00:00
|
|
|
/**
|
|
|
|
* Draws a line on the diagram state.
|
|
|
|
*
|
|
|
|
* @param {ascii.State} state
|
|
|
|
* @param {ascii.Vector} startPosition
|
|
|
|
* @param {ascii.Vector} endPosition
|
|
|
|
* @param {boolean} clockwise
|
|
|
|
* @param {string=} opt_value
|
2014-01-18 00:41:38 +00:00
|
|
|
*/
|
2014-01-19 14:23:17 +00:00
|
|
|
function drawLine(state, startPosition, endPosition, clockwise, opt_value) {
|
|
|
|
var value = opt_value || SPECIAL_VALUE;
|
|
|
|
|
2014-01-20 21:58:25 +00:00
|
|
|
var startX = Math.min(startPosition.x, endPosition.x);
|
|
|
|
var startY = Math.min(startPosition.y, endPosition.y);
|
|
|
|
var endX = Math.max(startPosition.x, endPosition.x);
|
|
|
|
var endY = Math.max(startPosition.y, endPosition.y);
|
2014-01-18 00:41:38 +00:00
|
|
|
|
2014-01-20 21:58:25 +00:00
|
|
|
var midX = clockwise ? endPosition.x : startPosition.x;
|
|
|
|
var midY = clockwise ? startPosition.y : endPosition.y;
|
2014-01-18 00:41:38 +00:00
|
|
|
|
2014-02-09 18:19:47 +00:00
|
|
|
while (startX++ < endX) {
|
2014-02-09 18:00:55 +00:00
|
|
|
var position = new ascii.Vector(startX, midY);
|
2014-02-09 18:19:47 +00:00
|
|
|
var context = state.getContext(new ascii.Vector(startX, midY));
|
|
|
|
// Don't erase any lines that we cross.
|
|
|
|
if (value != ' ' || context.up + context.down != 2) {
|
|
|
|
state.drawValueIncremental(position, value);
|
|
|
|
}
|
2014-01-18 00:41:38 +00:00
|
|
|
}
|
2014-01-20 21:58:25 +00:00
|
|
|
while (startY++ < endY) {
|
2014-02-09 18:00:55 +00:00
|
|
|
var position = new ascii.Vector(midX, startY);
|
2014-02-09 18:19:47 +00:00
|
|
|
var context = state.getContext(new ascii.Vector(midX, startY));
|
|
|
|
// Don't erase any lines that we cross.
|
|
|
|
if (value != ' ' || context.left + context.right != 2) {
|
|
|
|
state.drawValueIncremental(position, value);
|
|
|
|
}
|
2014-01-18 00:41:38 +00:00
|
|
|
}
|
2014-02-09 18:00:55 +00:00
|
|
|
|
2014-01-19 14:23:17 +00:00
|
|
|
state.drawValue(startPosition, value);
|
|
|
|
state.drawValue(endPosition, value);
|
2014-02-09 18:00:55 +00:00
|
|
|
state.drawValueIncremental(new ascii.Vector(midX, midY), value);
|
2014-01-19 14:23:17 +00:00
|
|
|
}
|
2014-01-18 00:41:38 +00:00
|
|
|
|
2014-01-12 16:51:16 +00:00
|
|
|
/**
|
|
|
|
* Common interface for different drawing functions, e.g. box, line, etc.
|
|
|
|
* @interface
|
|
|
|
*/
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawFunction = function() {};
|
2014-01-12 16:51:16 +00:00
|
|
|
/** Start of drawing. @param {ascii.Vector} position */
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawFunction.prototype.start = function(position) {};
|
2014-01-12 16:51:16 +00:00
|
|
|
/** Drawing move. @param {ascii.Vector} position */
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawFunction.prototype.move = function(position) {};
|
2014-01-12 16:51:16 +00:00
|
|
|
/** End of drawing. @param {ascii.Vector} position */
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawFunction.prototype.end = function(position) {};
|
2014-01-20 21:36:58 +00:00
|
|
|
/** Cursor for given cell.
|
|
|
|
* @param {ascii.Vector} position
|
|
|
|
* @return {string}
|
|
|
|
*/
|
|
|
|
ascii.DrawFunction.prototype.getCursor = function(position) {};
|
2014-01-20 23:58:33 +00:00
|
|
|
/** Handle the key with given value being pressed. @param {string} value */
|
|
|
|
ascii.DrawFunction.prototype.handleKey = function(value) {};
|
2014-01-12 16:51:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
2014-01-19 14:23:17 +00:00
|
|
|
* @implements {ascii.DrawFunction}
|
2014-01-12 16:51:16 +00:00
|
|
|
* @param {ascii.State} state
|
|
|
|
*/
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawBox = function(state) {
|
2014-01-12 16:51:16 +00:00
|
|
|
this.state = state;
|
|
|
|
/** @type {ascii.Vector} */ this.startPosition = null;
|
2014-01-19 14:23:17 +00:00
|
|
|
};
|
2014-01-12 16:51:16 +00:00
|
|
|
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawBox.prototype.start = function(position) {
|
2014-01-12 16:51:16 +00:00
|
|
|
this.startPosition = position;
|
|
|
|
};
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawBox.prototype.move = function(position) {
|
2014-01-12 16:51:16 +00:00
|
|
|
this.endPosition = position;
|
|
|
|
this.state.clearDraw();
|
2014-01-18 00:28:46 +00:00
|
|
|
drawLine(this.state, this.startPosition, position, true);
|
|
|
|
drawLine(this.state, this.startPosition, position, false);
|
2014-01-12 16:51:16 +00:00
|
|
|
};
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawBox.prototype.end = function(position) {
|
2014-01-12 16:51:16 +00:00
|
|
|
this.state.commitDraw();
|
|
|
|
};
|
2014-01-20 21:36:58 +00:00
|
|
|
ascii.DrawBox.prototype.getCursor = function(position) {
|
|
|
|
return 'crosshair';
|
|
|
|
};
|
2014-01-20 23:58:33 +00:00
|
|
|
ascii.DrawBox.prototype.handleKey = function(value) {};
|
2014-01-12 16:51:16 +00:00
|
|
|
|
2014-01-12 19:08:29 +00:00
|
|
|
/**
|
|
|
|
* @constructor
|
2014-01-19 14:23:17 +00:00
|
|
|
* @implements {ascii.DrawFunction}
|
2014-01-12 19:08:29 +00:00
|
|
|
* @param {ascii.State} state
|
|
|
|
*/
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawLine = function(state) {
|
2014-01-12 19:08:29 +00:00
|
|
|
this.state = state;
|
|
|
|
/** @type {ascii.Vector} */ this.startPosition = null;
|
2014-01-19 14:23:17 +00:00
|
|
|
};
|
2014-01-12 19:08:29 +00:00
|
|
|
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawLine.prototype.start = function(position) {
|
2014-01-12 19:08:29 +00:00
|
|
|
this.startPosition = position;
|
|
|
|
};
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawLine.prototype.move = function(position) {
|
2014-01-12 19:08:29 +00:00
|
|
|
this.state.clearDraw();
|
2014-01-18 00:28:46 +00:00
|
|
|
|
|
|
|
// Try to infer line orientation.
|
2014-01-19 14:23:17 +00:00
|
|
|
// TODO: Split the line into two lines if we can't satisfy both ends.
|
2014-01-18 00:28:46 +00:00
|
|
|
var startContext = this.state.getContext(this.startPosition);
|
|
|
|
var endContext = this.state.getContext(position);
|
|
|
|
var clockwise = (startContext.up && startContext.down) ||
|
|
|
|
(endContext.left && endContext.right);
|
|
|
|
|
|
|
|
drawLine(this.state, this.startPosition, position, clockwise);
|
2014-01-12 19:08:29 +00:00
|
|
|
};
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawLine.prototype.end = function(position) {
|
2014-01-12 19:08:29 +00:00
|
|
|
this.state.commitDraw();
|
|
|
|
};
|
2014-01-20 21:36:58 +00:00
|
|
|
ascii.DrawLine.prototype.getCursor = function(position) {
|
|
|
|
return 'crosshair';
|
|
|
|
};
|
2014-01-20 23:58:33 +00:00
|
|
|
ascii.DrawLine.prototype.handleKey = function(value) {};
|
2014-01-12 19:08:29 +00:00
|
|
|
|
2014-01-12 16:51:16 +00:00
|
|
|
/**
|
|
|
|
* @constructor
|
2014-01-19 14:23:17 +00:00
|
|
|
* @implements {ascii.DrawFunction}
|
2014-01-12 16:51:16 +00:00
|
|
|
* @param {ascii.State} state
|
2014-01-13 23:17:02 +00:00
|
|
|
* @param {?string} value
|
2014-01-12 16:51:16 +00:00
|
|
|
*/
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawFreeform = function(state, value) {
|
2014-01-12 16:51:16 +00:00
|
|
|
this.state = state;
|
2014-01-13 23:17:02 +00:00
|
|
|
this.value = value;
|
2014-01-19 14:23:17 +00:00
|
|
|
};
|
2014-01-12 16:51:16 +00:00
|
|
|
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawFreeform.prototype.start = function(position) {
|
2014-01-20 21:58:25 +00:00
|
|
|
this.state.drawValue(position, this.value);
|
2014-01-12 16:51:16 +00:00
|
|
|
};
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawFreeform.prototype.move = function(position) {
|
2014-01-20 21:58:25 +00:00
|
|
|
this.state.drawValue(position, this.value);
|
2014-01-12 16:51:16 +00:00
|
|
|
};
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawFreeform.prototype.end = function(position) {
|
2014-01-20 21:58:25 +00:00
|
|
|
this.state.commitDraw();
|
2014-01-12 16:51:16 +00:00
|
|
|
};
|
2014-01-20 21:36:58 +00:00
|
|
|
ascii.DrawFreeform.prototype.getCursor = function(position) {
|
|
|
|
return 'crosshair';
|
|
|
|
};
|
2014-01-22 22:57:33 +00:00
|
|
|
ascii.DrawFreeform.prototype.handleKey = function(value) {
|
|
|
|
if (value.length == 1) {
|
|
|
|
// The value is not a special character, so lets use it.
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
};
|
2014-01-20 23:58:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
* @implements {ascii.DrawFunction}
|
|
|
|
* @param {ascii.State} state
|
|
|
|
*/
|
|
|
|
ascii.DrawText = function(state) {
|
|
|
|
this.state = state;
|
|
|
|
this.startPosition = null;
|
|
|
|
this.currentPosition = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
ascii.DrawText.prototype.start = function(position) {
|
|
|
|
this.startPosition = position;
|
|
|
|
this.currentPosition = position;
|
|
|
|
// Clean up any existing draws.
|
|
|
|
this.state.clearDraw();
|
|
|
|
// Effectively highlights the starting cell.
|
|
|
|
var currentValue = this.state.getCell(position).getRawValue();
|
2014-02-09 18:19:47 +00:00
|
|
|
this.state.drawValue(position, currentValue == null ? ERASE_CHAR : currentValue);
|
2014-01-20 23:58:33 +00:00
|
|
|
};
|
|
|
|
ascii.DrawText.prototype.move = function(position) {};
|
|
|
|
ascii.DrawText.prototype.end = function(position) {};
|
|
|
|
ascii.DrawText.prototype.getCursor = function(position) {
|
|
|
|
return 'text';
|
|
|
|
};
|
|
|
|
ascii.DrawText.prototype.handleKey = function(value) {
|
|
|
|
if (this.currentPosition == null) {
|
|
|
|
return;
|
|
|
|
}
|
2014-01-21 21:30:47 +00:00
|
|
|
var nextPosition = this.currentPosition.add(new ascii.Vector(1, 0));
|
|
|
|
|
|
|
|
if (value == KEY_RETURN || this.state.getCell(nextPosition).isSpecial()) {
|
|
|
|
// Pressed return key or hit box, so clear this cell and new line.
|
2014-01-20 23:58:33 +00:00
|
|
|
this.state.clearDraw();
|
2014-01-21 21:30:47 +00:00
|
|
|
nextPosition = this.startPosition.add(new ascii.Vector(0, 1));
|
|
|
|
this.startPosition = nextPosition;
|
|
|
|
}
|
|
|
|
if (value == KEY_BACKSPACE && this.startPosition.x <= nextPosition.x) {
|
|
|
|
// Pressed backspace key, so clear this cell and go back.
|
|
|
|
this.state.clearDraw();
|
|
|
|
nextPosition = this.currentPosition.add(new ascii.Vector(-1, 0));
|
2014-02-09 18:19:47 +00:00
|
|
|
if (nextPosition.x < this.startPosition.x) {
|
|
|
|
nextPosition.x = this.startPosition.x;
|
|
|
|
}
|
|
|
|
this.state.drawValue(nextPosition, ERASE_CHAR);
|
2014-01-20 23:58:33 +00:00
|
|
|
this.state.commitDraw();
|
|
|
|
}
|
2014-01-21 21:30:47 +00:00
|
|
|
if (value == KEY_UP) {
|
|
|
|
this.state.clearDraw();
|
|
|
|
this.startPosition = nextPosition = this.currentPosition.add(new ascii.Vector(0, -1))
|
|
|
|
}
|
|
|
|
if (value == KEY_LEFT) {
|
|
|
|
this.state.clearDraw();
|
|
|
|
this.startPosition = nextPosition = this.currentPosition.add(new ascii.Vector(-1, 0))
|
|
|
|
}
|
|
|
|
if (value == KEY_RIGHT) {
|
|
|
|
this.state.clearDraw();
|
|
|
|
this.startPosition = nextPosition = this.currentPosition.add(new ascii.Vector(1, 0))
|
|
|
|
}
|
|
|
|
if (value == KEY_DOWN) {
|
|
|
|
this.state.clearDraw();
|
|
|
|
this.startPosition = nextPosition = this.currentPosition.add(new ascii.Vector(0, 1))
|
|
|
|
}
|
2014-01-20 23:58:33 +00:00
|
|
|
|
2014-01-21 21:30:47 +00:00
|
|
|
if (value.length == 1) {
|
|
|
|
// The value is not a special character, so draw the value and commit it.
|
|
|
|
this.state.drawValue(this.currentPosition, value);
|
|
|
|
this.state.commitDraw();
|
2014-01-20 23:58:33 +00:00
|
|
|
}
|
2014-01-21 21:30:47 +00:00
|
|
|
|
2014-01-20 23:58:33 +00:00
|
|
|
// Highlight the next cell.
|
|
|
|
this.currentPosition = nextPosition;
|
|
|
|
var nextValue = this.state.getCell(nextPosition).getRawValue();
|
2014-02-09 18:19:47 +00:00
|
|
|
this.state.drawValue(nextPosition, nextValue == null ? ERASE_CHAR : nextValue);
|
2014-01-20 23:58:33 +00:00
|
|
|
};
|
2014-01-12 16:51:16 +00:00
|
|
|
|
2014-01-20 21:58:25 +00:00
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
* @implements {ascii.DrawFunction}
|
|
|
|
* @param {ascii.State} state
|
|
|
|
*/
|
|
|
|
ascii.DrawErase = function(state) {
|
|
|
|
this.state = state;
|
|
|
|
this.startPosition = null;
|
|
|
|
this.endPosition = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
ascii.DrawErase.prototype.start = function(position) {
|
|
|
|
this.startPosition = position;
|
|
|
|
this.move(position);
|
|
|
|
};
|
|
|
|
ascii.DrawErase.prototype.move = function(position) {
|
|
|
|
this.state.clearDraw();
|
|
|
|
this.endPosition = position;
|
|
|
|
|
|
|
|
var startX = Math.min(this.startPosition.x, this.endPosition.x);
|
|
|
|
var startY = Math.min(this.startPosition.y, this.endPosition.y);
|
|
|
|
var endX = Math.max(this.startPosition.x, this.endPosition.x);
|
|
|
|
var endY = Math.max(this.startPosition.y, this.endPosition.y);
|
|
|
|
|
2014-01-20 23:58:33 +00:00
|
|
|
for (var i = startX; i <= endX; i++) {
|
|
|
|
for (var j = startY; j <= endY; j++) {
|
2014-01-22 21:28:15 +00:00
|
|
|
this.state.drawValue(new ascii.Vector(i, j), ERASE_CHAR);
|
2014-01-20 21:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
ascii.DrawErase.prototype.end = function(position) {
|
|
|
|
this.state.commitDraw();
|
|
|
|
};
|
|
|
|
ascii.DrawErase.prototype.getCursor = function(position) {
|
|
|
|
return 'crosshair';
|
|
|
|
};
|
2014-01-20 23:58:33 +00:00
|
|
|
ascii.DrawErase.prototype.handleKey = function(value) {};
|
2014-01-20 21:58:25 +00:00
|
|
|
|
2014-01-18 00:28:46 +00:00
|
|
|
/**
|
|
|
|
* @constructor
|
2014-01-19 14:23:17 +00:00
|
|
|
* @implements {ascii.DrawFunction}
|
2014-01-18 00:28:46 +00:00
|
|
|
* @param {ascii.State} state
|
|
|
|
*/
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawMove = function(state) {
|
2014-01-18 00:28:46 +00:00
|
|
|
this.state = state;
|
2014-01-22 21:28:15 +00:00
|
|
|
this.startPosition = null;
|
2014-01-18 00:28:46 +00:00
|
|
|
this.ends = null;
|
2014-01-19 14:23:17 +00:00
|
|
|
};
|
2014-01-18 00:28:46 +00:00
|
|
|
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawMove.prototype.start = function(position) {
|
2014-01-22 21:28:15 +00:00
|
|
|
this.startPosition = position;
|
2014-01-18 00:28:46 +00:00
|
|
|
var context = this.state.getContext(position);
|
|
|
|
var directions = [
|
|
|
|
new ascii.Vector(1, 0),
|
|
|
|
new ascii.Vector(-1, 0),
|
|
|
|
new ascii.Vector(0, 1),
|
2014-01-19 14:23:17 +00:00
|
|
|
new ascii.Vector(0, -1)];
|
2014-01-18 00:28:46 +00:00
|
|
|
|
|
|
|
var ends = [];
|
|
|
|
for (var i in directions) {
|
2014-01-18 14:09:48 +00:00
|
|
|
var midPoints = this.followLine(position, directions[i]);
|
|
|
|
for (var k in midPoints) {
|
2014-02-09 18:00:55 +00:00
|
|
|
var midPoint = midPoints[k];
|
2014-01-18 14:09:48 +00:00
|
|
|
|
2014-02-09 18:00:55 +00:00
|
|
|
// Clockwise is a lie, it is true if we move vertically first.
|
|
|
|
var clockwise = (directions[i].x != 0);
|
|
|
|
|
|
|
|
var midPointContext = this.state.getContext(midPoint);
|
|
|
|
// Special case, a straight line with no turns.
|
|
|
|
if (midPointContext.sum() == 1) {
|
|
|
|
ends.push({position: midPoint, clockwise: clockwise});
|
2014-01-18 00:28:46 +00:00
|
|
|
continue;
|
|
|
|
}
|
2014-02-09 18:00:55 +00:00
|
|
|
// Continue following lines from the midpoint.
|
|
|
|
for (var j in directions) {
|
|
|
|
if (directions[i].add(directions[j]).length() == 0 ||
|
|
|
|
directions[i].add(directions[j]).length() == 2) {
|
|
|
|
// Don't go back on ourselves, or don't carry on in same direction.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
var secondEnds = this.followLine(midPoint, directions[j]);
|
|
|
|
// Ignore any directions that didn't go anywhere.
|
|
|
|
if (secondEnds.length == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// On the second line we don't care about multiple junctions, just the last.
|
|
|
|
ends.push({position: secondEnds[secondEnds.length - 1], clockwise: clockwise});
|
2014-01-18 00:28:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.ends = ends;
|
2014-01-18 00:41:38 +00:00
|
|
|
// Redraw the new lines after we have cleared the existing ones.
|
|
|
|
this.move(position);
|
2014-01-18 00:28:46 +00:00
|
|
|
};
|
|
|
|
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawMove.prototype.move = function(position) {
|
2014-01-18 00:28:46 +00:00
|
|
|
this.state.clearDraw();
|
2014-01-22 21:28:15 +00:00
|
|
|
// Clear all the lines so we can draw them afresh.
|
|
|
|
for (var i in this.ends) {
|
|
|
|
drawLine(this.state, this.startPosition, this.ends[i].position,
|
|
|
|
this.ends[i].clockwise, ' ');
|
|
|
|
}
|
2014-01-18 00:28:46 +00:00
|
|
|
for (var i in this.ends) {
|
2014-01-19 14:23:17 +00:00
|
|
|
drawLine(this.state, position, this.ends[i].position,
|
|
|
|
this.ends[i].clockwise);
|
2014-01-18 00:28:46 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawMove.prototype.end = function(position) {
|
2014-01-18 00:28:46 +00:00
|
|
|
this.state.commitDraw();
|
|
|
|
};
|
|
|
|
|
2014-01-20 22:10:37 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2014-01-19 14:23:17 +00:00
|
|
|
ascii.DrawMove.prototype.followLine = function(startPosition, direction) {
|
2014-01-18 00:28:46 +00:00
|
|
|
var endPosition = startPosition.clone();
|
2014-01-18 14:09:48 +00:00
|
|
|
var junctions = [];
|
2014-01-18 00:28:46 +00:00
|
|
|
while (true) {
|
|
|
|
var nextEnd = endPosition.add(direction);
|
2014-02-09 18:00:55 +00:00
|
|
|
if (!this.state.getCell(nextEnd).isSpecial()) {
|
|
|
|
// Junctions: Right angles and end T-Junctions.
|
|
|
|
if (!startPosition.equals(endPosition)) {
|
|
|
|
junctions.push(endPosition);
|
|
|
|
}
|
2014-01-18 14:09:48 +00:00
|
|
|
return junctions;
|
2014-01-18 00:28:46 +00:00
|
|
|
}
|
2014-02-09 18:00:55 +00:00
|
|
|
|
2014-01-18 00:28:46 +00:00
|
|
|
endPosition = nextEnd;
|
2014-02-09 18:00:55 +00:00
|
|
|
var context = this.state.getContext(endPosition);
|
|
|
|
// Junctions: Side T-Junctions.
|
|
|
|
if (context.sum() == 3) {
|
2014-01-18 14:09:48 +00:00
|
|
|
junctions.push(endPosition);
|
2014-01-18 00:28:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-20 21:36:58 +00:00
|
|
|
ascii.DrawMove.prototype.getCursor = function(position) {
|
|
|
|
if (this.state.getCell(position).isSpecial()) {
|
|
|
|
return 'pointer';
|
|
|
|
} else {
|
|
|
|
return 'default';
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-20 23:58:33 +00:00
|
|
|
ascii.DrawMove.prototype.handleKey = function(value) {};
|
|
|
|
|