Skip to content

Commit 79668ea

Browse files
committed
show positions of boxs at the demo page
1 parent 0e72ca5 commit 79668ea

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ShapeAlgorithm.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ShapeAlgorithm {
1818
this.matrix = [];
1919
this.labels = [];
2020
this.sizes = [];
21-
this.positions = [];
21+
this.positions = {};
2222

2323
this.init();
2424
}

demo.html

+11
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ <h1>Shapes Algorithm</h1>
7373
const quantity = quantities[i];
7474
const elm_quantity = document.createElement("li");
7575
elm_quantity.innerHTML = `${quantity.width}x${quantity.height} = ${quantity.quantity} (labeled ${quantity.label})`;
76+
77+
const ul = document.createElement("ul");
78+
for (let position of quantity.positions) {
79+
console.log(position);
80+
const ul_item = document.createElement("li");
81+
ul_item.innerHTML = `(${position.from_w}, ${position.from_h}) => (${position.to_w}, ${position.to_h})`;
82+
83+
ul.appendChild(ul_item);
84+
}
85+
elm_quantity.appendChild(ul);
86+
7687
elm_quantities.appendChild(elm_quantity);
7788
}
7889
});

0 commit comments

Comments
 (0)