From 882d3394070a880f886d9e242704c9d2985af8d4 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 25 Dec 2016 16:16:27 -0700 Subject: [PATCH] Improved widgets --- scripts/modules/brush.js | 8 ++++++++ scripts/modules/brush.pointer.js | 5 +++++ scripts/modules/surface.js | 4 ++-- scripts/modules/surface.layer.js | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/modules/brush.js b/scripts/modules/brush.js index 9d83514..b45eb2f 100644 --- a/scripts/modules/brush.js +++ b/scripts/modules/brush.js @@ -64,6 +64,14 @@ function Brush(rune) this.widget_cursor = function() { + + var s = "> "+this.size+"
"; + + for (i = 0; i < ronin.brush.pointers.length; i++) { + s += ronin.brush.pointers[i].widget(); + } + return s; + return this.pointers.length > 0 ? "Brush "+this.size+", "+this.pointers.length+" pointers" : "No Pointers"; } diff --git a/scripts/modules/brush.pointer.js b/scripts/modules/brush.pointer.js index 9f030a4..f48f6de 100644 --- a/scripts/modules/brush.pointer.js +++ b/scripts/modules/brush.pointer.js @@ -90,4 +90,9 @@ function Pointer(offset = new Position(), color = new Color('000000')) { this.position_prev = null; } + + this.widget = function() + { + return this.offset.render()+"
"; + } } \ No newline at end of file diff --git a/scripts/modules/surface.js b/scripts/modules/surface.js index c75d614..06623cb 100644 --- a/scripts/modules/surface.js +++ b/scripts/modules/surface.js @@ -83,12 +83,12 @@ function Surface(rune) { if(!this.active_layer){ return ""; } - var s = ""; + var s = "# "+this.size.render()+"
"; Object.keys(ronin.surface.layers).forEach(function (key) { s += ronin.surface.layers[key].widget(); }); - return s; // "# "+this.active_layer.name; + return s; } this.widget_cursor = function() diff --git a/scripts/modules/surface.layer.js b/scripts/modules/surface.layer.js index 16c528e..97a771b 100644 --- a/scripts/modules/surface.layer.js +++ b/scripts/modules/surface.layer.js @@ -55,7 +55,7 @@ function Layer(name,host = "user") this.widget = function() { - return "# "+this.name+"
"; + return (ronin.surface.active_layer.name == this.name) ? "- ("+this.name+")
" : "- "+this.name+"
"; } this.move_from = null;