Starting implementing path and magnet

This commit is contained in:
Devine Lu Linvega 2017-09-28 09:38:36 +13:00
parent a8f1c92906
commit f6efcc1093
16 changed files with 109 additions and 24 deletions

View File

@ -5,6 +5,9 @@ Ronin is a simple open-source graphic design tool.
## Modules ## Modules
## brush ## brush
Missing documentation.
### Settings ### Settings
- `size`, default 4 - `size`, default 4
- `color`, default #000 - `color`, default #000
@ -19,14 +22,10 @@ Ronin is a simple open-source graphic design tool.
- `->green->` **(0/255)** The brush color value(green). - `->green->` **(0/255)** The brush color value(green).
- `->blue->` **(0/255)** The brush color value(blue). - `->blue->` **(0/255)** The brush color value(blue).
## eraser
### Settings
### Methods
### Ports
## frame ## frame
Missing documentation.
### Settings ### Settings
- `width`, default 930 - `width`, default 930
- `height`, default 540 - `height`, default 540
@ -39,6 +38,9 @@ Ronin is a simple open-source graphic design tool.
### Ports ### Ports
## line ## line
Missing documentation.
### Settings ### Settings
### Methods ### Methods
@ -49,6 +51,45 @@ Ronin is a simple open-source graphic design tool.
- `step->` **(0/100)** The tween line index.. - `step->` **(0/100)** The tween line index..
- `->thickness->` **(4/100)** The tween line thickness.. - `->thickness->` **(4/100)** The tween line thickness..
## io
Missing documentation.
### Settings
- `anchor`, default [object Object]
### Methods
- `import:`, no details.
- `load:`, no details.
- `save:`, no details.
### Ports
## path
Missing documentation.
### Settings
### Methods
- `stroke:`, no details.
- `fill:`, no details.
### Ports
## magnet
Cursor magnetisation settings.
### Settings
- `size`, default 15
- `rate`, default 4
### Methods
- `lock:`, no details.
### Ports
## License ## License
See the [LICENSE](LICENSE.md) file for license rights and limitations (CC). See the [LICENSE](LICENSE.md) file for license rights and limitations (CC).

View File

@ -1,26 +1,27 @@
<html> <html>
<head> <head>
<script type="text/javascript" src="scripts/units/rect.js"></script> <script type="text/javascript" src="scripts/core/module.js"></script>
<script type="text/javascript" src="scripts/module.js"></script>
<script type="text/javascript" src="scripts/modules/frame.js"></script> <script type="text/javascript" src="scripts/modules/frame.js"></script>
<script type="text/javascript" src="scripts/modules/brush.js"></script> <script type="text/javascript" src="scripts/modules/brush.js"></script>
<script type="text/javascript" src="scripts/modules/eraser.js"></script> <script type="text/javascript" src="scripts/modules/eraser.js"></script>
<script type="text/javascript" src="scripts/modules/line.js"></script> <script type="text/javascript" src="scripts/modules/line.js"></script>
<script type="text/javascript" src="scripts/modules/io.js"></script> <script type="text/javascript" src="scripts/modules/io.js"></script>
<script type="text/javascript" src="scripts/modules/path.js"></script>
<script type="text/javascript" src="scripts/modules/magnet.js"></script>
<script type="text/javascript" src="scripts/layer.js"></script> <script type="text/javascript" src="scripts/core/layer.js"></script>
<script type="text/javascript" src="scripts/layers/grid.js"></script> <script type="text/javascript" src="scripts/layers/grid.js"></script>
<script type="text/javascript" src="scripts/layers/guide.js"></script> <script type="text/javascript" src="scripts/layers/guide.js"></script>
<script type="text/javascript" src="scripts/layers/render.js"></script> <script type="text/javascript" src="scripts/layers/render.js"></script>
<script type="text/javascript" src="scripts/docs.js"></script> <script type="text/javascript" src="scripts/core/docs.js"></script>
<script type="text/javascript" src="scripts/port.js"></script> <script type="text/javascript" src="scripts/core/port.js"></script>
<script type="text/javascript" src="scripts/query.js"></script> <script type="text/javascript" src="scripts/core/query.js"></script>
<script type="text/javascript" src="scripts/keyboard.js"></script> <script type="text/javascript" src="scripts/core/keyboard.js"></script>
<script type="text/javascript" src="scripts/cursor.js"></script> <script type="text/javascript" src="scripts/core/cursor.js"></script>
<script type="text/javascript" src="scripts/hint.js"></script> <script type="text/javascript" src="scripts/core/hint.js"></script>
<script type="text/javascript" src="scripts/commander.js"></script> <script type="text/javascript" src="scripts/core/commander.js"></script>
<script type="text/javascript" src="scripts/ronin.js"></script> <script type="text/javascript" src="scripts/ronin.js"></script>
<link rel="stylesheet" type="text/css" href="links/reset.css"/> <link rel="stylesheet" type="text/css" href="links/reset.css"/>

View File

@ -34,7 +34,8 @@ function Docs()
for(module_name in modules){ for(module_name in modules){
var module = modules[module_name]; var module = modules[module_name];
html += "## "+module_name+"\n"; html += "## "+module_name+"\n\n";
html += module.docs+"\n\n";
html += this.print_settings(module.settings)+"\n"; html += this.print_settings(module.settings)+"\n";
html += this.print_methods(module.methods)+"\n"; html += this.print_methods(module.methods)+"\n";
html += this.print_ports(module.ports)+"\n"; html += this.print_ports(module.ports)+"\n";

View File

@ -33,6 +33,16 @@ function Keyboard()
ronin.render.clear(); ronin.render.clear();
} }
if(e.key == "o" && (e.ctrlKey || e.metaKey)){
e.preventDefault();
ronin.io.load();
}
if(e.key == "s" && (e.ctrlKey || e.metaKey)){
e.preventDefault();
ronin.io.save();
}
if(e.key == "r" && (e.ctrlKey || e.metaKey)){ if(e.key == "r" && (e.ctrlKey || e.metaKey)){
e.preventDefault(); e.preventDefault();
ronin.io.render(); ronin.io.render();

View File

@ -1,10 +1,11 @@
function Module(name) function Module(name,docs = "Missing documentation.")
{ {
this.name = name; this.name = name;
this.methods = {}; this.methods = {};
this.settings = {}; this.settings = {};
this.routes = {}; this.routes = {};
this.ports = {}; this.ports = {};
this.docs = docs;
this.hint = function() this.hint = function()
{ {

View File

@ -24,6 +24,16 @@ function IO()
}); });
} }
this.methods.load = function(q)
{
// TODO
}
this.methods.save = function(q)
{
// TODO
}
this.render = function() this.render = function()
{ {
var fs = require('fs'); var fs = require('fs');

View File

@ -0,0 +1,11 @@
function Magnet()
{
Module.call(this,"magnet","Cursor magnetisation settings.");
this.settings = {size:15,rate:4};
this.methods.lock = function()
{
}
}

View File

@ -1,4 +1,14 @@
function Path() function Path()
{ {
Module.call(this,"path"); Module.call(this,"path");
this.methods.stroke = function()
{
}
this.methods.fill = function()
{
}
} }

View File

@ -18,6 +18,8 @@ function Ronin()
this.eraser = new Eraser(); this.eraser = new Eraser();
this.frame = new Frame(); this.frame = new Frame();
this.line = new Line(); this.line = new Line();
this.path = new Path();
this.magnet = new Magnet();
this.layers = { this.layers = {
grid : this.grid, grid : this.grid,
@ -30,6 +32,8 @@ function Ronin()
frame : this.frame, frame : this.frame,
line : this.line, line : this.line,
io : this.io, io : this.io,
path : this.path,
magnet : this.magnet
}; };
this.install = function() this.install = function()

View File

@ -1,4 +0,0 @@
function Rect(rect_str)
{
}