Pretty solid build

This commit is contained in:
Devine Lu Linvega 2017-11-15 19:13:29 +13:00
parent aa64d70870
commit 516a91bfc5
8 changed files with 31 additions and 73 deletions

View File

@ -20,14 +20,6 @@ Missing documentation.
### Settings
- `size`, default 4
- `color`, default #000
- `opacity`, default 1
### Ports
- `speed->` **(0/50)** The cursor speed.
- `distance->` **(0/9999)** The cursor distance.
- `->red->` **(0/255)** The brush color value(red).
- `->green->` **(0/255)** The brush color value(green).
- `->blue->` **(0/255)** The brush color value(blue).
## frame
@ -39,25 +31,10 @@ Manager for the canvas size
- `crop:X,Y|WxH` Crop canvas to rect.
- `clear:` Erase entire canvas
- `fill:#f00` Fill entire canvas with color
- `inspect:` View canvas details
### Settings
### Ports
## line
Drawing lines. Tween expects something in the `$&$>>$&$` format.
### Methods
- `stroke:x1,y1&x2,y2` Stroke positions.
- `tween:tween:$&$>>$&$ step->thickness` Stroke lines between strokes.
### Settings
### Ports
- `step->` **(0/100)** The tween line index..
- `->thickness->` **(1/100)** The tween line thickness..
## io
File import/export tools.
@ -65,12 +42,10 @@ File import/export tools.
### Methods
- `load:browser` Press enter to open the file browser.
- `draw:X,Y|WxH` Draw the loaded image pixels.
- `save:name` Export canvas.
- `save:jpg/png` Export canvas.
### Settings
### Ports
## path
Trace lines and to draw shapes.
@ -78,38 +53,46 @@ Trace lines and to draw shapes.
### Methods
- `stroke:x,y&`
- `fill:x,y&`
- `svg:M0,0 L100,100`
### Settings
- `thickness`, default 30
- `color`, default black
- `thickness`, default 4
- `color`, default red
- `cap`, default square
### Ports
## magnet
Cursor magnetisation settings, changes are reflected on the grid layer.
### Methods
- `lock:10x10` Magnetize cursor
- `lock:10` Magnetize cursor
- `unlock:` Release cursor
### Settings
- `size`, default 0
- `step`, default 4
### Ports
## filter
Pixel filter
### Methods
- `balance:#ff0033` Filter color balance.
- `saturation:0.5,0.5` Filter color saturation.
### Settings
### Ports
## type
Missing documentation.
### Methods
- `write:text&x,y|WxH` Draw text
### Settings
- `color`, default #000000
- `font`, default Gotham Light
- `anchor`, default center
## License

View File

@ -22,10 +22,8 @@ function Commander()
for(setting_id in q.settings){
var setting_value = q.settings[setting_id];
if(!ronin.modules[q.module].settings[setting_id]){ console.log("Missing setting",setting_id); return; }
ronin.modules[q.module].settings[setting_id] = setting_value;
}
ronin.modules[q.module].routes = q.routes;
// Run methods
@ -80,12 +78,7 @@ function Commander()
{
var target_module = ronin.commander.query().module;
if(ronin.modules[target_module]){
var ac = ronin.hint.find_autocomplete(ronin.modules[target_module].methods,":");
}
else{
var ac = ronin.hint.find_autocomplete(ronin.modules," ");
}
var ac = ronin.modules[target_module] ? ronin.hint.find_autocomplete(ronin.modules[target_module].methods,":") : ronin.hint.find_autocomplete(ronin.modules," ")
if(ac.lenght < 1 || !ac[0]){ return; }

View File

@ -13,14 +13,6 @@ function Docs()
html += this.print_modules(ronin.modules);
html += this.print_license();
// dialog.showSaveDialog((fileName) => {
// if (fileName === undefined){ return; }
// console.log(fileName)
// fs.writeFile(fileName, html, (err) => {
// if(err){ alert("An error ocurred creating the file "+ err.message); return; }
// });
// });
fs.writeFile("/Users/VillaMoirai/Github/HundredRabbits/Ronin/README.md", html, (err) => {
if(err){ alert("An error ocurred creating the file "+ err.message); return; }
});
@ -46,7 +38,6 @@ function Docs()
html += module.docs+"\n\n";
html += this.print_methods(module.methods)+"\n";
html += this.print_settings(module.settings)+"\n";
html += this.print_ports(module.ports)+"\n";
}
return html+"\n";
}
@ -73,18 +64,6 @@ function Docs()
return html;
}
this.print_ports = function(ports)
{
var html = "### Ports\n";
for(port_name in ports){
var port = ports[port_name];
html += "- `"+(port.input ? '->' : '')+""+port.name+""+(port.output ? '->' : '')+"` **("+port.value+"/"+port.max+")** "+port.docs+".\n";
}
return html;
}
this.print_license = function()
{
html = "## License\n";

View File

@ -9,7 +9,7 @@ function Hint()
{
ronin.commander.el.appendChild(this.el);
ronin.commander.el.appendChild(this.cursor_hint_el);
this.cursor_hint_el.innerHTML = "Hello";
this.cursor_hint_el.innerHTML = "";
}
this.find_autocomplete = function(collection,append = "")

View File

@ -18,6 +18,7 @@ function Keyboard()
ronin.commander.input_el.value = "";
ronin.guide.update();
ronin.guide.clear();
ronin.guide.inspect = false;
ronin.preview.clear();
}
@ -38,6 +39,8 @@ function Keyboard()
if(e.key == "n" && (e.ctrlKey || e.metaKey)){
e.preventDefault();
ronin.guide.inspect = false;
ronin.guide.clear();
ronin.render.clear();
}

View File

@ -3,7 +3,7 @@ function Guide()
Layer.call(this);
this.el.id = "guide";
this.inspect = true;
this.inspect = false;
this.update = function()
{
@ -16,6 +16,10 @@ function Guide()
var units = this.find_units();
if(this.inspect){
this.draw_inspector();
}
if(units.length == 0){ return; }
for(i in units){
@ -32,9 +36,6 @@ function Guide()
this.draw_rect(u);
this.draw_pos({x:u.x + (u.width/2),y:u.y + (u.height/2)});
}
if(this.inspect){
this.draw_inspector();
}
}
this.draw_rect = function(u)
@ -128,7 +129,6 @@ function Guide()
this.draw_inspector = function()
{
//
this.draw_line({x:ronin.frame.width/2,y:0},{x:ronin.frame.width/2,y:ronin.frame.height},"red");
this.draw_line({x:0,y:ronin.frame.height/2},{x:ronin.frame.width,y:ronin.frame.height/2},"red");

View File

@ -2,7 +2,7 @@ function Brush()
{
Module.call(this,"brush");
this.settings = {size:4,color:"#000",opacity:1.0};
this.settings = {size:4,color:"#000"};
this.pointers = [
new Pointer({offset:{x:0,y:0}}),

View File

@ -42,8 +42,8 @@ function Frame()
});
this.methods.inspect = new Method("inspect","","View canvas details",function(q){
ronin.layers.guide.inspect = ronin.layers.guide.inspect ? false : true;
ronin.layers.guide.draw();
ronin.guide.inspect = ronin.guide.inspect ? false : true;
ronin.guide.draw();
});
this.resize_to = function(size)