community-edition icon indicating copy to clipboard operation
community-edition copied to clipboard

Custom overlays: Add possibility to "auto rotate"

Open koppor opened this issue 11 years ago • 4 comments

I want to add custom overlays to my connections. I am going to include double arrows, squares, and arrows without being filled. Therefore, I think, I need to use the "Custom" overlay type. It works pretty well besides that the orientation of the custom overlay does not change when the connection is attached at another side of the shape.

In the case of arrows, they are rotated when a connection moves from the side to the top of the shape. Demo at http://liveweave.com/4FAhD6.

grabbed_20160728-055647

grabbed_20160728-055625

I see two solutions

  • Offer property autorotate
  • Offer overlay type CustomRotate

autorotate: Here, the default attachment is the right side of the shape. jsPlumb rotates the result of the "create" function according to the attachment. Possibly using the CSS transform: rotate(90deg); property.

CustomRotate: Here, the user has to specify four createFunctions: createTop, createRight, createBottom, and createLeft. jsPlumb calls the appropriate function when rendering the connection.

koppor avatar Jan 23 '14 09:01 koppor

Agreed - desperately need ability to rotate custom overlays

liamlevesque avatar Jul 17 '14 22:07 liamlevesque

My preference out of the two methods outlined above is for the second one, in which it is the writer of the Overlay whose responsibility it is to change the visual representation. But I haven't the time to do this in the near future.

sporritt avatar Jul 17 '14 22:07 sporritt

I have the same demand in my project. Is this problem solved?I can't find any update for this demand. Or could you please give me some advice to achieve it? @sporritt

linjinjin123 avatar Aug 06 '15 05:08 linjinjin123

I'm facing the same problem. I need to orientate custom overlays but I don't see the option to do it.

I could tap into the drag events to recalculate the orientation based on the elements position but it seems there's something similar already implemented within the library (arrows auto-orientate)... don't want to reinvent the wheel.

rojasjandro89 avatar Apr 17 '24 19:04 rojasjandro89