Progress on mouse_modes

This commit is contained in:
Devine Lu Linvega
2017-05-24 09:55:12 -10:00
parent 8765044fd5
commit f2ed407b85
33 changed files with 209 additions and 154 deletions

View File

@@ -33,7 +33,7 @@ function Color(hex = '#000000')
this.rgb_to_hex = function(rgb)
{
return "#"+("0" + parseInt(rgb[0],10).toString(16)).slice(-2)+("0" + parseInt(rgb[1],10).toString(16)).slice(-2)+("0" + parseInt(rgb[2],10).toString(16)).slice(-2);
return "#"+parseInt(rgb.r,10).toString(16)+parseInt(rgb.g,10).toString(16)+parseInt(rgb.b,10).toString(16);
}
this.brightness = function()

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

@@ -0,0 +1,13 @@
function Mode(name,key = "")
{
Unit.call(this);
this.host = null;
this.name = name;
this.key = key;
this.render = function()
{
return "?";
}
}

View File

@@ -1,16 +1,33 @@
function Setting(key,value)
function Setting(name,value)
{
Unit.call(this);
this.candidates = [];
this.key = key;
if(value == "true"){ this.value = true; }
else if(value == "false"){ this.value = false; }
else{ this.value = value; }
this.host = null;
this.name = name;
this.value = value;
this.render = function()
{
return this.key+"="+this.value;
return "?";
}
this.update = function(value)
{
this.value = value;
}
this.to_f = function()
{
return parseFloat(this.value);
}
this.to_rect = function()
{
return new Rect(this.value);
}
this.to_pos = function()
{
return new Position(this.value);
}
}