Image render
This commit is contained in:
@@ -14,7 +14,7 @@ function Docs()
|
||||
|
||||
dialog.showSaveDialog((fileName) => {
|
||||
if (fileName === undefined){ return; }
|
||||
fs.writeFile("README.md", str, (err) => {
|
||||
fs.writeFile(fileName+".md", str, (err) => {
|
||||
if(err){ alert("An error ocurred creating the file "+ err.message); return; }
|
||||
});
|
||||
});
|
||||
@@ -73,7 +73,7 @@ function Docs()
|
||||
for(port_name in ports){
|
||||
var port = ports[port_name];
|
||||
console.log(ports);
|
||||
html += "- `"+(port.input ? '->' : '')+""+port.name+""+(port.output ? '->' : '')+"` *"+port.value+"/"+port.max+"* "+port.docs+".\n";
|
||||
html += "- `"+(port.input ? '->' : '')+""+port.name+""+(port.output ? '->' : '')+"` **("+port.value+"/"+port.max+")** "+port.docs+".\n";
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
function IO()
|
||||
{
|
||||
this.render = function()
|
||||
{
|
||||
var fs = require('fs');
|
||||
var img = ronin.render.image();
|
||||
var data = img.replace(/^data:image\/\w+;base64,/, "");
|
||||
var buf = new Buffer(data, 'base64');
|
||||
|
||||
dialog.showSaveDialog((fileName) => {
|
||||
if (fileName === undefined){ return; }
|
||||
fs.writeFile(fileName+'.png', buf);
|
||||
});
|
||||
}
|
||||
|
||||
this.drag_over = function(e)
|
||||
{
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -33,6 +33,11 @@ function Keyboard()
|
||||
ronin.render.clear();
|
||||
}
|
||||
|
||||
if(e.key == "r" && (e.ctrlKey || e.metaKey)){
|
||||
e.preventDefault();
|
||||
ronin.io.render();
|
||||
}
|
||||
|
||||
if(e.key == "H" && (e.ctrlKey || e.metaKey) && e.shiftKey){
|
||||
e.preventDefault();
|
||||
ronin.docs.export();
|
||||
|
||||
@@ -35,7 +35,7 @@ function Layer()
|
||||
|
||||
this.image = function()
|
||||
{
|
||||
return this.element.toDataURL('image/png');
|
||||
return this.el.toDataURL('image/png');
|
||||
}
|
||||
|
||||
this.clear = function()
|
||||
|
||||
@@ -14,6 +14,7 @@ function Port(host,name,input,output,value,max,docs)
|
||||
this.value = value;
|
||||
var target = this.host.routes[this.name];
|
||||
|
||||
if(!this.output){ return; }
|
||||
if(!target){ console.log("No output for",this.name); return; }
|
||||
|
||||
this.host.ports[target].write(this.value);
|
||||
|
||||
Reference in New Issue
Block a user