【问题标题】:jsPlumb container is not scrolling when moving objects to the top or left将对象移动到顶部或左侧时,jsPlumb容器不滚动
【发布时间】:2014-02-25 14:11:31
【问题描述】:

我正在使用 jsPlumb,我面临的问题是,当我将对象拖到容器顶部或左侧时,滚动条会显示但对象将不可见,否则当将对象向下或向右拖动时滚动条出现了,我可以滚动查看对象,有没有办法解决这个问题?

谢谢

【问题讨论】:

  • 您是否使用jsPlumb.draggable() 使元素可拖动?
  • @user2964819 找到解决方案了吗?

标签: javascript jquery html jsplumb


【解决方案1】:

我建议您扩展 jQuery 可拖动并包含 scroll 选项,而不是使用 jsPlumb.draggable()

$('#elementId').draggable(
{
    scroll:true,
    drag: function(){
        jsPlumb.repaint($(this)); // To repaint the connections and endpoints when element is dragged
    }
});

【讨论】:

    【解决方案2】:

    https://github.com/jsplumb/jsplumb/issues/212

    这个 GitHub 问题并不能完全解决问题,但您可以限制您的可拖动项从顶部或左侧移动。

    在可拖动选项中,添加:

    {
        getConstrainingRectangle: () => [99999, 99999],
        containment: true,
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-26
      相关资源
      最近更新 更多