Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Allow developers to change the path finding function #14

Closed
@lichenglu

Description

@lichenglu

First of all, thanks for the great package! It saves me tons of time.

Originally, the package did not seem to be "smart" on my end (still using the BezierEdge from react-flow). I then found out that the length of smoothedPath for me is always smaller or equal to 2, which fallbacks to the edges of react-flow (see codes here). Then I was thinking it cannot be that smoothedPath is always that case. It turns out there is a bug in the dependency pathfinding, where no coordinate will be recorded if coming across a block (start and end coordinate will not be updated either).

function smoothenPath(grid, path) {
        ....
        blocked = false;
        ....
        if (blocked) {
            lastValidCoord = path[i - 1]; // THIS IS NOT DEFINED AND CAUSE AN INTERNAL ERROR
            newPath.push(lastValidCoord);
            sx = lastValidCoord[0];
            sy = lastValidCoord[1];
        }
    }
    
    newPath.push([x1, y1]);

    return newPath;
}

The fix is easy but it seems that no one is maintaining pathfinding anymore (e.g., qiao/PathFinding.js#192).

Suggestions

  1. Maybe react-flow-smart-edge should use a fork of pathfinding to have known bugs fixed?
  2. Even better, maybe we can find a more up-to-date package related to graph theory as this might be maintainable in the long run?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions