From 353f109d60ca9d29af333fe91bc09edd8a69472f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 11 Dec 2014 22:26:08 -0500 Subject: drag a selection around clones/copies it --- js/blit.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'js/blit.js') diff --git a/js/blit.js b/js/blit.js index 09f39b2..8683f22 100644 --- a/js/blit.js +++ b/js/blit.js @@ -18,7 +18,17 @@ var blit = (function(){ } }) } - blit.set = blit.replace = function(A, B, x, y){ + // copy the region of A beginning at x,y into B + blit.copy_from = function(A, B, x, y){ + x = x || 0 ; y = y || 0 + B.forEach(function(lex, u, v){ + var cell = A.getCell(u+x, v+y) + if (cell) { + lex.clone(cell) + } + }) + } + blit.copy_to = function(A, B, x, y){ x = x || 0 ; y = y || 0 B.forEach(function(lex, u, v){ var cell = A.getCell(u+x, v+y) -- cgit v1.2.3-70-g09d2