1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-27 10:15:05 +02:00

two sections left

This commit is contained in:
Pomax
2016-01-09 18:39:09 -08:00
parent 2ee641554c
commit 9ede7b4143
47 changed files with 6520 additions and 794 deletions

View File

@@ -239,13 +239,17 @@ var Graphic = React.createClass({
this.refs.canvas.height = h;
},
setCurves: function(c) {
this.setCurve(c);
},
setCurve: function(c) {
var pts = [];
c = Array.prototype.slice.call(arguments);
c = (typeof c === "array") ? c : Array.prototype.slice.call(arguments);
c.forEach(nc => {
pts = pts.concat(nc.points);
});
this.curve = c.length === 1 ? c[0] : c;
this.curve = (c.length === 1) ? c[0] : c;
this.lpts = pts;
},
@@ -333,8 +337,11 @@ var Graphic = React.createClass({
if(pts.length>2) {
this.ctx.strokeStyle = "lightgrey";
this.drawLine(pts[0], pts[1], offset);
if(pts.length === 3) { this.drawLine(pts[1], pts[2], offset); }
else {this.drawLine(pts[2], pts[3], offset); }
var last = pts.length-2;
for (var i=1; i<last; i++) {
this.drawLine(pts[i], pts[i+1], offset);
}
this.drawLine(pts[last], pts[last+1], offset);
}
this.ctx.strokeStyle = "black";
this.drawPoints(pts, offset);