Blink does not write on DOM anymore

This commit is contained in:
Devine Lu Linvega
2017-06-13 14:33:21 -10:00
parent 43ea3bd386
commit 2f1f627214
10 changed files with 39 additions and 17 deletions

View File

@@ -16,7 +16,6 @@ function Frame(rune)
this.install = function()
{
this.blink();
this.select(new Command("frame.select background"));
// Canvas

View File

@@ -182,8 +182,6 @@ function Layer(name,manager = null)
this.blink = function()
{
if(this.is_blinking == false){ return; }
this.element.style.display = this.element.style.display == "none" ? "block" : "none";
this.element.setAttribute("class","layer blink")
}
}

View File

@@ -8,12 +8,13 @@ function Magnet(rune)
this.add_setting(new Setting("color","#000000"));
this.add_method(new Method("grid",["rect","position"]));
this.add_method(new Method("clear",[]));
this.grid = function(cmd,preview = false)
{
if(!cmd.rect()){ return 0, "Rect?"; }
if(!this.layer){ this.create_layer(); }
if(!this.layer){ this.create_layer(true); }
this.layer.clear();
this.draw_grid(cmd.rect(),cmd.position());
@@ -26,6 +27,14 @@ function Magnet(rune)
return 1, preview ? "preview" : "ok";
}
this.clear = function(cmd,preview = false)
{
this.layer.clear();
this.size = new Rect("1x1");
this.rate = this.rate;
}
this.draw_grid = function(rect,position)
{
if(!rect){ rect = new Rect("20x20"); }
@@ -69,7 +78,7 @@ function Magnet(rune)
this.update_mouse = function(position)
{
if(this.size.width > 4 || this.size.height > 4){
if(!this.layer){ this.create_layer(); }
if(!this.layer){ this.create_layer(true); }
this.layer.clear();
this.draw_grid(this.size,this.rate);
}

View File

@@ -38,10 +38,11 @@ function Module(rune)
return this.get_layer().context();
}
this.create_layer = function()
this.create_layer = function(blink = false)
{
this.layer = new Layer(this.constructor.name+".Preview",this);
this.layer.element.setAttribute("style","z-index:7000");
if(blink){ this.layer.blink(); }
ronin.frame.add_layer(this.layer);
}

View File

@@ -8,7 +8,7 @@ function Overlay(rune)
this.draw = function(position,rect)
{
if(!this.layer){ this.create_layer(); this.layer.is_blinking = true; }
if(!this.layer){ this.create_layer(true); this.layer.is_blinking = true; }
if(!position){ position = new Position("0,0"); }

View File

@@ -10,7 +10,7 @@ function Type(rune)
this.write = function(cmd,preview = false)
{
if(!this.layer){ this.create_layer(); this.layer.is_blinking = true; }
if(!this.layer){ this.create_layer(true); this.layer.is_blinking = true; }
this.layer.clear();