Skip to content

Commit c1bd19c

Browse files
author
Mr. X
committed
RealLineGraph bug fixes
1 parent d4baf6a commit c1bd19c

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/renderers/RealLineGraph.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class RealLineGraph extends RealRenderer {
2626
this._dataIndex = 1; // Number of plots
2727
this._lastData = 0; // (Value) To display lines
2828

29-
this._addData = getAddDataKernel(this.gpu, this.dimensions, this.brushSize, this.brushColor, this.xScaleFactor, this.yScaleFactor, this.xOffset, this.yOffset, this.lineThickness, this.lineColor);
29+
this._addData = getAddDataKernel(this.gpu, this.dimensions, this.brushSize, this.brushColor, this.xScaleFactor, this.yScaleFactor, this.xOffset, this.yOffset, this.lineThickness, this.lineColor, this.progressiveAxis);
3030

3131
this.limits = { // Final ranges of x and y
3232
x: [
@@ -46,8 +46,23 @@ class RealLineGraph extends RealRenderer {
4646

4747
// Overflow
4848
if (this._dataIndex >= this.limits.x[1] && this.progressionMode != 'continous') {
49-
this.graphPixels = this._progressGraph(this._cloneTexture(this.graphPixels), Math.ceil(this.xScaleFactor))
50-
this._numProgress += Math.ceil(this.xScaleFactor);
49+
let progress = Math.ceil(this.progressiveAxis == 'y' ? this.yScaleFactor : this.xScaleFactor);
50+
51+
this.graphPixels = this._progressGraph(
52+
this._cloneTexture(this.graphPixels),
53+
progress
54+
)
55+
56+
this._numProgress += progress;
57+
58+
if (this.progressiveAxis == 'y') {
59+
this.limits.y[0] += progress / this.yScaleFactor;
60+
this.limits.y[1] += progress / this.yScaleFactor;
61+
}
62+
else {
63+
this.limits.x[1] += progress / this.xScaleFactor;
64+
this.limits.x[0] += progress / this.xScaleFactor;
65+
}
5166
}
5267

5368
this._display(this.graphPixels);
@@ -58,6 +73,16 @@ class RealLineGraph extends RealRenderer {
5873
if (this.progressionMode == 'continous' && (time - this._lastProgress >= this.progressInterval)) {
5974
this._lastProgress = time;
6075
this._numProgress++;
76+
77+
if (this.progressiveAxis == 'y') {
78+
this.limits.y[0] += 1 / this.yScaleFactor;
79+
this.limits.y[1] += 1 / this.yScaleFactor;
80+
}
81+
else {
82+
this.limits.x[0] += 1 / this.xScaleFactor;
83+
this.limits.x[1] += 1 / this.xScaleFactor;
84+
}
85+
6186
return this._progressGraph(this._cloneTexture(graphPixels), 1);
6287
}
6388
else return graphPixels;

0 commit comments

Comments
 (0)