function initAllSwitch(){ switchs.forEach(function(element){ let switche = stage.findOne("#"+element); switche.on('click', function () { let colorrect = switche.fill() == colorSwitchInnactiveBackground ? colorSwitchActiveBackground : colorSwitchInnactiveBackground; switche.fill(colorrect); changeLineColor(switche.id3); checkAllSortieLogique(); layer.draw(); }); switche.on('mouseover', function () { document.body.style.cursor = "pointer"; }); switche.on('mouseout', function () { document.body.style.cursor = "default"; }); }); } function initLayer() { createEnd(500,50); }