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

Dynamic positions for inputs and outputs nodes #917

Open
jeremiecourlivant opened this issue Dec 11, 2024 · 2 comments
Open

Dynamic positions for inputs and outputs nodes #917

jeremiecourlivant opened this issue Dec 11, 2024 · 2 comments

Comments

@jeremiecourlivant
Copy link

Hello,

I test Drawflow since severals days and it works fine and it's very useful.

I follow this issue to positioningg the inputs and outputs : #363 (comment).

image

It works fine but if I add text on the node after the creation of the node, the positionning is wrong.

image

I try to add the text after the inputs/outputs but it moves. I thought that the connections wouldn't move becaus the text is below.

image

I try to reapplicate the code to place the connections and it doesn't work, and the placement depends of the position of the node on the screen.

I tryy to get the height of the added text and add or substract this height to the positions of the connection but it doesn't work.

So, do you have a solution for this problem ?

Thanks,
Jérémie

@jerosoler
Copy link
Owner

This may be of help to you:

@jeremiecourlivant
Copy link
Author

It helps, thanks, the connection is in the right place with updateConnectionNodes, but not the circle, with or without the code :

const links =  document.querySelectorAll(`#node-${id} .drawflow_content_node .link`);
    links.forEach((item) => {
        var target = document.querySelector(`#node-${id} .outputs .${item.classList[1]}`);
        if(target != null) {
            const pos = item.getBoundingClientRect();
            const targetPos = target.getBoundingClientRect();
            target.style.top = `${pos.y - targetPos.y}px`;
        }
        target = document.querySelector(`#node-${id} .inputs .${item.classList[1]}`);
        if(target != null) {
            const pos = item.getBoundingClientRect();
            const targetPos = target.getBoundingClientRect();
            target.style.top = `${pos.y - targetPos.y}px`;
        }
})

image

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

No branches or pull requests

2 participants