Compare commits

...
1 Commits
Author SHA1 Message Date
didier amyot d8b508515b refactored a bit. 2024-01-25 14:38:10 -05:00
2 changed files with 10 additions and 10 deletions

No files matched your search

+4 -4
View File
@@ -54,8 +54,8 @@ function onClickPaint(shapeId, color){
renderShapes();
}
function onClickTrash(circleId){
const index = getShapeIndexById(circleId);
function onClickTrash(shapeId){
const index = getShapeIndexById(shapeId);
shapes.splice(index, 1)
renderShapes();
}
@@ -98,7 +98,7 @@ function drawNewText() {
function clearCircles(){
function clearShapes(){
shapes.length = 0;
renderShapes();
}
@@ -122,6 +122,6 @@ document.getElementById("draw-circle").addEventListener("click", drawNewCircle);
document.getElementById("draw-rectangle").addEventListener("click", drawNewRectangle);
document.getElementById("draw-text").addEventListener("click", drawNewText);
document.getElementById("clear-drawing").addEventListener("click", clearCircles);
document.getElementById("clear-drawing").addEventListener("click", clearShapes);
+6 -6
View File
@@ -246,7 +246,7 @@ function drawIcons(shape,
/**
* @param node {HTMLElement} un element tbody
* @param circles {Circle[]} Les cercles
* @param shapes {Circle[]} Les cercles
* @param pointToString Argument optionnel qui doit être une fonction
* qui prend en paramêtre un Point et retourne un String qui
* représente le point.
@@ -276,7 +276,7 @@ function drawIcons(shape,
* la fonction.
*/
export function populateTable(node,
circles,
shapes,
onClickUp=undefined,
onClickDown=undefined,
onClickLeft=undefined,
@@ -284,10 +284,10 @@ export function populateTable(node,
onClickPaint=undefined,
onClickDelete = undefined){
const rows = [];
for(const circle of circles){
const row =[m("td", circle.getId()),
m("td", circle.toString()),
m("td", drawIcons(circle,
for(const shape of shapes){
const row =[m("td", shape.getId()),
m("td", shape.toString()),
m("td", drawIcons(shape,
functionOrDefault(onClickUp),
functionOrDefault(onClickDown),
functionOrDefault(onClickLeft),