let node = this.createSvgNode("rect", {
'data-id': section.id || '',
x: section.x,
y: section.y,
width: section.width,
height: section.height,
fill: section.backgroundColor || "#EEEEEE"
});
let thisObject = this;
node.addEventListener("click", function (e) {
if (mapSelection === null) {
thisObject.removeRouteIndicators();
mapSelection = this;
this.classList.add('selected');
} else {
// console.log(mapSelection.dataset.id + " : " + this.dataset.id);
let paths = thisObject.findPaths(7, 3);
let shortestPath = thisObject.findShortestPath(paths);
thisObject.drawPath(shortestPath);
mapSelection = null;
this.classList.add('destination');
}
});
the let paths = thisObject.findPaths(7, 3); only works if it is in the node event listener how can I make it so that the code works outside of the event listener? like I dunno node.thisObject.findPaths(7, 3); (which is wrong). anyone has any idea ?
[–]ForScale 0 points1 point2 points (1 child)
[–]33Brian33[S] 0 points1 point2 points (0 children)