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

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

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

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

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

@ -16,8 +16,6 @@ function Path(rune)
{
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();
var context = preview ? this.context() : ronin.frame.context();
@ -36,11 +34,10 @@ function Path(rune)
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"];
target_layer.context().fill(new Path2D(params.content));
context.fillStyle = this.settings["fill_color"];
context.fill(new Path2D(params.content));
}
// Tools

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