Massive update, incl. dynamic documentation.

This commit is contained in:
Devine Lu Linvega
2016-12-09 05:22:55 -07:00
parent c32c009256
commit 78b2d13de8
27 changed files with 222 additions and 188 deletions

View File

@@ -1,7 +1,9 @@
function Angle(angle_str)
function Angle(angle_str = "0'")
{
Unit.call(this);
this.example = "45'";
this.degrees = parseFloat(angle_str.replace('\'',''));
this.render = function()

View File

@@ -2,6 +2,7 @@ function Any(str)
{
Unit.call(this);
this.example = "";
this.string = str;
this.render = function()

View File

@@ -2,6 +2,8 @@ function Bang()
{
Unit.call(this);
this.example = "";
this.render = function()
{
return "BANG";

View File

@@ -2,6 +2,7 @@ function Color(hex = '#000000')
{
Unit.call(this);
this.example = "#ff0000";
this.hex = hex;
this.rgb = function()

View File

@@ -2,6 +2,7 @@ function Filepath(path_str)
{
Unit.call(this);
this.example = "assets/demo.png";
this.path = path_str;
this.render = function()

View File

@@ -2,6 +2,7 @@ function Position(position_str = "0,0",y = null)
{
Unit.call(this);
this.example = "100,150";
this.position_str = position_str;
this.x = y ? position_str : parseFloat(this.position_str.split(",")[0]);

15
scripts/units/range.js Normal file
View File

@@ -0,0 +1,15 @@
function Range(range_str)
{
Unit.call(this);
this.example = "10..50";
this.range_str = range_str;
this.from = parseFloat(this.range_str.split("..")[0]);
this.to = parseFloat(this.range_str.split("..")[1]);
this.render = function()
{
return this.from+".."+this.to;
}
}

View File

@@ -2,6 +2,7 @@ function Rect(rect_str)
{
Unit.call(this);
this.example = "200x300";
this.rect_str = rect_str;
this.width = rect_str ? parseFloat(this.rect_str.split("x")[0]) : 0;

View File

@@ -2,6 +2,7 @@ function Value(value_str)
{
Unit.call(this);
this.example = "20";
this.value = value_str;
this.float = parseFloat(this.value);
this.int = parseInt(this.value);

13
scripts/units/variable.js Normal file
View File

@@ -0,0 +1,13 @@
function Variable(key,value)
{
Unit.call(this);
this.candidates = [];
this.key = key;
this.value = value;
this.render = function()
{
return this.key+"="+this.value;
}
}