- Delete old Vite+Svelte frontend - Initialize new SvelteKit project with TypeScript - Configure Tailwind CSS v4 + DaisyUI - Implement JWT authentication with auto-refresh - Create login page with form validation (Zod) - Add protected route guards - Update Docker configuration for single-stage build - Add E2E tests with Playwright (6/11 passing) - Fix Svelte 5 reactivity with $state() runes Known issues: - 5 E2E tests failing (timing/async issues) - Token refresh implementation needs debugging - Validation error display timing
76 lines
1.7 KiB
JavaScript
76 lines
1.7 KiB
JavaScript
import pointRadial from "../pointRadial.js";
|
|
|
|
class Bump {
|
|
constructor(context, x) {
|
|
this._context = context;
|
|
this._x = x;
|
|
}
|
|
areaStart() {
|
|
this._line = 0;
|
|
}
|
|
areaEnd() {
|
|
this._line = NaN;
|
|
}
|
|
lineStart() {
|
|
this._point = 0;
|
|
}
|
|
lineEnd() {
|
|
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
|
this._line = 1 - this._line;
|
|
}
|
|
point(x, y) {
|
|
x = +x, y = +y;
|
|
switch (this._point) {
|
|
case 0: {
|
|
this._point = 1;
|
|
if (this._line) this._context.lineTo(x, y);
|
|
else this._context.moveTo(x, y);
|
|
break;
|
|
}
|
|
case 1: this._point = 2; // falls through
|
|
default: {
|
|
if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);
|
|
else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);
|
|
break;
|
|
}
|
|
}
|
|
this._x0 = x, this._y0 = y;
|
|
}
|
|
}
|
|
|
|
class BumpRadial {
|
|
constructor(context) {
|
|
this._context = context;
|
|
}
|
|
lineStart() {
|
|
this._point = 0;
|
|
}
|
|
lineEnd() {}
|
|
point(x, y) {
|
|
x = +x, y = +y;
|
|
if (this._point === 0) {
|
|
this._point = 1;
|
|
} else {
|
|
const p0 = pointRadial(this._x0, this._y0);
|
|
const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y) / 2);
|
|
const p2 = pointRadial(x, this._y0);
|
|
const p3 = pointRadial(x, y);
|
|
this._context.moveTo(...p0);
|
|
this._context.bezierCurveTo(...p1, ...p2, ...p3);
|
|
}
|
|
this._x0 = x, this._y0 = y;
|
|
}
|
|
}
|
|
|
|
export function bumpX(context) {
|
|
return new Bump(context, true);
|
|
}
|
|
|
|
export function bumpY(context) {
|
|
return new Bump(context, false);
|
|
}
|
|
|
|
export function bumpRadial(context) {
|
|
return new BumpRadial(context);
|
|
}
|