Factor in arrow radius and padding for SVG sizing#24
Conversation
|
Thanks for catching this. I don't really like how ad-hoc this fix is though, for example you set the height of the SVG twice. I'd like to do this a bit more robustly. At the very least, I would move the setAttribute(width/height) down to the bottom of the function when we're totally done with the SVG. I think then I would maybe add some kind of utility called const x2 = dst.pos.x + PORT_START;
const y2 = dst.pos.y;
const ym = (y1 - node.size.y) + layerHeights[layer] + TRACK_PADDING + trackHeights[layer] / 2 + node.jointOffsets[i];
const arrow = downwardArrow(x1, y1, x2, y2, ym, dst.block !== null);
svg.appendChild(arrow);
trackPositions([x1, x2], [y1, y2, ym]); // updates maxX and maxY with the given x's and y'sThat keeps the logic concise and close to the places where we draw, and gives me more peace of mind that we won't miss any other wacky paths in the future. |
Seems reasonable - that's probably a better choice. |
3134736 to
8fa9acd
Compare
8fa9acd to
8d5e531
Compare
|
I think this might be closer to ideal. Please let me know if I misinterpreted anything. |
|
Looks great! Sorry for the delay here. |
Fixes #23
I essentially just factor in adding the size of the CONTENT_PADDING and ARROW_RADIUS to the current y or x position. Then I take whatever is the greater of {y,x}max and this variable.
I think this is an appropriate way to solve this, but I'm quite open to refactoring if it's not quite the right approach.