jsPlumb: неправильное положение конечных точек

Используя Dojo, я программно создаю блок и помещаю его во внутренний div основного блока после размещения блоков. Я использую addEndpoint() для добавления конечных точек в свой блок, проблема в том, что конечные точки не размещаются в правильном положении. Вот мои коды

<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>

выше код мой 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;
    },

приведенный выше код - это мой экземпляр jsPlumb, в котором "Контейнер" установлен в точку присоединения innerDiv dojo

 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;
    },

приведенный выше код - моя конечная точка jsPlumb

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

используя Dojo domConstruct.place, я помещаю блок в innerDiv и после размещения добавляю к нему конечные точки.

Пожалуйста, помогите мне исправить это.

Скриншот неправильного положения

введите здесь описание изображения

Скрин ожидаемого результата

введите здесь описание изображения


person Amit Poojary    schedule 13.05.2016    source источник


Ответы (1)


Вы можете установить родительский контейнер со стилем position: absolute;, чтобы исправить это.

person user3268360    schedule 13.04.2017
comment
В моем случае я не устанавливал контейнер через jsplumb setContainer. Просто установка контейнера решила проблему. - person saivishnu tammineni; 26.02.2021