Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom overlays: Add possibility to "auto rotate" #8

Open
koppor opened this issue Jan 23, 2014 · 4 comments
Open

Custom overlays: Add possibility to "auto rotate" #8

koppor opened this issue Jan 23, 2014 · 4 comments
Labels
enhancement New feature or request

Comments

@koppor
Copy link

koppor commented Jan 23, 2014

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.

@liamlevesque
Copy link

Agreed - desperately need ability to rotate custom overlays

@sporritt
Copy link
Member

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.

@linjinjin123
Copy link

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

@sporritt sporritt transferred this issue from jsplumb/jsplumb Oct 17, 2023
@rojasjandro89
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants