Skip to content

Commit

Permalink
ag-solo: properly order the X and Y axes
Browse files Browse the repository at this point in the history
fixes Agoric#61
  • Loading branch information
michaelfig committed Aug 14, 2019
1 parent af17eb3 commit ccecc5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ You might see something like:
```

The `quantity` tells us which pixels we've received. `{ x:1, y:4 }`
means that we got a pixel that is in the second row (`x:1`) and 5 pixels
from the left (`y:4`). To color the pixel, we need to get the use
means that we got a pixel that is in the fifth row (`y:4`) and 2 pixels
from the left (`x:1`). To color the pixel, we need to get the use
object from the payment. You can think of the use object as a regular
JavaScript object that just happens to be associated with an ERTP
payment.
Expand Down
9 changes: 5 additions & 4 deletions lib/ag-solo/html/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ function run() {
while (galleryNode.firstChild) {
galleryNode.removeChild(galleryNode.firstChild);
}
for (let x = 0; x < state.length; x += 1) {
for (let y = 0; y < state.length; y += 1) {
// We need to render increasing x followed by increasing y.
for (let y = 0; y < state[0].length; y += 1) {
for (let x = 0; x < state.length; x += 1) {
const px = document.createElement('div');
px.id = `pix${x}.${y}`;
px.className = 'pixel';
Expand Down Expand Up @@ -147,8 +148,8 @@ function run() {
void px.offsetWidth;
px.classList.add('updated');
}
for (let x = 0; x < state.length; x += 1) {
for (let y = 0; y < state.length; y += 1) {
for (let y = 0; y < state[0].length; y += 1) {
for (let x = 0; x < state.length; x += 1) {
const newcolor = state[x][y];
if (newcolor !== oldState[x][y]) {
renderPixel(x, y, newcolor);
Expand Down

0 comments on commit ccecc5e

Please sign in to comment.