-
Notifications
You must be signed in to change notification settings - Fork 44
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
nodeDimensionsIncludeLabels
doesn't seem to work when using HTML labels
#24
Comments
nodeDimensionsIncludeLabels
doesn't seem to work when using HTML labels
I think that nothing can be done directly from this lib, I'm trying to do something similar but need some changes here and on cytoscape code, see: cytoscape/cytoscape.js#2497 |
@josejulio Since cytoscape/cytoscape.js#2497 is merged, what needs to be done to implement this? If you don't have the time, I might be able to open a PR to implement setting |
Long story short: I did that on other fork. If you could port it to this (or even provide a better implementation!), we could merge it here and improve this project, I'm no longer looking into adding anything else to the fork: https://github.com/josejulio/cytoscape-node-html-label/commits/master If you want to test how it works, you can consume it from npm but be warned that I don't have any plans on merging any PR on THAT fork anymore :) edit: In case you are curious, this is what I did with the fork: kiali/kiali-ui#1385 |
is there a reason we dont just merge that fix into master? |
@josejulio Can you give us a very brief walkthrough of what you've done on your fork and kiali's use of it? It looks fairly extensive on the fork. How specific are your changes to your own use cases on that fork? Can that become the mainline and changes in this repo merged into it? I see that the change for kiali is optimized only for labels at the center/bottom and was wondering if similar short cuts were performed in your repo. Fwiw, I was able to get all your code to work after some minor changes. i would offer to help with the merge, but I just started looking at cytoscape today for the first time Also, I am really not a front end eng. |
I don't work on Kiali anymore, so i'll try to list what was added and for what reason (focusing on public API / functionality).
That's what I remember on top of my head and from quickly looking the changes in the fork, but if you see the code and have some questions, please do. On the consumer side (Kiali) I implemented:
The changes in the fork could be integrated into this, they seem (IIRC) fairly generic. The chages in Kiali are a bit more specific, could eventually be integrated if they were generic enough.
Nice!
Sharing your changes could help someone else to integrate, or if i even find time I could try. But honestly haven't found time to setup CI for this repo (help wanted) Thanks! |
I didn't do much in terms of getting changes to work. I just pulled the fork down via NPM and copied the nodehtml update events from kiali in. Once they were in, the grid layout was able to include the proper width of the labels and no overlap. I thought I had height working (my labels are above not below the nodes), but it turns out there are some edge cases giving me problems and my understanding of the bounding boxes is missing something. |
From the
On Kiali's code, the top wasn't touched (here)
So that the bounding's height is expanded on top of the node, and not below. |
Brilliant, that worked. For others, I copied the code @josejulio linked to starting at line 373. Given collective time constraints but general desire to see this fixed, @josejulio do you think a user configurable call back with parameters bb / DOMNode to provide the newBE would be a reasonable solution here? Sec issues aside, the extension amplifies the value of the parent framework measurably. Be sad to see it wither. |
Great that it worked for you, note that on latest code (something i did after that PR) the check to see if the BE is different to current one is done in other way: Basically accepting a small error (
I would say that this could even be integrated in this library (probably with a opt-in or opt-out flag e.g. |
Yes, I initially went there as well but then I began to ponder the potential edge cases and didn't feel comfortable I could enumerate them all. For example, I plan on including some fairly exotic HTML in my labels (relatively speaking) for various visualization scenarios. |
There are always edge cases :)... Anyhow, i suppose an implementation with a callback to provide the new-BE would be easier to implement and let the user decide how it's going to work. Could you create the issue with the requirements? |
As this is working for me, it might be a good idea to hear from some other folks and generate more of a consensus viewpoint. |
I've noticed that the
nodeDimensionsIncludeLabels
option from various layouts doesn't seem to do anything when using this library. Specifically I'm noticing this with the dagre layout. Normal labels seem to work fine.Can this be fixed?
I can provide a minimal example if that is helpful.
The text was updated successfully, but these errors were encountered: