clientIO / JointJS_plus

JointJS+ support
4 stars 9 forks source link

Routes draw a loop instead of straight connection when the distance between shapes is quite short - cause found #67

Open KarolBuchta opened 8 years ago

KarolBuchta commented 8 years ago

Rappid v1.7.0

Seen when using orthogonal routing and ports/magnets. Maybe also other routing options.

See example: http://screencast.com/t/yjctvFXA

The reason for this is in:

joint.dia.LinkView.findRoute() newVertices = routerFn.call(this, oldVertices or [], args, this)

args contains always the same elementPadding, no matter how long the connection is. I fixed this for me in a hacky way, but you can surely do better.

if @sourceBBox? && @sourceBBox.center().distance(@targetBBox.center()) < 100 #TODO: Use the shortLink option here
  newVertices = routerFn.call(this, oldVertices or [], {elementPadding: 0.00001}, this)
else
  newVertices = routerFn.call(this, oldVertices or [], args, this)
DavidDurman commented 8 years ago

Hi Karel,

Thanks for finding this! We'll investigate what's the best way to solve this. It has something to do with routing + elementPadding + embedded elements combination.

Thanks