react-archer icon indicating copy to clipboard operation
react-archer copied to clipboard

Stepped Lines

Open cole-robertson opened this issue 5 years ago • 4 comments
trafficstars

There is a use case I have where I would like the lines drawn stepped. Currently: image

I would like it to be like: image

I currently have:

const CONTAINER_STYLE = {
  arrowLength: 0,
  noCurves: true,
  offset: 0,
  strokeColor: "#50616f",
};

and:

const ANCHOR_SETTINGS: IAnchorPositions = {
  sourceAnchor: "bottom",
  targetAnchor: "left",
};

Is there anything I can do currently to achieve my desired result? Thank you!

cole-robertson avatar May 22 '20 19:05 cole-robertson

Hey 😊

Unfortunately it is not possible right now, but I'd love to have the option to customize the paths more. No ETA yet because it might be quite complex!

To quickly solve your issue, you could fork the project (or use patch-package) and edit the following : https://github.com/pierpo/react-archer/blob/f1c316f23759865a3fd98fcb27532781f7c2b282/src/SvgArrow.js#L157

You'll be able to do a custom path that fits your needs by changing these lines 😉

pierpo avatar May 25 '20 08:05 pierpo

Hey @pierpo, is here any way to achieve this yet?

sumdook avatar May 30 '23 12:05 sumdook

Hey! Well, I'd suggest to:

  • either fork the lib, and find a solution to change the paths for your specific use case
  • find some dirty work-arounds... maybe by creating fake archer elements, creating some straight lines to them (arrow with no pointer), and do the 90° turn this way. This is super super dirty, you'd have to handle the positions manually yourself, which may not be always possible. But it requires no action on the lib's side to work.

Having it as required in the core of the lib is, as I said previously, not an obvious solution 😢 I have no estimation for it, maybe it's not that hard 🤷 It'd require some thinking.

pierpo avatar May 30 '23 21:05 pierpo

Thanks, appreciate the response!

sumdook avatar Jun 01 '23 10:06 sumdook