Added full arc tools

This commit is contained in:
Devine Lu Linvega 2018-11-09 11:41:41 +13:00
parent b311ec1a2f
commit 8e283e4895
3 changed files with 9 additions and 1 deletions

View File

@ -58,6 +58,8 @@
DOTGRID.controller.add("default","Stroke","Arc Rev",() => { DOTGRID.tool.cast("arc_r")},"D"); // 0,0
DOTGRID.controller.add("default","Stroke","Bezier",() => { DOTGRID.tool.cast("bezier") },"F");
DOTGRID.controller.add("default","Stroke","Close",() => { DOTGRID.tool.cast("close") },"Z");
DOTGRID.controller.add("default","Stroke","Arc(full)",() => { DOTGRID.tool.cast("arc_c_full"); },"S+Shift"); // 1,1
DOTGRID.controller.add("default","Stroke","Arc Rev(full)",() => { DOTGRID.tool.cast("arc_r_full")},"D+Shift"); // 1,0
DOTGRID.controller.add("default","Effect","Linecap",() => { DOTGRID.tool.toggle("linecap"); },"Q");
DOTGRID.controller.add("default","Effect","Linejoin",() => { DOTGRID.tool.toggle("linejoin"); },"W");

View File

@ -54,6 +54,12 @@ function Generator (layer, style) {
} else if (type == 'arc_r') {
let clock = mirror > 0 ? '0,1' : '0,0'
html += next ? `A${Math.abs(next.x - vertex.x)},${Math.abs(next.y - vertex.y)} 0 ${clock} ${next.x},${next.y} ` : ''
} else if (type == 'arc_c_full') {
let clock = mirror > 0 ? '1,0' : '1,1'
html += next ? `A${Math.abs(next.x - vertex.x)},${Math.abs(next.y - vertex.y)} 0 ${clock} ${next.x},${next.y} ` : ''
} else if (type == 'arc_r_full') {
let clock = mirror > 0 ? '1,1' : '1,0'
html += next ? `A${Math.abs(next.x - vertex.x)},${Math.abs(next.y - vertex.y)} 0 ${clock} ${next.x},${next.y} ` : ''
} else if (type == 'bezier') {
html += next && after_next ? `Q${next.x},${next.y} ${after_next.x},${after_next.y} ` : ''
skip = 1

View File

@ -10,7 +10,7 @@ DOTGRID.Tool = function () {
{ thickness: 10, strokeLinecap: 'round', strokeLinejoin: 'round', color: '#00f', fill: 'none', mirror_style: 0 }
]
this.vertices = []
this.reqs = { line: 2, arc_c: 2, arc_r: 2, bezier: 3, close: 0 }
this.reqs = { line: 2, arc_c: 2, arc_r: 2, arc_c_full: 2, arc_r_full: 2, bezier: 3, close: 0 }
this.start = function () {
this.styles[0].color = DOTGRID.theme.active.f_high