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

Error when moving Endpoint in an svg Element #1047

Open
calss0t opened this issue Nov 13, 2023 · 0 comments
Open

Error when moving Endpoint in an svg Element #1047

calss0t opened this issue Nov 13, 2023 · 0 comments

Comments

@calss0t
Copy link

calss0t commented Nov 13, 2023

Hello!
I'm trying to create a simple app that uses an svg "g" element as the container where I add other svg elements.
I have no problem creating the endpoints and displaying then in the container, but when I try to move them, I get the error: "ERROR: cannot manage non-svg element when container is an SVG element."

I noticed that when clicking the point to try and move it around, jsplumb creates a div, and I have no idea where does it come from and how can I changes this.

My code looks like this:

rEndpointOptions = {
        endpoint: {
            type: DotEndpoint.type,
            options: {
                radius: 5,
                cssClass: 'plumb-endpoint',
            },
        },
        anchor: 'Right',
        maxConnections: -1,
        enabled: false,
    };


const svgContent = this.getSvgContentElement();

const layer = svgContent.querySelector('.layer');

this.instance = jsPlumbBrowserUI.newInstance({container: layer,});

this.instance.importDefaults({connectionsDetachable: false,});

function connector(source, target) {
    return {
        source: source,
        target: target,
        connector: {
            type: FlowchartConnector.type,
            options: {
                cornerRadius: 10,
            },
        },
        detachable: true,
    };
}

const node1R = this.instance.addEndpoint(
    svgContent.querySelector('#svg_I7tJF8owkZ-ozAP5Ps2tg'),
    this.rEndpointOptions,
);

const node2L = this.instance.addEndpoint(
    svgContent.querySelector('#svg_C2N7ckumsN6Welyl5FE2G'),
    this.lEndpointOptions,
);



this.instance.connect(connector(node2L,node1R),);

I would like to move the endpoint around and create new connections.
I would also like to be able to move the element around and have the endpoint move with the element.

Are these two things possible?

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

1 participant