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

HTML Label visibility when corresponding node is not displayed or invisible #14

Open
cversari opened this issue Aug 20, 2018 · 5 comments

Comments

@cversari
Copy link

Hello,
the HTML Label is visible independently of the style of the node. So if the node style is
{ display: 'none' } or { visibility: 'hidden' } the HTML label is still visible even if the corresponding node is not.

In practice this is not a problem, in fact it is very easy to hide the HTML label by checking the style of the node in the function assigned to the "tpl" attribute in the parameters passed to cy.nodeHtmlLabel().

However, I cannot figure out a case where the HTML should be visible when the node style is { display: 'none' } (while it may make sense to let the HTML label visible even if the style is { visibility: 'hidden' }).

So I am not sure whether this behavior is a bug, I am just reporting it in the case it is.

Cristian

@McManning
Copy link

Hey Cristian,

Coincidentally - I've ran into the same issue today and was about to open a ticket as well 😄. What was your workaround for accessing the Cytoscape node? I wasn't able to find a way to access the underlying node from within the tpl function - only the data stored in the node's data().

Thanks!
Chase

@cversari
Copy link
Author

Hi Chase,
in the node's data() I get the id of the node, then I query the cytoscape main object to find the node (something like cy.$('#' + data.id)). Let me know if that works for you.

Cristian

@jspautsch
Copy link

in the node's data() I get the id of the node, then I query the cytoscape main object to find the node (something like cy.$('#' + data.id)). Let me know if that works for you.

We did the same thing (except with cy.getElementById), but it would be nice if the tpl function returned the actual element. I'm not sure why it only returns the data.

@maxkfranz
Copy link

It is possible to use something like query: 'node:visible'?

@josejulio
Copy link
Collaborator

josejulio commented Aug 14, 2019

It is possible to use something like query: 'node:visible'?

That works for me.

This would also "hide" (as the last rule) the text if you have several rules

{
    query: 'node:hidden',
    tpl: () => ''
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants