拖动源容器时,jsPlumb源端点不会移动 [英] jsPlumb source endpoint does not move when source container is dragged

查看:1322
本文介绍了拖动源容器时,jsPlumb源端点不会移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 jsPlumb ,其中在可拖动<$ c内部的子细分之间创建债券$ c>绝对定位的容器,名为 .project s。这些全部出现在一个大的通用容器 #container



它被设置为代码 jsPlumb.Defaults.Container = $(#container);



http://jsfiddle.net/wwc7G/5/



一切正常结束,但不是其他。即:


  • 创建2 绝对定位 .project 包含1
    任务 div 的容器


  • 然后将 .project 拖动到另一个任务上。 >包含源端点的容器 -
    源端点不会移动



为什么会这样?

当我从1个任务到另一个任务进行循环绑定,反之亦然,并移动每个 .project ,这一切都像一个魅力。

解决方案

要更新子(DIV)元素的连接,您需要使用自定义jQuery可拖动而不是jsPlumb.draggable。这里是自定义的jQuery可拖动的代码:

  newAgent.draggable({
containment:'parent',
drag:function(e){
$(this).find('._ jsPlumb_endpoint_anchor _')。each(function(i,e){
if($(e).hasClass(连接))
jsPlumb.repaint($(e).parent());
else
jsPlumb.repaint($(e));
});
}
});

更新小提琴


Using jsPlumb, where bonds are created between subdivs that are inside draggable absolute positioned containers called .projects. These all appear in a large generic container #container

Which is set as the default container in the code jsPlumb.Defaults.Container=$("#container");

http://jsfiddle.net/wwc7G/5/

Everything works fine in one end but not the other. That is:

  • When creating 2 absolute positioned .project containers with 1 task div in each

  • Then making 1 bond connection from 1 task to the other.

  • And dragging the .project container with the source end point - the source end point does not move.

Why is that the case?
When I make a cyclic bond from 1 task to the other and vice versa and move each .project, it all works like a charm.

解决方案

To update connections of child(DIV) elements you need to make use of customised jQuery draggable instead of jsPlumb.draggable. Here is the customised jQuery draggable for your code:

newAgent.draggable({
        containment: 'parent',
        drag:function(e){
            $(this).find('._jsPlumb_endpoint_anchor_').each(function(i,e){ 
                if($(e).hasClass("connect"))
                    jsPlumb.repaint($(e).parent());
                else
                    jsPlumb.repaint($(e));
            });                                     
        }
    });

Updated Fiddle

这篇关于拖动源容器时,jsPlumb源端点不会移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆