Fix a memleak in the pathfinding debug rendering

This commit is contained in:
Manuel Vögele
2022-02-15 09:40:54 +01:00
parent 8e29cf186b
commit 466e5a36d1
+2 -2
View File
@@ -156,7 +156,7 @@ function paintGriddedPathfindingDebug(lastNode, token) {
if (!CONFIG.debug.dragRuler) if (!CONFIG.debug.dragRuler)
return; return;
debugGraphics.removeChildren(); debugGraphics.removeChildren().forEach(c => c.destroy());
let currentNode = lastNode; let currentNode = lastNode;
while (currentNode) { while (currentNode) {
let text = new PIXI.Text(currentNode.cost.toFixed(0)); let text = new PIXI.Text(currentNode.cost.toFixed(0));
@@ -173,7 +173,7 @@ function paintGridlessPathfindingDebug(pathfinder) {
if (!CONFIG.debug.dragRuler) if (!CONFIG.debug.dragRuler)
return; return;
debugGraphics.removeChildren(); debugGraphics.removeChildren().forEach(c => c.destroy());
let graphic = new PIXI.Graphics(); let graphic = new PIXI.Graphics();
graphic.lineStyle(2, 0x440000); graphic.lineStyle(2, 0x440000);
for (const point of GridlessPathfinding.debugGetPathfindingPoints(pathfinder)) { for (const point of GridlessPathfinding.debugGetPathfindingPoints(pathfinder)) {