1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-20 23:41:49 +02:00

cleanup based on uglify feedback

This commit is contained in:
Pomax
2016-01-09 23:31:52 -08:00
parent b3da8f4f74
commit 6dffa0ff0f
16 changed files with 38 additions and 35233 deletions

View File

@@ -2,8 +2,6 @@ var React = require("react");
var Graphic = require("../../Graphic.jsx");
var SectionHeader = require("../../SectionHeader.jsx");
var abs = Math.abs;
var ABC = React.createClass({
getDefaultProps: function() {
return {
@@ -88,7 +86,6 @@ var ABC = React.createClass({
api.reset();
api.setColor("black");
var w = api.getPanelWidth();
var h = api.getPanelHeight();
var pad = 20;
var fwh = w - 2*pad;
api.drawAxes(pad, "t",0,1, "u",0,1);

View File

@@ -2,9 +2,6 @@ var React = require("react");
var Graphic = require("../../Graphic.jsx");
var SectionHeader = require("../../SectionHeader.jsx");
var sin = Math.sin;
var tau = Math.PI*2;
var ArclengthApprox = React.createClass({
getDefaultProps: function() {
return {

View File

@@ -1,5 +1,4 @@
var React = require("react");
var Graphic = require("../../Graphic.jsx");
var SectionHeader = require("../../SectionHeader.jsx");
var CatmullRomConversion = React.createClass({

View File

@@ -2,7 +2,7 @@ var React = require("react");
var Graphic = require("../../Graphic.jsx");
var SectionHeader = require("../../SectionHeader.jsx");
var sin = Math.sin, cos = Math.cos, tan = Math.tan, abs = Math.abs;
var sin = Math.sin, cos = Math.cos, tan = Math.tan;
var CirclesCubic = React.createClass({
getDefaultProps: function() {
@@ -100,7 +100,6 @@ var CirclesCubic = React.createClass({
api.drawCircle(guess.points[2], 3);
// real curve
var offset = {x:api.w, y:0};
api.drawSkeleton(curve);
api.setColor("black");
api.drawLine(curve.points[1], curve.points[2]);

View File

@@ -56,7 +56,7 @@ var Control = React.createClass({
var p = api.hover;
if (p && p.x >= pad && p.x <= dim-pad) {
this.drawLerpBox(api, dim, pad, p);
var t = (p.x-pad)/fwh, tf;
var t = (p.x-pad)/fwh;
this.drawLerpPoint(api, (1-t)*(1-t), pad, fwh, p);
this.drawLerpPoint(api, 2*(1-t)*(t), pad, fwh, p);
this.drawLerpPoint(api, (t)*(t), pad, fwh, p);
@@ -94,7 +94,7 @@ var Control = React.createClass({
var p = api.hover;
if (p && p.x >= pad && p.x <= dim-pad) {
this.drawLerpBox(api, dim, pad, p);
var t = (p.x-pad)/fwh, tf;
var t = (p.x-pad)/fwh;
this.drawLerpPoint(api, (1-t)*(1-t)*(1-t), pad, fwh, p);
this.drawLerpPoint(api, 2*(1-t)*(1-t)*(t), pad, fwh, p);
this.drawLerpPoint(api, 3*(1-t)*(t)*(t), pad, fwh, p);

View File

@@ -45,7 +45,6 @@ var CurveIntersections = React.createClass({
if(this.step !== this.prevstep) {
var pairs = this.pairs;
var clen = pairs.length;
this.pairs = [];
this.finals = [];
pairs.forEach(p => {

View File

@@ -1,5 +1,4 @@
var React = require("react");
var Graphic = require("../../Graphic.jsx");
var SectionHeader = require("../../SectionHeader.jsx");
var Derivatives = React.createClass({

View File

@@ -31,8 +31,7 @@ var Extremities = React.createClass({
pts = curve.points,
w = api.getPanelWidth(),
h = api.getPanelHeight(),
offset = { x: w, y: 0 },
extremities;
offset = { x: w, y: 0 };
var x_pts = JSON.parse(JSON.stringify(pts)).map((p,t) => { return {x:w*t/tf, y:p.x}; });
api.setColor("black");

View File

@@ -1,5 +1,4 @@
var React = require("react");
var Graphic = require("../../Graphic.jsx");
var SectionHeader = require("../../SectionHeader.jsx");
var MatrixSplit = React.createClass({

View File

@@ -68,8 +68,8 @@ var Moulding = React.createClass({
curve = api.curve,
hull = curve.hull(t),
A = api.A = hull[5],
B = api.B = curve.get(t),
db = api.db = curve.derivative(t);
B = api.B = curve.get(t);
api.db = curve.derivative(t);
api.C = api.utils.lli4(A, B, curve.points[0], curve.points[3]);
api.ratio = ratio;
}
@@ -82,23 +82,17 @@ var Moulding = React.createClass({
x: evt.offsetX,
y: evt.offsetY
};
// find the current ABC and ratio values:
var A = api.A;
var B = api.B;
var C = api.C;
// now that we know A, B, C and the AB:BC ratio, we can compute the new A' based on the desired B'
var newA = api.newA = {
x: newB.x - (C.x - newB.x) / api.ratio,
y: newB.y - (C.y - newB.y) / api.ratio
api.newA = {
x: newB.x - (api.C.x - newB.x) / api.ratio,
y: newB.y - (api.C.y - newB.y) / api.ratio
};
},
dragQB: function(evt, api) {
if (!api.t) return;
this.drag(evt, api);
var curve = api.curve;
api.update = [api.newA];
},

View File

@@ -45,9 +45,7 @@ var PointCurves = React.createClass({
},
drawQuadratic: function(api, curve) {
var w = api.getPanelWidth(),
h = api.getPanelHeight(),
labels = ["start","t=0.5","end"];
var labels = ["start","t=0.5","end"];
api.reset();
@@ -90,9 +88,7 @@ var PointCurves = React.createClass({
},
drawCubic: function(api, curve) {
var w = api.getPanelWidth(),
h = api.getPanelHeight(),
labels = ["start","t=0.5","end"];
var labels = ["start","t=0.5","end"];
api.reset();