| 63 | |
| 64 | //Builds textOutput table with shape details |
| 65 | function _shapeDetails(idT, ingredients) { |
| 66 | let shapeDetails = ''; |
| 67 | let shapeNumber = 0; |
| 68 | //goes trhough every shape type in ingredients |
| 69 | for (let x in ingredients) { |
| 70 | //and for every shape |
| 71 | for (let y in ingredients[x]) { |
| 72 | //it creates a table row |
| 73 | let row = `<tr id="${idT}shape${shapeNumber}"><th>${ |
| 74 | ingredients[x][y].color |
| 75 | } ${x}</th>`; |
| 76 | if (x === 'line') { |
| 77 | row = |
| 78 | row + |
| 79 | `<td>location = ${ingredients[x][y].pos}</td><td>length = ${ |
| 80 | ingredients[x][y].length |
| 81 | } pixels</td></tr>`; |
| 82 | } else { |
| 83 | row = row + `<td>location = ${ingredients[x][y].pos}</td>`; |
| 84 | if (x !== 'point') { |
| 85 | row = row + `<td> area = ${ingredients[x][y].area}%</td>`; |
| 86 | } |
| 87 | row = row + '</tr>'; |
| 88 | } |
| 89 | shapeDetails = shapeDetails + row; |
| 90 | shapeNumber++; |
| 91 | } |
| 92 | } |
| 93 | return shapeDetails; |
| 94 | } |
| 95 | |
| 96 | //Builds textOutput shape list |
| 97 | function _shapeList(idT, ingredients) { |