Started implementing options

This commit is contained in:
Devine Lu Linvega
2018-08-03 12:53:26 +12:00
parent 6027918884
commit 9eabe68ba3
5 changed files with 66 additions and 66 deletions

View File

@@ -158,6 +158,29 @@ function Tool()
console.log(`Casted ${type} -> ${this.layer().length} elements`);
}
this.i = { linecap:0,linejoin:0,thickness:5 }
this.toggle = function(type,mod = 1)
{
if(type == "linecap"){
var a = ["butt","square","round"];
this.i.linecap += mod;
this.style().strokeLinecap = a[this.i.linecap % a.length];
}
if(type == "linejoin"){
var a = ["miter","round","bevel"];
this.i.linejoin += mod;
this.style().strokeLinejoin = a[this.i.linejoin % a.length];
}
if(type == "fill"){
this.style().fill = this.style().fill == "none" ? this.style().color : "none";
}
if(type == "thickness"){
this.style().thickness = clamp(this.style().thickness+mod,1,40);
}
dotgrid.guide.refresh();
}
this.can_append = function(content)
{
for(id in this.layer()){