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

redrawing html elements when node resized #55

Open
bunsenbeaker opened this issue Jul 16, 2024 · 1 comment
Open

redrawing html elements when node resized #55

bunsenbeaker opened this issue Jul 16, 2024 · 1 comment
Labels
question Further information is requested

Comments

@bunsenbeaker
Copy link

Hi,
I'm using renderPerNode() with a HTML layer in order to create an Image object to be displayed on bottom right edge of my Cytoscape circular node, using the following options object:

{
                init: (elem: HTMLElement, node: NodeSingular): void => {
                    const domain: DomainDTO = node.data('dto');
                    const selected: boolean = node.data('selected');

                    if (domain.primary) {
                        const img = new Image();
                        img.src = 'assets/icons/primary_domain.svg';
                        img.width = 4;
                        img.height = 4;
                        img.style.transform = selected ? 'translate(20px, 20px)' : 'translate(5.1px, -5px)';
                        elem.appendChild(img);
                    }
                },
                uniqueElements: true,
                checkBounds: true,
                updateOn: 'auto'
            }

This adds the image perfectly, it's resized properly when zooming in/out, however when my nodes width & height are changed (based on Cytoscale stylesheet width+height properties) image is not redrawn so I can't recalculate its transform values.
I tried various 'updateOn' values with no luck...

Screenshots / Sketches

Context

  • Version:
  • Browser:

Additional context

@bunsenbeaker bunsenbeaker added the question Further information is requested label Jul 16, 2024
@sgratzl
Copy link
Owner

sgratzl commented Jul 18, 2024

you have to take a look what events cytoscape is sending out. The updateOn parameter allows to provide any cytoscape events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants