diff options
author | Devine Lu Linvega <[email protected]> | 2019-04-20 07:59:04 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-04-20 07:59:04 +0900 |
commit | 5692e3eb234e15dd33ec3327971accd1b58cc628 (patch) | |
tree | 0a1b72eb3e3f1dbb87207cb10570234d7ec1fd06 | |
parent | b66a6e4e1ea2c0063c529e78311cd1f51a7eff6c (diff) | |
download | Orca-5692e3eb234e15dd33ec3327971accd1b58cc628.tar.gz Orca-5692e3eb234e15dd33ec3327971accd1b58cc628.zip |
Improved markers
-rw-r--r-- | desktop/sources/scripts/terminal.js | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js index e44a9c3..fe441c7 100644 --- a/desktop/sources/scripts/terminal.js +++ b/desktop/sources/scripts/terminal.js @@ -118,6 +118,10 @@ function Terminal () { return !!(x >= this.cursor.x && x < this.cursor.x + this.cursor.w && y >= this.cursor.y && y < this.cursor.y + this.cursor.h) } + this.isMarker = function (x, y) { + return x % this.grid.w === 0 && y % this.grid.h === 0 + } + this.portAt = function (x, y) { return this.ports[this.orca.indexAt(x, y)] } @@ -137,6 +141,27 @@ function Terminal () { return a } + // Interface + + this.makeGlyph = function (x, y) { + const g = this.orca.glyphAt(x, y) + if (g !== '.') { return g } + if (this.isCursor(x, y)) { return this.isPaused ? '~' : '@' } + if (this.isMarker(x, y)) { return '+' } + return g + } + + this.makeStyle = function (x, y, glyph, selection) { + const isLocked = this.orca.lockAt(x, y) + const port = this.ports[this.orca.indexAt(x, y)] + if (this.isSelection(x, y)) { return 4 } + if (glyph === '.' && isLocked === false) { return 7 } + if (selection === glyph && isLocked === false) { return 6 } + if (port) { return port[2] } + if (isLocked === true) { return 5 } + return 9 + } + // Canvas this.clear = function () { @@ -154,24 +179,6 @@ function Terminal () { } } - this.makeGlyph = function (x, y) { - const g = this.orca.glyphAt(x, y) - if (g !== '.') { return g } - if (this.isCursor(x, y)) { return this.isPaused ? '~' : '@' } - if (x % this.grid.w === 0 && y % this.grid.h === 0) { return '+' } - return g - } - - this.makeStyle = function (x, y, glyph, selection) { - - const isLocked = this.orca.lockAt(x, y) - if(glyph === '.' && isLocked === false){ return 7} - const port = this.ports[this.orca.indexAt(x, y)] - const style = this.isSelection(x, y) ? 4 : port ? port[2] : isLocked === true ? 5 : null - const likeCursor = glyph === selection && glyph !== '.' && style !== 4 && isLocked === false - return likeCursor ? 6 : style - } - this.drawInterface = function () { const col = this.grid.w // Cursor |