mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-25 17:42:46 +02:00
tracing
This commit is contained in:
@@ -26,12 +26,6 @@ class GraphicsAPI extends BaseAPI {
|
||||
`CENTER`,
|
||||
`LEFT`,
|
||||
`RIGHT`,
|
||||
`HATCH1`,
|
||||
`HATCH2`,
|
||||
`HATCH3`,
|
||||
`HATCH4`,
|
||||
`HATCH5`,
|
||||
`HATCH6`,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -608,7 +602,7 @@ class GraphicsAPI extends BaseAPI {
|
||||
/**
|
||||
* convenient axis drawing function
|
||||
*
|
||||
* api.drawAxes(pad, "t",0,1, "S","0%","100%");
|
||||
* api.drawAxes("t",0,1, "S","0%","100%");
|
||||
*
|
||||
*/
|
||||
drawAxes(hlabel, hs, he, vlabel, vs, ve, w, h) {
|
||||
@@ -619,12 +613,12 @@ class GraphicsAPI extends BaseAPI {
|
||||
this.line(0, 0, 0, h);
|
||||
|
||||
const hpos = 0 - 5;
|
||||
this.text(`${hlabel} →`, this.width / 2, hpos, this.CENTER);
|
||||
this.text(`${hlabel} →`, w / 2, hpos, this.CENTER);
|
||||
this.text(hs, 0, hpos, this.CENTER);
|
||||
this.text(he, w, hpos, this.CENTER);
|
||||
|
||||
const vpos = -10;
|
||||
this.text(`${vlabel}\n↓`, vpos, this.height / 2, this.RIGHT);
|
||||
this.text(`${vlabel}\n↓`, vpos, h / 2, this.RIGHT);
|
||||
this.text(vs, vpos, 0 + 5, this.RIGHT);
|
||||
this.text(ve, vpos, h, this.RIGHT);
|
||||
}
|
||||
|
@@ -6,14 +6,29 @@ import { Bezier as Original } from "../../lib/bezierjs/bezier.js";
|
||||
*/
|
||||
class Bezier extends Original {
|
||||
static defaultQuadratic(apiInstance) {
|
||||
if (!apiInstance) {
|
||||
throw new Error(
|
||||
`missing reference of API instance in Bezier.defaultQuadratic(instance)`
|
||||
);
|
||||
}
|
||||
return new Bezier(apiInstance, 70, 250, 20, 110, 220, 60);
|
||||
}
|
||||
|
||||
static defaultCubic(apiInstance) {
|
||||
if (!apiInstance) {
|
||||
throw new Error(
|
||||
`missing reference of API instance in Bezier.defaultCubic(instance)`
|
||||
);
|
||||
}
|
||||
return new Bezier(apiInstance, 110, 150, 25, 190, 210, 250, 210, 30);
|
||||
}
|
||||
|
||||
constructor(apiInstance, ...coords) {
|
||||
if (!apiInstance || !apiInstance.setMovable) {
|
||||
throw new Error(
|
||||
`missing reference of API instance in Bezier constructor`
|
||||
);
|
||||
}
|
||||
super(...coords);
|
||||
this.api = apiInstance;
|
||||
this.ctx = apiInstance.ctx;
|
||||
@@ -74,7 +89,7 @@ class Bezier extends Original {
|
||||
drawCurve(color = `#333`) {
|
||||
const ctx = this.ctx;
|
||||
ctx.cacheStyle();
|
||||
ctx.lineWidth = 2;
|
||||
ctx.lineWidth = 1;
|
||||
ctx.strokeStyle = color;
|
||||
ctx.beginPath();
|
||||
const lut = this.getLUT().slice();
|
||||
|
Reference in New Issue
Block a user