Skip to content

Commit 33fc803

Browse files
committed
type improvments
Added a global declaration for plotLineThick on the window object in bench-thick-improvements.ts for better type safety and Playwright/debug access. Updated bench2.js to simplify lineConfigs mapping. Added a global require comment in check-thick-line-playwright.js.
1 parent c75c40a commit 33fc803

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

benchmark/bench-thick-improvements.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { setupCanvasAndWebGL, WebglLineThick, clearCanvas, LineConfig } from "../src/webglplot";
22

3+
declare global {
4+
interface Window {
5+
plotLineThick: WebglLineThick;
6+
}
7+
}
8+
39
const fpsElem = document.getElementById("fps");
410
const statusElem = document.getElementById("status");
511

@@ -15,7 +21,7 @@ const gl = setupCanvasAndWebGL(canvas, {
1521
});
1622

1723
const plotLine = new WebglLineThick(gl, 10);
18-
(window as any).plotLineThick = plotLine; // Expose for Playwright/debug reads
24+
window.plotLineThick = plotLine; // Expose for Playwright/debug reads
1925

2026
let frameCount = 0;
2127
let lastTime = performance.now();

benchmark/bench2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const createLines = (num) => {
3030
plotLine = new WebglLinePlot(gl, lines.length);
3131

3232
// Initialize lines with WebglLinePlot
33-
const lineConfigs = lines.map((line, index) => ({
33+
const lineConfigs = lines.map(() => ({
3434
points: new Float32Array(numX * 2), // Will be updated in render loop
3535
color: [Math.random(), Math.random(), Math.random(), 1],
3636
thickness: 1.0,

benchmark/check-thick-line-playwright.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global require */
12
const { chromium } = require("playwright");
23

34
// Render a single line (horizontal or vertical) with a given transform and measure its pixel thickness.

0 commit comments

Comments
 (0)