cytoscape.js-edgehandles icon indicating copy to clipboard operation
cytoscape.js-edgehandles copied to clipboard

Cannot style ghost node

Open nielsboogaard opened this issue 1 year ago • 6 comments

I want to use the created ghost node as some kind of placeholder to allow users to create a new target node (in case the user stops the edge handling and the mouse is not on a existing target node).

However, I noticed that my styling (targeting the classname 'eh-ghost-node') about width, height and opacity etc are not applied. This is due to this plugin setting those hardcoded.

My workaround now is just overriding those styles upon the 'ehstart' event like this:

this.cy.on('ehstart', () => {
   window.setTimeout(() => {
      this.cy.nodes('.eh-ghost-node').style({
        "width": 300,
        "height": 30,
        'opacity': 1
      });
    }, 10)
});

But that's of course rather ugly. Is it an idea to only apply the default styling when no custom styling is available?

nielsboogaard avatar Nov 21 '23 15:11 nielsboogaard

You're outlining a new use case.

Current behaviour prevents user error w.r.t. the stylesheet. You can currently start with no special styles in your stylesheet and the extension 'just works', even though it's unstyled and it's not pretty.

Your proposed use case looks valid and it would be good to support it -- but it would be good to keep this nice, old behaviour in some way for the benefit of novices.

maxkfranz avatar Nov 22 '23 15:11 maxkfranz

This issue has been automatically marked as stale, because it has not had activity within the past 30 days. It will be closed if no further activity occurs within the next 30 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

stale[bot] avatar Dec 07 '23 00:12 stale[bot]

@nielsboogaard, would you make a pull request with your proposed changes?

maxkfranz avatar Dec 07 '23 12:12 maxkfranz

hey @maxkfranz have to see when I have time for this, but I'll give it a try!

nielsboogaard avatar Dec 07 '23 13:12 nielsboogaard

Great. Let me know if you have any questions.

Let's plan to keep the current behaviour by default, since it serves most use cases well. Your new behaviour could be exposed in a new boolean option.

maxkfranz avatar Dec 07 '23 21:12 maxkfranz

This issue has been automatically marked as stale, because it has not had activity within the past 30 days. It will be closed if no further activity occurs within the next 30 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

stale[bot] avatar Dec 22 '23 11:12 stale[bot]

This issue has been automatically marked as stale, because it has not had activity within the past 30 days. It will be closed if no further activity occurs within the next 30 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

stale[bot] avatar Jul 05 '24 22:07 stale[bot]