Followed practice of other tests so that commit IDs are
stabilised (i.e., not randomly generated) and therefore
don't show repeatedly in Cypress diff output screenshots
Checking if branch was same as main turned out to be redundant
for now, since there don't seem to be any cases where routing
curves into main.
This fixes issue found in review by @nirname and avoids a
situation where branching from the same commit results in
unnecessary rerouting.
The function also now does an additional check to see
if source branch in overlap check is on main.
As we're no longer purely checking for an overlap and
the only use of this function is to reroute the arrows
to avoid running over commits, this more literal name
should be clearer.
On previous rewrite, I had created new functions within the
overlapping functions but these were being recreated on each
iteration of Object.some(). I moved them outside this for
clarity and so they're not recreated each iteration.
Changed argument names from commit1 and commit2 to
commitA and commitB respectively to prevent confusion
with seq number values.
Replaced Array filter method with array some method
so that as soon as one overlap is found, function is
finished.
Used Object.entries instead of Object.keys to reduce
number of variables needed and make function easier
to read.
Originally, the function was checking if any commits were on the
same branch as `commit2`, the destination commit.
However, in order to avoid a conflict, we should only need to
check whether any commits are on the same branch as `commit 1`.
Updated and moved commenting as well.
Position the tooltip centered, just below the node being hovered.
Update packages/mermaid/src/diagrams/flowchart/flowDb.js
Co-authored-by: Sidharth Vinod <sidharthv96@gmail.com>
window.scrollY is already account for which means document.body.scrollTop incorrectly offsets the tooltip vertically.
The same is not true for horizontal position.