Skip to content

Commit

Permalink
show positions of boxs at the demo page
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax committed Sep 25, 2022
1 parent 0e72ca5 commit 79668ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ShapeAlgorithm.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ShapeAlgorithm {
this.matrix = [];
this.labels = [];
this.sizes = [];
this.positions = [];
this.positions = {};

this.init();
}
Expand Down
11 changes: 11 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ <h1>Shapes Algorithm</h1>
const quantity = quantities[i];
const elm_quantity = document.createElement("li");
elm_quantity.innerHTML = `${quantity.width}x${quantity.height} = ${quantity.quantity} (labeled ${quantity.label})`;

const ul = document.createElement("ul");
for (let position of quantity.positions) {
console.log(position);
const ul_item = document.createElement("li");
ul_item.innerHTML = `(${position.from_w}, ${position.from_h}) => (${position.to_w}, ${position.to_h})`;

ul.appendChild(ul_item);
}
elm_quantity.appendChild(ul);

elm_quantities.appendChild(elm_quantity);
}
});
Expand Down

0 comments on commit 79668ea

Please sign in to comment.