diff options
author | Devine Lu Linvega <[email protected]> | 2018-10-16 11:50:55 +1200 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2018-10-16 11:50:55 +1200 |
commit | 756663086d10c79d37b6540f4396ea2afc403e58 (patch) | |
tree | c7c0742282a44ce8d6e96c3e441f207c838f3a2f | |
parent | bb883fec9ee7d20a3c06a6d02cc27e4b10852ea6 (diff) | |
download | Orca-756663086d10c79d37b6540f4396ea2afc403e58.tar.gz Orca-756663086d10c79d37b6540f4396ea2afc403e58.zip |
Block erase
-rw-r--r-- | desktop/core/pico.js | 13 | ||||
-rw-r--r-- | desktop/sources/scripts/cursor.js | 3 | ||||
-rw-r--r-- | desktop/sources/scripts/keyboard.js | 2 |
3 files changed, 16 insertions, 2 deletions
diff --git a/desktop/core/pico.js b/desktop/core/pico.js index 1ca12cb..5daeafd 100644 --- a/desktop/core/pico.js +++ b/desktop/core/pico.js @@ -156,6 +156,19 @@ function Pico (w, h) { } } + this.removeBlock = function(x,y,w,h) + { + let _y = y + while(_y < y+h){ + let _x = x + while(_x < x+w){ + this.remove(_x,_y) + _x++ + } + _y++ + } + } + // Locks this.isLocked = function (x, y) { diff --git a/desktop/sources/scripts/cursor.js b/desktop/sources/scripts/cursor.js index e9bd78f..67afb47 100644 --- a/desktop/sources/scripts/cursor.js +++ b/desktop/sources/scripts/cursor.js @@ -43,7 +43,8 @@ function Cursor(terminal) } this.erase = function (g) { - pico.remove(this.x, this.y) + this.terminal.log(`Erase ${this.x},${this.y}[${this.w}x${this.h}]`) + this.terminal.pico.removeBlock(this.x,this.y,this.w,this.h) } this.inspect = function () { diff --git a/desktop/sources/scripts/keyboard.js b/desktop/sources/scripts/keyboard.js index 05258ec..7824996 100644 --- a/desktop/sources/scripts/keyboard.js +++ b/desktop/sources/scripts/keyboard.js @@ -29,7 +29,7 @@ function Keyboard () { if (event.metaKey) { return } if (event.ctrlKey) { return } - if (event.key == 'Backspace') { terminal.cursor.insert('.'); return } + if (event.key == 'Backspace') { terminal.cursor.erase(); return } if (event.key == 'Space') { terminal.cursor.insert('.'); event.preventDefault(); return } if (event.key == 'Escape') { terminal.clear(); terminal.cursor.reset(); return } |