Improved design

This commit is contained in:
Devine Lu Linvega
2017-01-16 21:01:27 -07:00
parent 215cbfdd29
commit 8b963e6283
14 changed files with 54 additions and 27 deletions

View File

@@ -25,7 +25,7 @@ document.onkeydown = function myFunction(){ keyboard.listen_onkeydown(event); };
// Canvas
var starting_canvas = new Rect();
starting_canvas.width = window.innerWidth - 200;
starting_canvas.height = window.innerHeight - 200;
starting_canvas.height = window.innerHeight - 400;
// Clamp
@@ -35,8 +35,8 @@ starting_canvas.height = parseInt(starting_canvas.height/40) * 40;
commander.query("~ "+ronin.timestamp());
commander.query("# "+starting_canvas.render());
commander.query("# layer=background");
commander.query("# #efefef");
// commander.query("# #efefef");
commander.query("# layer=main");
commander.query("> 1 0,0 #000000");
commander.query("> 1 1,0 #000000");
commander.query("> 1 0,1 #000000");
commander.query("> 1 0,0 #ff0000");
commander.query("> 1 1,0 #ff0000");
commander.query("> 1 0,1 #ff0000");

View File

@@ -33,6 +33,14 @@ function Ronin()
this.modules[this.stroke.rune] = this.stroke;
this.modules[this.vector.rune] = this.vector;
this.modules[this.help.rune] = this.help;
// Install
for(var key in this.modules){
this.modules[key].install();
}
//
this.cursors = [];

View File

@@ -18,7 +18,7 @@ function Widget()
this.on_resize = function()
{
this.element.style.left = (window.innerWidth/2)-(ronin.surface.size.width/2);
this.element.style.top = (window.innerHeight/2)+(ronin.surface.size.height/2);
this.element.style.top = (window.innerHeight/2)+(ronin.surface.size.height/2)+20;
this.element.style.width = ronin.surface.size.width+"px";
this.update();

View File

@@ -39,11 +39,11 @@ function Filter_Stencil()
this.circle(context,-w*0.4,h*0.25,w*0.05,0,0.5);
context.font = "5px Arial";
context.fillStyle = "#000000";
context.fillStyle = "#999";
context.fillText("GRID",(w*0.4)+10,10);
context.font = "5px Arial";
context.fillStyle = "#000000";
context.fillStyle = "#999";
context.fillText("GRID",(-w*0.4)-20,-10);
context.rotate(-angle*Math.PI/180);
@@ -57,7 +57,7 @@ function Filter_Stencil()
context.lineTo(y1,y2);
context.lineCap="round";
context.lineWidth = 0.5;
context.strokeStyle = "#000";
context.strokeStyle = "#999";
context.stroke();
context.closePath();
}
@@ -68,7 +68,7 @@ function Filter_Stencil()
context.arc(x,y,r,c1*Math.PI,c2*Math.PI);
context.lineCap="round";
context.lineWidth = 0.5;
context.strokeStyle = "#000";
context.strokeStyle = "#999";
context.stroke();
context.closePath();
}

View File

@@ -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>");
}
}

View File

@@ -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.");

View File

@@ -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();

View File

@@ -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;