jsoncanvas icon indicating copy to clipboard operation
jsoncanvas copied to clipboard

Proposal: Edge offset property

Open Gargafield opened this issue 11 months ago • 0 comments

fromOffset and toOffset property

Currently creating three edges between a pair of nodes will create this clutter:

image

This is of course not very useful, and I therefor propose fromOffset and toOffset. The properties store an integer for the pixel offset of the edge. Where 0 is center of the side, positive being 'up' the side and negative being 'down' it. Meaning a positive offset will push the edge towards the positive axis of the side. For example, with toSide: 'bottom' will toOffset: -100 push the edge arrow 100 pixels towards -x (left). Offsets other than 0 need to be clamped with in sideLength/2 and -sideLength/2, as the edge shouldn't be able to start and end past the node side. The properties are optional and default to 0 (the center) when not defined.

image

// Edge object
{
   ...properties,
  "fromOffset": 0,
  "toOffset": 100
},
  • fromOffset (optional, integer) is the pixel offset on the side where this edge starts.
  • toOffset (optional, integer) is the pixel offset on the side where this edge ends.

This proposal shouldn't be considered done. I will try to accommodate any feedback.

Gargafield avatar Mar 22 '24 12:03 Gargafield