Various improvements

This commit is contained in:
Devine Lu Linvega 2017-04-15 13:39:18 -10:00
parent 3df9b21772
commit 710b807e89
6 changed files with 15 additions and 13 deletions

View File

@ -1,6 +1,5 @@
frame.resize 300x300 ; frame.resize 300x300 ;
frame.select background ;
layer.fill #A1A1A1 ; layer.fill #A1A1A1 ;
brush:color #ff0000 ; brush:color #ff0000 ;
magnet.grid 15x15 4,4 ; magnet.grid 15x15 4,4 ;
frame.select main ; frame.select work ;

View File

@ -91,6 +91,7 @@ function Frame(rune)
this.add_layer = function(layer) this.add_layer = function(layer)
{ {
if(this.active_layer){layer.set_depth(this.active_layer.depth+1);}
layer.resize(this.settings["size"]); layer.resize(this.settings["size"]);
this.layers[layer.name] = layer; this.layers[layer.name] = layer;
this.element.appendChild(layer.element); this.element.appendChild(layer.element);
@ -144,13 +145,13 @@ function Frame(rune)
var s = ""; var s = "";
for(layer in this.layers){ for(layer in this.layers){
if(this.active_layer.name == layer){ if(this.active_layer.name == layer){
s += "<li class='active'>"+layer+"</li>"; s += "<li class='active'>"+layer+" z"+this.layers[layer].depth+"</li>";
} }
else if(this.layers[layer].manager){ else if(this.layers[layer].manager){
s += "<li class='managed'>"+this.layers[layer].manager.constructor.name+"*</li>"; s += "<li class='managed'>"+this.layers[layer].manager.constructor.name+"*</li>";
} }
else{ else{
s += "<li class='inactive'>"+layer+"</li>"; s += "<li class='inactive'>"+layer+" z"+this.layers[layer].depth+"</li>";
} }
} }
return s; return s;

View File

@ -18,6 +18,7 @@ function Layer(name,manager = null)
this.element = document.createElement("canvas"); this.element = document.createElement("canvas");
this.element.setAttribute("id","_"+name); this.element.setAttribute("id","_"+name);
this.element.setAttribute("class","layer"); this.element.setAttribute("class","layer");
this.depth = 0;
this.scale = function(params,preview = false) this.scale = function(params,preview = false)
{ {
@ -119,6 +120,12 @@ function Layer(name,manager = null)
return this.element.getContext('2d'); return this.element.getContext('2d');
} }
this.set_depth = function(depth)
{
this.depth = depth;
this.element.setAttribute("z-index",depth);
}
this.image = function() this.image = function()
{ {
return this.element.toDataURL('image/png'); return this.element.toDataURL('image/png');

View File

@ -10,7 +10,6 @@ function Module(rune)
this.install = function() this.install = function()
{ {
// console.log("Installing "+ronin.modules[this.rune].constructor.name);
} }
this.context = function() this.context = function()
@ -20,7 +19,6 @@ function Module(rune)
this.create_layer = function() this.create_layer = function()
{ {
console.info("!!!!",this);
this.layer = new Layer(this.constructor.name+".Preview",this); this.layer = new Layer(this.constructor.name+".Preview",this);
this.layer.element.setAttribute("style","z-index:7000"); this.layer.element.setAttribute("style","z-index:7000");
ronin.frame.add_layer(this.layer); ronin.frame.add_layer(this.layer);

View File

@ -16,8 +16,6 @@ function Path(rune)
{ {
if(!ronin.path.layer){ ronin.path.create_layer(); ronin.path.layer.is_blinking = true; } if(!ronin.path.layer){ ronin.path.create_layer(); ronin.path.layer.is_blinking = true; }
ronin.terminal.log(new Log(this,"Stroke path!("+preview+")"));
this.layer.clear(); this.layer.clear();
var context = preview ? this.context() : ronin.frame.context(); var context = preview ? this.context() : ronin.frame.context();
@ -36,11 +34,10 @@ function Path(rune)
this.layer.clear(); this.layer.clear();
var target_layer = preview ? this.layer : ronin.frame.active_layer; var context = preview ? this.context() : ronin.frame.context();
target_layer.context().fillStyle = this.settings["fill_color"]; context.fillStyle = this.settings["fill_color"];
context.fill(new Path2D(params.content));
target_layer.context().fill(new Path2D(params.content));
} }
// Tools // Tools

View File

@ -121,7 +121,7 @@ function Terminal(rune)
var entry = ronin.terminal.queue.shift(); var entry = ronin.terminal.queue.shift();
console.info(entry); console.info(entry);
active(entry); active(entry);
// ronin.terminal.queue.shift(); ronin.widget.update();
setTimeout(function(){ ronin.terminal.run(); }, 100); setTimeout(function(){ ronin.terminal.run(); }, 100);
} }