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

Use Without Server #49

Closed
saulshanabrook opened this issue Jun 4, 2021 · 11 comments
Closed

Use Without Server #49

saulshanabrook opened this issue Jun 4, 2021 · 11 comments
Labels

Comments

@saulshanabrook
Copy link

Is it possible to create a similar editor without having a backend Java server? I see that elkjs lets you do the layout client side.

@uruuru
Copy link
Member

uruuru commented Jun 4, 2021

The json-based editor doesn't rely on the server, neither for layout nor for diagram generation. The corresponding code can be found here.

@uruuru uruuru added the question label Jun 4, 2021
@saulshanabrook
Copy link
Author

Great, thanks for the pointer!

I am looking into wrapping this as a React library.

@saulshanabrook
Copy link
Author

Have you considered publishing the client as a package on NPM to make it easier to reuse the rendering logic without having to copy all the code?

@uruuru
Copy link
Member

uruuru commented Jun 4, 2021

Not really. The example page simply evolved over time. Publishing a clean package with minimum requirements and a proper interface requires at least a little effort :).

Also, I'm not sure if sprotty already offers something as they frequently use ELK for layout. @spoenemann?

@saulshanabrook
Copy link
Author

Yep, totally understand.

I was thinking that over just using ELK, Sprotty offers an actual engine to materialize the graph on the page, as a replacement for something like cytoscapejs

@uruuru
Copy link
Member

uruuru commented Jun 4, 2021

FYI, there's been a discussion a while back regarding simple rendering: kieler/elkjs#85. Unfortunately, I've never found the time to look at it in further detail.

@saulshanabrook
Copy link
Author

Thanks for the pointer! I noticed that in the JSON editor, you have to put in the width and height explicitly for the nodes. However, with the elkt you don't. Do you know if it's possible to use the JS only code to automatically compute the widths and height based on the size of the node (the labels, etc)?

@uruuru
Copy link
Member

uruuru commented Jun 4, 2021

Slightly off-topic to the issue:

@saulshanabrook
Copy link
Author

saulshanabrook commented Jun 4, 2021

Thanks for the other pointers.

In trying to figure out how to get the browser based only method to generate node sizes, I also found kieler/elkjs#128 (comment) where you say:

In case you looked at the layouts of the elkt version of elk live, there the rendering part actually estimates the text dimensions using browser facilities.

Could you point me to where it does this estimation to see if I could use it with the code in the current JSON viewer to automatically try to size the nodes based on their label sizes?

@uruuru
Copy link
Member

uruuru commented Jun 5, 2021

Not off the top of my head as that happens somewhere in sprotty.

@spoenemann
Copy link
Member

Not sure whether that's what you're looking for, but we have https://www.npmjs.com/package/sprotty-elk

@uruuru uruuru closed this as completed Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants