Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8b508515b |
No files matched your search
+4
-4
@@ -54,8 +54,8 @@ function onClickPaint(shapeId, color){
|
|||||||
renderShapes();
|
renderShapes();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClickTrash(circleId){
|
function onClickTrash(shapeId){
|
||||||
const index = getShapeIndexById(circleId);
|
const index = getShapeIndexById(shapeId);
|
||||||
shapes.splice(index, 1)
|
shapes.splice(index, 1)
|
||||||
renderShapes();
|
renderShapes();
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ function drawNewText() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function clearCircles(){
|
function clearShapes(){
|
||||||
shapes.length = 0;
|
shapes.length = 0;
|
||||||
renderShapes();
|
renderShapes();
|
||||||
}
|
}
|
||||||
@@ -122,6 +122,6 @@ document.getElementById("draw-circle").addEventListener("click", drawNewCircle);
|
|||||||
document.getElementById("draw-rectangle").addEventListener("click", drawNewRectangle);
|
document.getElementById("draw-rectangle").addEventListener("click", drawNewRectangle);
|
||||||
document.getElementById("draw-text").addEventListener("click", drawNewText);
|
document.getElementById("draw-text").addEventListener("click", drawNewText);
|
||||||
|
|
||||||
document.getElementById("clear-drawing").addEventListener("click", clearCircles);
|
document.getElementById("clear-drawing").addEventListener("click", clearShapes);
|
||||||
|
|
||||||
|
|
||||||
+6
-6
@@ -246,7 +246,7 @@ function drawIcons(shape,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param node {HTMLElement} un element tbody
|
* @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
|
* @param pointToString Argument optionnel qui doit être une fonction
|
||||||
* qui prend en paramêtre un Point et retourne un String qui
|
* qui prend en paramêtre un Point et retourne un String qui
|
||||||
* représente le point.
|
* représente le point.
|
||||||
@@ -276,7 +276,7 @@ function drawIcons(shape,
|
|||||||
* la fonction.
|
* la fonction.
|
||||||
*/
|
*/
|
||||||
export function populateTable(node,
|
export function populateTable(node,
|
||||||
circles,
|
shapes,
|
||||||
onClickUp=undefined,
|
onClickUp=undefined,
|
||||||
onClickDown=undefined,
|
onClickDown=undefined,
|
||||||
onClickLeft=undefined,
|
onClickLeft=undefined,
|
||||||
@@ -284,10 +284,10 @@ export function populateTable(node,
|
|||||||
onClickPaint=undefined,
|
onClickPaint=undefined,
|
||||||
onClickDelete = undefined){
|
onClickDelete = undefined){
|
||||||
const rows = [];
|
const rows = [];
|
||||||
for(const circle of circles){
|
for(const shape of shapes){
|
||||||
const row =[m("td", circle.getId()),
|
const row =[m("td", shape.getId()),
|
||||||
m("td", circle.toString()),
|
m("td", shape.toString()),
|
||||||
m("td", drawIcons(circle,
|
m("td", drawIcons(shape,
|
||||||
functionOrDefault(onClickUp),
|
functionOrDefault(onClickUp),
|
||||||
functionOrDefault(onClickDown),
|
functionOrDefault(onClickDown),
|
||||||
functionOrDefault(onClickLeft),
|
functionOrDefault(onClickLeft),
|
||||||
|
|||||||
Reference in new issue
Block a user