Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jsPlumb: Endpoints wrong position

Using Dojo, programmatically I'm creating box and placing it in inner div of the main div after placing the boxes I make use of addEndpoint() to add endpoints to my box, problem is the endpoints are not placing in right position. Here are my codes

<div data-dojo-attach-point="containerNode" class="divCenter navEditorDiv" style="">
<button data-dojo-attach-event="onClick: showPopOut" data-dojo-attach-point="createNode"
        class="btn  btn-primary fa fa-plus-square position" style=""></button>

<div data-dojo-attach-point="navigationNode"></div> </div>

above code is my HTML

jsplumbInstance: function () {
        if (!this._instance) {
            this._instance = jsPlumb.getInstance({
                // default drag options
                DragOptions: {cursor: 'pointer', zIndex: 2000},
                // the overlays to decorate each connection with.  note that the label overlay uses a function to generate the label text; in this
                // case it returns the 'labelText' member that we set on each connection in the 'init' method below.
                ConnectionOverlays: [
                    ["Arrow", {
                        location: 1,
                        visible: true,
                        id: "ARROW",
                        /* events:{
                         click:function() { alert("you clicked on the arrow overlay")}
                         }*/
                    }],
                    ["Label", {
                        location: 0.8,
                        id: "label",
                        cssClass: "aLabel fa fa-times",
                        /*events:{
                         tap:function() { jsPlumb.remove("label");}
                         }*/
                    }]
                ],

               Container: this.navigationNode
            });

        }
        return this._instance;
    },

above code is my jsPlumb instance in which "Container" is set to innerDiv dojo attach point

 leftEndPoints: function () {
        connectorPaintStyle = {
            lineWidth: 4,
            strokeStyle: "#61B7CF",
            joinstyle: "round",
            outlineColor: "white",
            outlineWidth: 2
        },
            // .. and this is the hover style.
            connectorHoverStyle = {
                lineWidth: 4,
                strokeStyle: "#216477",
                outlineWidth: 2,
                outlineColor: "white"
            },
            endpointHoverStyle = {
                fillStyle: "#216477",
                strokeStyle: "#216477"
            };
        var sourceEndpoint = {
            anchor: "RightMiddle",
            endpoint: "Dot",
            paintStyle: {
                strokeStyle: "#7AB02C",
                fillStyle: "transparent",
                radius: 7,
                lineWidth: 3
            },
            isSource: true,
            connector: ["Flowchart", {stub: [40, 60], gap: 10, cornerRadius: 5, alwaysRespectStubs: true}],
            connectorStyle: connectorPaintStyle,
            hoverPaintStyle: endpointHoverStyle,
            connectorHoverStyle: connectorHoverStyle,
            deleteEndpointsOnDetach: false,
            dragOptions: {},
            maxConnections: -1,
            overlays: [
                ["Label", {
                    location: [0.5, 1.5],
                    label: "Drag",
                    cssClass: "endpointSourceLabel",
                    visible: false
                }]
            ],
        };
        return sourceEndpoint;
    },

above code is my jsPlumb endpoint

domConstruct.place(rootWidget.boxNode, that.navigationNode);
that.jsplumbInstance().addEndpoint(rootWidget.boxNode,that.leftEndPoints());

using Dojo domConstruct.place I'm placing box in innerDiv and after placing I add endpoints to it.

Please help me to fix it.

Screenshot of wrong position

enter image description here

Expected result screenshot

enter image description here

like image 202
Amit Poojary Avatar asked Mar 24 '26 23:03

Amit Poojary


1 Answers

You can set you parent container with style position: absolute; to fix this.

like image 60
user3268360 Avatar answered Mar 27 '26 13:03

user3268360



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!