diff --git a/presets/grid.glyph.rin b/presets/grid.glyph.rin
index 765a283..7b0619e 100644
--- a/presets/grid.glyph.rin
+++ b/presets/grid.glyph.rin
@@ -1,6 +1,5 @@
frame.resize 300x300 ;
-frame.select background ;
layer.fill #A1A1A1 ;
brush:color #ff0000 ;
magnet.grid 15x15 4,4 ;
-frame.select main ;
\ No newline at end of file
+frame.select work ;
\ No newline at end of file
diff --git a/scripts/modules/frame.js b/scripts/modules/frame.js
index 6f3db9a..02fd4f5 100644
--- a/scripts/modules/frame.js
+++ b/scripts/modules/frame.js
@@ -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 += "
"+layer+"";
+ s += ""+layer+" z"+this.layers[layer].depth+"";
}
else if(this.layers[layer].manager){
s += ""+this.layers[layer].manager.constructor.name+"*";
}
else{
- s += ""+layer+"";
+ s += ""+layer+" z"+this.layers[layer].depth+"";
}
}
return s;
diff --git a/scripts/modules/layer.js b/scripts/modules/layer.js
index e47a04b..a2bc580 100644
--- a/scripts/modules/layer.js
+++ b/scripts/modules/layer.js
@@ -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');
diff --git a/scripts/modules/module.js b/scripts/modules/module.js
index 902d3cd..42c506a 100644
--- a/scripts/modules/module.js
+++ b/scripts/modules/module.js
@@ -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);
diff --git a/scripts/modules/path.js b/scripts/modules/path.js
index 8521eb4..210bbf3 100644
--- a/scripts/modules/path.js
+++ b/scripts/modules/path.js
@@ -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
diff --git a/scripts/modules/terminal.js b/scripts/modules/terminal.js
index c5f08fa..dafae77 100644
--- a/scripts/modules/terminal.js
+++ b/scripts/modules/terminal.js
@@ -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);
}