Skip to content

Commit b445ae1

Browse files
committed
v0.5.1
major bug fix for single page applications
1 parent b4d76b7 commit b445ae1

19 files changed

+556
-309
lines changed

benchmark/bench1.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ canvas.height = canvas.clientHeight * devicePixelRatio;
88

99
const numX = canvas.width;
1010

11-
const wglp = new WebGLplot(canvas);
11+
const wglp = new WebGLplot(canvas, { powerPerformance: "high-performance" });
1212

1313
const createLines = (num) => {
14-
wglp.lines = [];
14+
wglp.removeAllLines();
1515
for (let i = 0; i < num; i++) {
1616
const color = new ColorRGBA(Math.random(), Math.random(), Math.random(), 1);
1717
const line = new WebglLine(color, numX);

dist/WbglPolar.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/WbglPolar.js

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/WbglPolar.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/WebglBaseLine.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import { ColorRGBA } from "./ColorRGBA";
33
* Baseline class
44
*/
55
export declare class WebglBaseLine {
6-
private static readonly vertCode;
7-
private static readonly fragCode;
8-
private static program;
96
intensity: number;
107
visible: boolean;
118
/**
@@ -60,14 +57,11 @@ export declare class WebglBaseLine {
6057
* @private
6158
* @internal
6259
*/
63-
_prog: WebGLProgram;
6460
/**
6561
* @private
6662
* @internal
6763
*/
6864
_coord: number;
69-
initProgram(webgl: WebGLRenderingContext): void;
70-
private createProgram;
7165
/**
7266
* @internal
7367
*/

dist/WebglBaseLine.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/WebglBaseLine.js

Lines changed: 0 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/WebglBaseLine.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/webglplot.d.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Author Danial Chitnis 2019
2+
* Author Danial Chitnis 2019-20
33
*
44
* inspired by:
55
* https://codepen.io/AzazelN28
@@ -11,14 +11,22 @@ import { WebglStep } from "./WbglStep";
1111
import { WebglPolar } from "./WbglPolar";
1212
import { WebglBaseLine } from "./WebglBaseLine";
1313
export { WebglLine, ColorRGBA, WebglStep, WebglPolar };
14+
declare type WebGLPlotConfig = {
15+
antialias?: boolean;
16+
transparent?: boolean;
17+
powerPerformance?: "default" | "high-performance" | "low-power";
18+
deSync?: boolean;
19+
preserveDrawing?: boolean;
20+
debug?: boolean;
21+
};
1422
/**
1523
* The main class for the webgl-plot library
1624
*/
1725
export default class WebGLPlot {
1826
/**
1927
* @private
2028
*/
21-
private webgl;
29+
private readonly webgl;
2230
/**
2331
* Global horizontal scale factor
2432
* @default = 1.0
@@ -47,7 +55,8 @@ export default class WebGLPlot {
4755
/**
4856
* collection of lines in the plot
4957
*/
50-
lines: WebglBaseLine[];
58+
private _lines;
59+
private progThinLine;
5160
/**
5261
* log debug output
5362
*/
@@ -90,7 +99,8 @@ export default class WebGLPlot {
9099
* }
91100
* ```
92101
*/
93-
constructor(canvas: HTMLCanvasElement | OffscreenCanvas, debug?: boolean);
102+
constructor(canvas: HTMLCanvasElement | OffscreenCanvas, options?: WebGLPlotConfig);
103+
get lines(): WebglBaseLine[];
94104
/**
95105
* updates and redraws the content of the plot
96106
*/
@@ -106,11 +116,16 @@ export default class WebGLPlot {
106116
* wglp.addLine(line);
107117
* ```
108118
*/
109-
addLine(line: WebglBaseLine): void;
119+
addLine(line: WebglLine | WebglStep | WebglPolar): void;
120+
private initThinLineProgram;
110121
/**
111122
* remove the last line
112123
*/
113124
popLine(): void;
125+
/**
126+
* remove all the lines
127+
*/
128+
removeAllLines(): void;
114129
/**
115130
* Change the WbGL viewport
116131
* @param a

dist/webglplot.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)