Skip to content

Commit 4cba44c

Browse files
author
Mr. X
committed
fix progression issue.
1 parent c1bd19c commit 4cba44c

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/kernels/blankGraph.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
*/
99
function getBlankGraphKernel(gpu, dimensions, xOffset, yOffset, bgColor, axesColor) {
1010
return gpu.createKernel(function() {
11-
const X = Math.floor(this.output.y * (this.constants.xOffset / 100));
12-
const Y = Math.floor(this.output.x * (this.constants.yOffset / 100));
11+
const outX = this.output.x, outY = this.output.y;
12+
13+
const X = Math.floor(outY * (this.constants.xOffset / 100));
14+
const Y = Math.floor(outX * (this.constants.yOffset / 100));
1315

1416
if (this.thread.x === Y || this.thread.y === X) return this.constants.axesColor;
1517
else return this.constants.bgColor;

src/kernels/progressGraph.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,25 @@
88
* @param {Float32Array} bgColor
99
*/
1010
function getProgressGraphKernel(gpu, dimensions, progressiveAxis, xOffset, yOffset, axesColor, bgColor) {
11-
return gpu.createKernel(function(graphPixels) {
12-
if ((this.thread.x + 1)*(this.constants.progressiveAxis - 1) === this.output.x || (this.thread.y + 1)*this.constants.progressiveAxis === this.output.y) {
13-
const X = Math.floor(this.output.y * (this.constants.xOffset / 100));
14-
const Y = Math.floor(this.output.x * (this.constants.yOffset / 100));
11+
return gpu.createKernel(function(graphPixels, numProgress) {
12+
const outX = this.output.x, outY = this.output.y;
13+
if (
14+
(this.thread.x * Math.abs(this.constants.progressiveAxis - 1) >= (outX - numProgress)) ||
15+
(this.thread.y * this.constants.progressiveAxis >= (outY + numProgress))
16+
) {
17+
const X = Math.floor(outY * (this.constants.xOffset / 100));
18+
const Y = Math.floor(outX * (this.constants.yOffset / 100));
1519

1620
if (this.thread.x === Y || this.thread.y === X) return this.constants.axesColor;
1721
else return this.constants.bgColor;
1822
}
1923
else {
2024
return graphPixels[
2125
this.thread.y +
22-
1*this.constants.progressiveAxis
26+
numProgress*this.constants.progressiveAxis
2327
][
2428
this.thread.x +
25-
1*Math.abs(this.constants.progressiveAxis - 1)
29+
numProgress*Math.abs(this.constants.progressiveAxis - 1)
2630
]
2731
}
2832
},

0 commit comments

Comments
 (0)