Improved design
This commit is contained in:
@@ -3,19 +3,20 @@ function FileSave(rune)
|
||||
Module.call(this,rune);
|
||||
|
||||
this.parameters = [Any];
|
||||
this.variables = {"format" : "png"};
|
||||
|
||||
this.active = function(cmd)
|
||||
{
|
||||
var n = "Ronin Export";
|
||||
var f = cmd.variable("format");
|
||||
var d = ronin.surface.active_layer.element.toDataURL('image/png');
|
||||
// // ronin.surface.layers["render"].clear();
|
||||
var d = null;
|
||||
|
||||
if(cmd.variable("format").value == "jpg"){
|
||||
var d = ronin.surface.active_layer.element.toDataURL('image/jpeg');
|
||||
}
|
||||
else{
|
||||
var d = ronin.surface.active_layer.element.toDataURL('image/png');
|
||||
}
|
||||
|
||||
var w = window.open('about:blank','image from canvas');
|
||||
// w.document.write("hello")
|
||||
w.document.write("<title>"+(n ? n : "Untitled")+"</title><body><img src='"+d+"' width='"+ronin.surface.size.width+"px' height='"+ronin.surface.size.height+"px'/></body>");
|
||||
}
|
||||
|
||||
this.passive = function(cmd)
|
||||
{
|
||||
w.document.write("<title>Untitled</title><body><img src='"+d+"' width='"+ronin.surface.size.width+"px' height='"+ronin.surface.size.height+"px'/></body>");
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,11 @@ function Module(rune)
|
||||
|
||||
this.docs = "Missing documentation.";
|
||||
|
||||
this.install = function()
|
||||
{
|
||||
console.log(this.rune);
|
||||
}
|
||||
|
||||
this.active = function(cmd)
|
||||
{
|
||||
console.log("Nothing to do.");
|
||||
|
||||
@@ -27,6 +27,7 @@ function Surface(rune)
|
||||
}
|
||||
|
||||
if(cmd.bang() && Object.keys(ronin.surface.layers).length > 1){
|
||||
// Remove element from DOM
|
||||
delete this.layers[this.active_layer.name];
|
||||
this.select_any_layer();
|
||||
ronin.widget.update();
|
||||
|
||||
@@ -44,7 +44,7 @@ function Layer(name,host = "user")
|
||||
|
||||
this.widget = function()
|
||||
{
|
||||
return (ronin.surface.active_layer.name == this.name) ? "<span class='highlight'>- ("+this.name+")</span><br />" : "- "+this.name+"<br />";
|
||||
return (ronin.surface.active_layer.name == this.name) ? "<span class='highlight'>- "+this.name+"</span><br />" : "- "+this.name+"<br />";
|
||||
}
|
||||
|
||||
this.move_from = null;
|
||||
|
||||
Reference in New Issue
Block a user