diff options
| author | Julie Lala <jules@okfoc.us> | 2014-12-02 01:14:23 -0500 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-12-02 01:14:23 -0500 |
| commit | 8d26b2871b711d18e042a7f14d1b7e9a253dee74 (patch) | |
| tree | 7a7d59a1cef5aed016ba7ab0c408ef40b372ecd6 | |
| parent | 54ca5fc7768b707394c3535b1415a6eb15533171 (diff) | |
change how shit wraps
| -rw-r--r-- | index.html | 5 | ||||
| -rw-r--r-- | js/app.js | 8 | ||||
| -rw-r--r-- | js/clipboard.js | 3 | ||||
| -rw-r--r-- | js/matrix.js | 6 |
4 files changed, 13 insertions, 9 deletions
@@ -38,6 +38,11 @@ textarea { font-size:12pt; width: 45%; height: 300px; background: #333; color: # canvas size: <span id="canvas_width_el" class="ed">80</span> x <span id="canvas_height_el" class="ed">24</span><br> <br> <span id="animate_checkbox" class="tool">_ animate</span><br> +<!-- + <span id="fg_checkbox" class="tool">_ fg</span><br> + <span id="bg_checkbox" class="tool">_ bg</span><br> + <span id="char_checkbox" class="tool">_ char</span><br> + --> </div> <div id="textarea_mode"> @@ -77,26 +77,18 @@ function bind () { return case 38: // up e.preventDefault() - direction[0] = -1 - direction[1] = 0 current_canvas.focusLex(focused.y + direction[0], focused.x + direction[1]) break case 40: // down e.preventDefault() - direction[0] = 1 - direction[1] = 0 current_canvas.focusLex(focused.y + direction[0], focused.x + direction[1]) break case 37: // left e.preventDefault() - direction[0] = 0 - direction[1] = -1 current_canvas.focusLex(focused.y + direction[0], focused.x + direction[1]) break case 39: // right e.preventDefault() - direction[0] = 0 - direction[1] = 1 current_canvas.focusLex(focused.y + direction[0], focused.x + direction[1]) break // default: diff --git a/js/clipboard.js b/js/clipboard.js index ecbdaa8..0788284 100644 --- a/js/clipboard.js +++ b/js/clipboard.js @@ -69,7 +69,8 @@ var clipboard = (function () { lex.build() } }) - // TODO: some solution for a "selected" region + // TODO: some notion of a "selected" region which cuts/clones the underlying region + // var pasted_region = new Matrix (width, height, function(x,y){ // var lex = new Lex (x,y) // lex.char = lines[y][x] || " " diff --git a/js/matrix.js b/js/matrix.js index ccd90b2..98c132d 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -45,6 +45,12 @@ Matrix.prototype.forEach = function(f){ }) } Matrix.prototype.focusLex = function(y,x){ + if (x < 0) { + y -= 1 + } + if (x > this.aa[0].length) { + y += 1 + } this.aa[mod(y,this.h)][mod(x,this.w)].focus() } Matrix.prototype.clear = function(){ |
