diff --git a/svelte-app/src/lib/canvas/hit-testing.ts b/svelte-app/src/lib/canvas/hit-testing.ts
index 2dba00c..9751426 100644
--- a/svelte-app/src/lib/canvas/hit-testing.ts
+++ b/svelte-app/src/lib/canvas/hit-testing.ts
@@ -170,7 +170,7 @@ function pointInEpc(px: number, py: number, sym: PlacedSymbol): boolean {
const last = waypoints[waypoints.length - 1];
const prev = waypoints[waypoints.length - 2];
const plx = ox + last.x, ply = oy + last.y;
- const angle = Math.atan2(ply - (oy + prev.y), plx - (ox + prev.x));
+ const angle = Math.atan2(ply - (oy + prev.y), plx - (ox + prev.x)) - Math.PI / 2;
const cos = Math.cos(-angle), sin = Math.sin(-angle);
const dx = px - plx, dy = py - ply;
const lx = dx * cos - dy * sin, ly = dx * sin + dy * cos;
diff --git a/svelte-app/src/lib/canvas/renderer.ts b/svelte-app/src/lib/canvas/renderer.ts
index 8659018..d5ddfdd 100644
--- a/svelte-app/src/lib/canvas/renderer.ts
+++ b/svelte-app/src/lib/canvas/renderer.ts
@@ -186,6 +186,7 @@ function drawEpcSymbol(ctx: CanvasRenderingContext2D, sym: PlacedSymbol) {
ctx.fillStyle = THEME.epcBody.rightBoxFill;
ctx.strokeStyle = THEME.epcBody.rightBoxStroke;
ctx.lineWidth = THEME.epcBody.rightBoxStrokeWidth;
+ ctx.rotate(-Math.PI / 2);
ctx.fillRect(-rb.w, -rb.h / 2, rb.w, rb.h);
ctx.strokeRect(-rb.w, -rb.h / 2, rb.w, rb.h);
ctx.restore();
@@ -268,7 +269,7 @@ function traceEpcOutlinePath(ctx: CanvasRenderingContext2D, sym: PlacedSymbol, p
ctx.save();
ctx.translate(plx, ply);
- ctx.rotate(rAngle);
+ ctx.rotate(rAngle - Math.PI / 2);
ctx.beginPath();
ctx.rect(-rb.w - pad, -rb.h / 2 - pad, rb.w + pad * 2, rb.h + pad * 2);
ctx.stroke();
diff --git a/svelte-app/src/lib/export.ts b/svelte-app/src/lib/export.ts
index c341051..2e7a98b 100644
--- a/svelte-app/src/lib/export.ts
+++ b/svelte-app/src/lib/export.ts
@@ -181,7 +181,7 @@ async function emitEpc(lines: string[], sym: PlacedSymbol, label: string, outerT
parts.push(` `);
}
} catch {
- parts.push(` `);
+ parts.push(` `);
}
// Right box
@@ -191,7 +191,7 @@ async function emitEpc(lines: string[], sym: PlacedSymbol, label: string, outerT
const ppx = ox + prev.x, ppy = oy + prev.y;
const rAngle = Math.atan2(ply - ppy, plx - ppx) * 180 / Math.PI;
const rb = EPC_CONFIG.rightBox;
- parts.push(` `);
+ parts.push(` `);
}
lines.push(` `);