webgl-plot
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -27,3 +27,3 @@ import { ColorRGBA } from "./ColorRGBA"; | ||
/** | ||
* The vertical sclae of the line | ||
* The vertical scale of the line | ||
* @default = 1 | ||
@@ -33,3 +33,3 @@ */ | ||
/** | ||
* The horixontal offset of the line | ||
* The horizontal offset of the line | ||
* @default = 0 | ||
@@ -36,0 +36,0 @@ */ |
@@ -56,6 +56,11 @@ /** | ||
/** | ||
* collection of lines in the plot | ||
* collection of data lines in the plot | ||
*/ | ||
private _lines; | ||
get lines(): WebglBaseLine[]; | ||
private _linesData; | ||
/** | ||
* collection of auxiliary lines (grids, markers, etc) in the plot | ||
*/ | ||
private _linesAux; | ||
get linesData(): WebglBaseLine[]; | ||
get linesAux(): WebglBaseLine[]; | ||
private progThinLine; | ||
@@ -108,2 +113,3 @@ /** | ||
*/ | ||
private updateLines; | ||
update(): void; | ||
@@ -121,8 +127,11 @@ clear(): void; | ||
*/ | ||
addLine(line: WebglLine | WebglStep | WebglPolar): void; | ||
private _addLine; | ||
addDataLine(line: WebglLine | WebglStep | WebglPolar): void; | ||
addLine: (line: WebglLine | WebglStep | WebglPolar) => void; | ||
addAuxLine(line: WebglLine | WebglStep | WebglPolar): void; | ||
private initThinLineProgram; | ||
/** | ||
* remove the last line | ||
* remove the last data line | ||
*/ | ||
popLine(): void; | ||
popDataLine(): void; | ||
/** | ||
@@ -133,2 +142,10 @@ * remove all the lines | ||
/** | ||
* remove all data lines | ||
*/ | ||
removeDataLines(): void; | ||
/** | ||
* remove all auxiliary lines | ||
*/ | ||
removeAuxLines(): void; | ||
/** | ||
* Change the WbGL viewport | ||
@@ -135,0 +152,0 @@ * @param a |
@@ -329,2 +329,3 @@ class ColorRGBA { | ||
this.debug = false; | ||
this.addLine = this.addDataLine; | ||
if (options == undefined) { | ||
@@ -348,3 +349,4 @@ this.webgl = canvas.getContext("webgl", { | ||
this.log(`[webgl-plot]:width=${canvas.width}, height=${canvas.height}`); | ||
this._lines = []; | ||
this._linesData = []; | ||
this._linesAux = []; | ||
//this.webgl = webgl; | ||
@@ -363,11 +365,14 @@ this.gScaleX = 1; | ||
} | ||
get lines() { | ||
return this._lines; | ||
get linesData() { | ||
return this._linesData; | ||
} | ||
get linesAux() { | ||
return this._linesAux; | ||
} | ||
/** | ||
* updates and redraws the content of the plot | ||
*/ | ||
update() { | ||
updateLines(lines) { | ||
const webgl = this.webgl; | ||
this.lines.forEach((line) => { | ||
lines.forEach((line) => { | ||
if (line.visible) { | ||
@@ -391,2 +396,6 @@ webgl.useProgram(this.progThinLine); | ||
} | ||
update() { | ||
this.updateLines(this.linesData); | ||
this.updateLines(this.linesAux); | ||
} | ||
clear() { | ||
@@ -407,3 +416,3 @@ // Clear the canvas //?????????????????? | ||
*/ | ||
addLine(line) { | ||
_addLine(line) { | ||
//line.initProgram(this.webgl); | ||
@@ -417,4 +426,11 @@ line._vbuffer = this.webgl.createBuffer(); | ||
this.webgl.enableVertexAttribArray(line._coord); | ||
this.lines.push(line); | ||
} | ||
addDataLine(line) { | ||
this._addLine(line); | ||
this.linesData.push(line); | ||
} | ||
addAuxLine(line) { | ||
this._addLine(line); | ||
this.linesAux.push(line); | ||
} | ||
initThinLineProgram() { | ||
@@ -450,6 +466,6 @@ const vertCode = ` | ||
/** | ||
* remove the last line | ||
* remove the last data line | ||
*/ | ||
popLine() { | ||
this.lines.pop(); | ||
popDataLine() { | ||
this.linesData.pop(); | ||
} | ||
@@ -460,5 +476,18 @@ /** | ||
removeAllLines() { | ||
this._lines = []; | ||
this._linesData = []; | ||
this._linesAux = []; | ||
} | ||
/** | ||
* remove all data lines | ||
*/ | ||
removeDataLines() { | ||
this._linesData = []; | ||
} | ||
/** | ||
* remove all auxiliary lines | ||
*/ | ||
removeAuxLines() { | ||
this._linesAux = []; | ||
} | ||
/** | ||
* Change the WbGL viewport | ||
@@ -465,0 +494,0 @@ * @param a |
@@ -60,2 +60,3 @@ /** | ||
this.debug = false; | ||
this.addLine = this.addDataLine; | ||
if (options == undefined) { | ||
@@ -79,3 +80,4 @@ this.webgl = canvas.getContext("webgl", { | ||
this.log(`[webgl-plot]:width=${canvas.width}, height=${canvas.height}`); | ||
this._lines = []; | ||
this._linesData = []; | ||
this._linesAux = []; | ||
//this.webgl = webgl; | ||
@@ -94,11 +96,14 @@ this.gScaleX = 1; | ||
} | ||
get lines() { | ||
return this._lines; | ||
get linesData() { | ||
return this._linesData; | ||
} | ||
get linesAux() { | ||
return this._linesAux; | ||
} | ||
/** | ||
* updates and redraws the content of the plot | ||
*/ | ||
update() { | ||
updateLines(lines) { | ||
const webgl = this.webgl; | ||
this.lines.forEach((line) => { | ||
lines.forEach((line) => { | ||
if (line.visible) { | ||
@@ -122,2 +127,6 @@ webgl.useProgram(this.progThinLine); | ||
} | ||
update() { | ||
this.updateLines(this.linesData); | ||
this.updateLines(this.linesAux); | ||
} | ||
clear() { | ||
@@ -138,3 +147,3 @@ // Clear the canvas //?????????????????? | ||
*/ | ||
addLine(line) { | ||
_addLine(line) { | ||
//line.initProgram(this.webgl); | ||
@@ -148,4 +157,11 @@ line._vbuffer = this.webgl.createBuffer(); | ||
this.webgl.enableVertexAttribArray(line._coord); | ||
this.lines.push(line); | ||
} | ||
addDataLine(line) { | ||
this._addLine(line); | ||
this.linesData.push(line); | ||
} | ||
addAuxLine(line) { | ||
this._addLine(line); | ||
this.linesAux.push(line); | ||
} | ||
initThinLineProgram() { | ||
@@ -181,6 +197,6 @@ const vertCode = ` | ||
/** | ||
* remove the last line | ||
* remove the last data line | ||
*/ | ||
popLine() { | ||
this.lines.pop(); | ||
popDataLine() { | ||
this.linesData.pop(); | ||
} | ||
@@ -191,5 +207,18 @@ /** | ||
removeAllLines() { | ||
this._lines = []; | ||
this._linesData = []; | ||
this._linesAux = []; | ||
} | ||
/** | ||
* remove all data lines | ||
*/ | ||
removeDataLines() { | ||
this._linesData = []; | ||
} | ||
/** | ||
* remove all auxiliary lines | ||
*/ | ||
removeAuxLines() { | ||
this._linesAux = []; | ||
} | ||
/** | ||
* Change the WbGL viewport | ||
@@ -196,0 +225,0 @@ * @param a |
@@ -335,2 +335,3 @@ (function (global, factory) { | ||
this.debug = false; | ||
this.addLine = this.addDataLine; | ||
if (options == undefined) { | ||
@@ -354,3 +355,4 @@ this.webgl = canvas.getContext("webgl", { | ||
this.log(`[webgl-plot]:width=${canvas.width}, height=${canvas.height}`); | ||
this._lines = []; | ||
this._linesData = []; | ||
this._linesAux = []; | ||
//this.webgl = webgl; | ||
@@ -369,11 +371,14 @@ this.gScaleX = 1; | ||
} | ||
get lines() { | ||
return this._lines; | ||
get linesData() { | ||
return this._linesData; | ||
} | ||
get linesAux() { | ||
return this._linesAux; | ||
} | ||
/** | ||
* updates and redraws the content of the plot | ||
*/ | ||
update() { | ||
updateLines(lines) { | ||
const webgl = this.webgl; | ||
this.lines.forEach((line) => { | ||
lines.forEach((line) => { | ||
if (line.visible) { | ||
@@ -397,2 +402,6 @@ webgl.useProgram(this.progThinLine); | ||
} | ||
update() { | ||
this.updateLines(this.linesData); | ||
this.updateLines(this.linesAux); | ||
} | ||
clear() { | ||
@@ -413,3 +422,3 @@ // Clear the canvas //?????????????????? | ||
*/ | ||
addLine(line) { | ||
_addLine(line) { | ||
//line.initProgram(this.webgl); | ||
@@ -423,4 +432,11 @@ line._vbuffer = this.webgl.createBuffer(); | ||
this.webgl.enableVertexAttribArray(line._coord); | ||
this.lines.push(line); | ||
} | ||
addDataLine(line) { | ||
this._addLine(line); | ||
this.linesData.push(line); | ||
} | ||
addAuxLine(line) { | ||
this._addLine(line); | ||
this.linesAux.push(line); | ||
} | ||
initThinLineProgram() { | ||
@@ -456,6 +472,6 @@ const vertCode = ` | ||
/** | ||
* remove the last line | ||
* remove the last data line | ||
*/ | ||
popLine() { | ||
this.lines.pop(); | ||
popDataLine() { | ||
this.linesData.pop(); | ||
} | ||
@@ -466,5 +482,18 @@ /** | ||
removeAllLines() { | ||
this._lines = []; | ||
this._linesData = []; | ||
this._linesAux = []; | ||
} | ||
/** | ||
* remove all data lines | ||
*/ | ||
removeDataLines() { | ||
this._linesData = []; | ||
} | ||
/** | ||
* remove all auxiliary lines | ||
*/ | ||
removeAuxLines() { | ||
this._linesAux = []; | ||
} | ||
/** | ||
* Change the WbGL viewport | ||
@@ -471,0 +500,0 @@ * @param a |
{ | ||
"name": "webgl-plot", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "High-performance 2D plotting library based on native WebGL", | ||
@@ -10,9 +10,7 @@ "main": "./dist/webglplot.umd.js", | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.7.0", | ||
"@typescript-eslint/parser": "^4.7.0", | ||
"eslint": "^7.13.0", | ||
"rollup": "^2.33.1", | ||
"typedoc": "^0.19.2", | ||
"typedoc-plugin-markdown": "^3.0.11", | ||
"typescript": "^4.0.5" | ||
"@typescript-eslint/eslint-plugin": "^4.11.0", | ||
"@typescript-eslint/parser": "^4.11.0", | ||
"eslint": "^7.16.0", | ||
"rollup": "^2.35.1", | ||
"typescript": "^4.1.3" | ||
}, | ||
@@ -32,3 +30,4 @@ "scripts": { | ||
}, | ||
"homepage": "https://github.com/danchitnis/webgl-plot" | ||
"homepage": "https://github.com/danchitnis/webgl-plot", | ||
"dependencies": {} | ||
} |
@@ -1,2 +0,2 @@ | ||
![npm](https://github.com/danchitnis/webgl-plot/workflows/npm/badge.svg) ![yarn](https://github.com/danchitnis/webgl-plot/workflows/yarn/badge.svg) ![Code scanning](https://github.com/danchitnis/webgl-plot/workflows/Code%20scanning/badge.svg) ![Build](https://github.com/danchitnis/webgl-plot/workflows/Build/badge.svg) | ||
![Npm Build](https://github.com/danchitnis/webgl-plot/workflows/Npm%20Build/badge.svg) ![Yarn Build](https://github.com/danchitnis/webgl-plot/workflows/Yarn%20Build/badge.svg) ![Code scanning](https://github.com/danchitnis/webgl-plot/workflows/Code%20scanning/badge.svg) ![Build](https://github.com/danchitnis/webgl-plot/workflows/Build/badge.svg) | ||
@@ -146,2 +146,7 @@ ## [Live demo 🚀](https://danchitnis.github.io/webgl-plot-examples/vanilla/) | ||
## SkyPack | ||
[Skypack](https://www.skypack.dev/view/webgl-plot) is the new exciting CDN for ESM Javascript. See the example below on how to use it: | ||
[JSfiddle](https://jsfiddle.net/danchitnis/tu1svwbp/) | ||
## API Documentation | ||
@@ -148,0 +153,0 @@ |
@@ -35,3 +35,3 @@ import { ColorRGBA } from "./ColorRGBA"; | ||
/** | ||
* The vertical sclae of the line | ||
* The vertical scale of the line | ||
* @default = 1 | ||
@@ -42,3 +42,3 @@ */ | ||
/** | ||
* The horixontal offset of the line | ||
* The horizontal offset of the line | ||
* @default = 0 | ||
@@ -45,0 +45,0 @@ */ |
@@ -66,10 +66,19 @@ /** | ||
/** | ||
* collection of lines in the plot | ||
* collection of data lines in the plot | ||
*/ | ||
private _lines: WebglBaseLine[]; | ||
private _linesData: WebglBaseLine[]; | ||
get lines(): WebglBaseLine[] { | ||
return this._lines; | ||
/** | ||
* collection of auxiliary lines (grids, markers, etc) in the plot | ||
*/ | ||
private _linesAux: WebglBaseLine[]; | ||
get linesData(): WebglBaseLine[] { | ||
return this._linesData; | ||
} | ||
get linesAux(): WebglBaseLine[] { | ||
return this._linesAux; | ||
} | ||
private progThinLine: WebGLProgram; | ||
@@ -140,3 +149,4 @@ | ||
this._lines = []; | ||
this._linesData = []; | ||
this._linesAux = []; | ||
@@ -165,6 +175,6 @@ //this.webgl = webgl; | ||
*/ | ||
public update(): void { | ||
private updateLines(lines: WebglBaseLine[]): void { | ||
const webgl = this.webgl; | ||
this.lines.forEach((line) => { | ||
lines.forEach((line) => { | ||
if (line.visible) { | ||
@@ -201,2 +211,7 @@ webgl.useProgram(this.progThinLine); | ||
public update(): void { | ||
this.updateLines(this.linesData); | ||
this.updateLines(this.linesAux); | ||
} | ||
public clear(): void { | ||
@@ -218,3 +233,3 @@ // Clear the canvas //?????????????????? | ||
*/ | ||
public addLine(line: WebglLine | WebglStep | WebglPolar): void { | ||
private _addLine(line: WebglLine | WebglStep | WebglPolar): void { | ||
//line.initProgram(this.webgl); | ||
@@ -230,6 +245,16 @@ line._vbuffer = this.webgl.createBuffer() as WebGLBuffer; | ||
this.webgl.enableVertexAttribArray(line._coord); | ||
} | ||
this.lines.push(line); | ||
public addDataLine(line: WebglLine | WebglStep | WebglPolar): void { | ||
this._addLine(line); | ||
this.linesData.push(line); | ||
} | ||
public addLine = this.addDataLine; | ||
public addAuxLine(line: WebglLine | WebglStep | WebglPolar): void { | ||
this._addLine(line); | ||
this.linesAux.push(line); | ||
} | ||
private initThinLineProgram() { | ||
@@ -271,6 +296,6 @@ const vertCode = ` | ||
/** | ||
* remove the last line | ||
* remove the last data line | ||
*/ | ||
public popLine(): void { | ||
this.lines.pop(); | ||
public popDataLine(): void { | ||
this.linesData.pop(); | ||
} | ||
@@ -282,6 +307,21 @@ | ||
public removeAllLines(): void { | ||
this._lines = []; | ||
this._linesData = []; | ||
this._linesAux = []; | ||
} | ||
/** | ||
* remove all data lines | ||
*/ | ||
public removeDataLines(): void { | ||
this._linesData = []; | ||
} | ||
/** | ||
* remove all auxiliary lines | ||
*/ | ||
public removeAuxLines(): void { | ||
this._linesAux = []; | ||
} | ||
/** | ||
* Change the WbGL viewport | ||
@@ -288,0 +328,0 @@ * @param a |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103756
5
2560
169