[Bugfix]: Fixed an issue stemming from recent feature update of 'orthogonal_wiring' on objects connected to multiple wires. The functionality was refactored and the bug was later pointed out in issue #336 in the upstream repo.

This commit is contained in:
Chayan Deb 2025-03-18 22:59:52 +05:30
parent 8d4654f643
commit 6a43b2069e
1 changed files with 12 additions and 7 deletions

View File

@ -1031,13 +1031,18 @@ static void place_moved_wire(int n, int orthogonal_wiring)
xWire * const wire = xctx->wire;
/* FIXME: Chayan Deb: this needs to be updated
* If things get too complicated a place_moved_wire_orthogonal() can be created
*/
if((wire[n].sel & (SELECTED|SELECTED1)) && orthogonal_wiring)
{
if(xctx->manhattan_lines & 1) xctx->manhattan_lines=2;
else if(xctx->manhattan_lines & 2) xctx->manhattan_lines=1;
/* Need to dynamically assign `manhattan_lines` to each wire. Otherwise, a single
* `manhattan_lines` value gets forced on all wires connected to a moved object*/
if(orthogonal_wiring) {
double origin_shifted_x2, origin_shifted_y2;
/* Origin shift the cartesian coordinate p2(x2,y2) w.r.t. p1(x1,y1) */
origin_shifted_x2 = xctx->rx2 - xctx->rx1;
origin_shifted_y2 = xctx->ry2 - xctx->ry1;
/* Draw whichever component of the resulting orthogonal-wire is bigger (either horizontal or vertical), first */
if(origin_shifted_x2*origin_shifted_x2 > origin_shifted_y2*origin_shifted_y2)
xctx->manhattan_lines = 1;
else
xctx->manhattan_lines = 2;
}
/* wire x1,y1 point was moved