Fixed export

This commit is contained in:
Devine Lu Linvega 2017-05-21 18:46:48 -10:00
parent 26daabb6cd
commit f56180f7d2
4 changed files with 30 additions and 7 deletions

View File

@ -24,3 +24,7 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_medium"
#terminal #hint .method { display: inline-block; color:#999; }
#terminal #hint .params { display: inline-block; color:#999; font-style: italic }
#terminal #hint .setting { display: inline-block; color:#fff; font-style: italic }
#modal { position: fixed; bottom:80px; right:20px; width:100px; height:100px; background:#111; border-radius:3px; overflow:hidden; display: block}
#modal.image img { display: block; max-width: 100%}
#modal.hidden { display: none }

View File

@ -10,6 +10,6 @@ type:color white
type.write 38,262 "RONIN"
type.write 38,252 "B08"
brush:color #000000
brush:size 10
brush:size 4
path:line_width 20
path:line_color #999999

View File

@ -85,7 +85,7 @@ function Frame(rune)
Object.keys(ronin.frame.layers).forEach(function (key) {
ronin.frame.layers[key].blink();
});
setTimeout(function(){ ronin.frame.blink(); }, 300);
setTimeout(function(){ ronin.frame.blink(); }, 30);
}
this.select_layer = function(layer)

View File

@ -2,11 +2,21 @@ function Source(rune)
{
Module.call(this,rune);
this.settings = {"format":"jpg","quality":"1"};
this.modal_element = null;
this.settings = {"format":"png","quality":"1"};
this.add_method(new Method("save",["name","rect","format"]));
this.add_method(new Method("load",["path","position","rect"]),"Add point");
this.install = function()
{
this.modal_element = document.createElement("modal");
this.modal_element.id = "modal";
this.modal_element.setAttribute("class","hidden");
ronin.element.appendChild(this.modal_element);
}
this.load = function(params,preview = false) // source.load /01.jpg 0,0 100x100
{
if(!params.filepath()){ return 0, "Path?"; }
@ -50,13 +60,13 @@ function Source(rune)
var d = null;
ronin.terminal.query("terminal.display mini");
this.modal();
if(this.settings["format"] == "jpg"){
ronin.terminal.log(new Log(this,"<img src='"+this.merge().element.toDataURL('image/jpeg',parseFloat(this.settings["quality"]))+"' width='"+ronin.frame.settings["size"].width+"px' height='"+ronin.frame.settings["size"].height+"px'/>","image"));
this.modal("image","<img src='"+this.merge().element.toDataURL('image/jpeg',parseFloat(this.settings["quality"]))+"' />");
}
else{
ronin.terminal.log(new Log(this,"<img src='"+this.merge().element.toDataURL('image/png',parseFloat(this.settings["quality"]))+"' width='"+ronin.frame.settings["size"].width+"px' height='"+ronin.frame.settings["size"].height+"px'/>","image"));
this.modal("image","<img src='"+this.merge().element.toDataURL('image/png',parseFloat(this.settings["quality"]))+"'/>");
}
/*
if(params.setting("format") && params.setting("format").value == "svg"){
@ -74,6 +84,12 @@ function Source(rune)
this.layer.remove(this);
}
this.modal = function(type,content)
{
this.modal_element.setAttribute("class",type);
this.modal_element.innerHTML = content;
}
this.merge = function()
{
var a = [];
@ -93,5 +109,8 @@ function Source(rune)
this.coordinates = [];
this.last_pos = null;
ronin.terminal.input.value = "";
this.modal_element.innerHTML = "";
this.modal_element.setAttribute("class","hidden");
}
}