Added layer select with arrows

This commit is contained in:
Devine Lu Linvega
2017-01-02 17:07:06 -07:00
parent 808ba43345
commit bf2cc0cda3
5 changed files with 43 additions and 11 deletions

View File

@@ -44,6 +44,18 @@ function Brush(rune)
ronin.overlay.draw(cmd.position());
}
}
this.size_up = function()
{
this.size -= this.size > 1 ? 1 : 0;
ronin.widget.update();
}
this.size_down = function()
{
this.size += 1;
ronin.widget.update();
}
this.add_pointer = function(cmd)
{
@@ -74,10 +86,6 @@ function Brush(rune)
return this.pointers.length > 0 ? "Brush "+this.size+", "+this.pointers.length+" pointers" : "No Pointers";
}
// Commands
// this.
// Cursor

View File

@@ -80,12 +80,12 @@ function Surface(rune)
{
if(!this.active_layer){ return ""; }
var s = "# "+this.size.render()+"<br />";
var s = "";
Object.keys(ronin.surface.layers).forEach(function (key) {
s += ronin.surface.layers[key].widget();
s = ronin.surface.layers[key].widget()+s;
});
return s;
return "# "+this.size.render()+"<br />"+s;
}
this.widget_cursor = function()
@@ -93,6 +93,26 @@ function Surface(rune)
return "Drag";
}
// Commands
this.layer_up = function()
{
var keys = Object.keys(ronin.surface.layers);
var loc = keys.indexOf(this.active_layer.name);
if(loc >= keys.length-1){ console.log("Reached end"); return false; }
if(keys[loc+1] != null){this.select_layer(ronin.surface.layers[keys[loc+1]]);}
}
this.layer_down = function()
{
var keys = Object.keys(ronin.surface.layers);
var loc = keys.indexOf(this.active_layer.name);
if(keys[loc-1] != null){this.select_layer(ronin.surface.layers[keys[loc-1]]);}
}
// Layers
this.context = function()