Fixed #27
This commit is contained in:
parent
a971cd3405
commit
e71b577cec
@ -139,6 +139,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
this.controller.add("default","Effect","Linecap",() => { dotgrid.mod_linecap(); },"Q");
|
||||
this.controller.add("default","Effect","Linejoin",() => { dotgrid.mod_linejoin(); },"W");
|
||||
this.controller.add("default","Effect","Mirror",() => { dotgrid.mod_mirror(); },"E");
|
||||
this.controller.add("default","Effect","Fill",() => { dotgrid.mod_fill(); },"R");
|
||||
|
||||
this.controller.add("default","Effect","Thicker",() => { dotgrid.mod_thickness(1) },"}");
|
||||
this.controller.add("default","Effect","Thinner",() => { dotgrid.mod_thickness(-1) },"{");
|
||||
@ -281,6 +282,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
if(o == "linecap"){ this.mod_linecap(); }
|
||||
if(o == "linejoin"){ this.mod_linejoin(); }
|
||||
if(o == "mirror"){ this.mod_mirror(); }
|
||||
if(o == "fill"){ this.mod_fill(); }
|
||||
if(o == "color"){ setTimeout(()=>{ this.picker.start(); }, 100) }
|
||||
if(o == "depth"){ this.tool.select_next_layer(); }
|
||||
|
||||
@ -405,6 +407,12 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
this.draw();
|
||||
}
|
||||
|
||||
this.mod_fill = function()
|
||||
{
|
||||
this.tool.style().fill = this.tool.style().fill == "none" ? this.tool.style().color : "none";
|
||||
this.draw();
|
||||
}
|
||||
|
||||
this.set_size = function(size = {width:300,height:300},interface = true)
|
||||
{
|
||||
var win = require('electron').remote.getCurrentWindow();
|
||||
@ -447,28 +455,34 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
this.layer_1.style.strokeLinecap = this.tool.styles[0].strokeLinecap;
|
||||
this.layer_1.style.strokeLinejoin = this.tool.styles[0].strokeLinejoin;
|
||||
this.layer_1.style.stroke = this.tool.styles[0].color;
|
||||
this.layer_1.style.fill = this.tool.styles[0].fill;
|
||||
this.mirror_layer_1.style.strokeWidth = this.tool.styles[0].thickness;
|
||||
this.mirror_layer_1.style.strokeLinecap = this.tool.styles[0].strokeLinecap;
|
||||
this.mirror_layer_1.style.strokeLinejoin = this.tool.styles[0].strokeLinejoin;
|
||||
this.mirror_layer_1.style.stroke = this.tool.styles[0].color;
|
||||
this.mirror_layer_1.style.fill = this.tool.styles[0].fill;
|
||||
|
||||
this.layer_2.style.strokeWidth = this.tool.styles[1].thickness;
|
||||
this.layer_2.style.strokeLinecap = this.tool.styles[1].strokeLinecap;
|
||||
this.layer_2.style.strokeLinejoin = this.tool.styles[1].strokeLinejoin;
|
||||
this.layer_2.style.stroke = this.tool.styles[1].color;
|
||||
this.layer_2.style.fill = this.tool.styles[1].fill;
|
||||
this.mirror_layer_2.style.strokeWidth = this.tool.styles[1].thickness;
|
||||
this.mirror_layer_2.style.strokeLinecap = this.tool.styles[1].strokeLinecap;
|
||||
this.mirror_layer_2.style.strokeLinejoin = this.tool.styles[1].strokeLinejoin;
|
||||
this.mirror_layer_2.style.stroke = this.tool.styles[1].color;
|
||||
this.mirror_layer_2.style.fill = this.tool.styles[1].fill;
|
||||
|
||||
this.layer_3.style.strokeWidth = this.tool.styles[2].thickness;
|
||||
this.layer_3.style.strokeLinecap = this.tool.styles[2].strokeLinecap;
|
||||
this.layer_3.style.strokeLinejoin = this.tool.styles[2].strokeLinejoin;
|
||||
this.layer_3.style.stroke = this.tool.styles[2].color;
|
||||
this.layer_3.style.fill = this.tool.styles[2].fill;
|
||||
this.mirror_layer_3.style.strokeWidth = this.tool.styles[2].thickness;
|
||||
this.mirror_layer_3.style.strokeLinecap = this.tool.styles[2].strokeLinecap;
|
||||
this.mirror_layer_3.style.strokeLinejoin = this.tool.styles[2].strokeLinejoin;
|
||||
this.mirror_layer_3.style.stroke = this.tool.styles[2].color;
|
||||
this.mirror_layer_3.style.fill = this.tool.styles[2].fill;
|
||||
|
||||
// Draw Mirror
|
||||
if(this.mirror_index == 1){
|
||||
|
@ -28,6 +28,7 @@ function Picker()
|
||||
this.validate = function()
|
||||
{
|
||||
dotgrid.tool.style().color = this.el.value;
|
||||
dotgrid.tool.style().fill = dotgrid.tool.style().fill != "none" ? this.el.value : "none";
|
||||
dotgrid.draw();
|
||||
dotgrid.controller.set();
|
||||
dotgrid.interface.el.className = ""
|
||||
@ -38,6 +39,7 @@ function Picker()
|
||||
{
|
||||
if(!this.original){ return; }
|
||||
dotgrid.tool.style().color = this.original;
|
||||
dotgrid.tool.style().fill = dotgrid.tool.style().fill != "none" ? this.original : "none";
|
||||
dotgrid.draw();
|
||||
}
|
||||
|
||||
@ -46,6 +48,7 @@ function Picker()
|
||||
if(this.el.value.length != 4 && this.el.value.length != 7){ return; }
|
||||
|
||||
dotgrid.tool.style().color = this.el.value;
|
||||
dotgrid.tool.style().fill = dotgrid.tool.style().fill != "none" ? this.el.value : "none";
|
||||
dotgrid.draw();
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,9 @@ function Tool()
|
||||
this.index = 0;
|
||||
this.layers = [[],[],[]];
|
||||
this.styles = [
|
||||
{thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#f00"},
|
||||
{thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#0f0"},
|
||||
{thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#00f"}
|
||||
{thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#f00",fill:"none"},
|
||||
{thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#0f0",fill:"none"},
|
||||
{thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#00f",fill:"none"}
|
||||
];
|
||||
this.verteces = [];
|
||||
this.reqs = {line:2,arc_c:2,arc_r:2,bezier:3,close:0};
|
||||
|
Loading…
Reference in New Issue
Block a user