javascript - 如何增加模板柱之间的间隙

标签 javascript jointjs rappid

  this.stencil = new joint.ui.Stencil({
    paper: this.paper,
    width: 240,
    height: 500,
    label: 'Components',
    layout: {
      columnWidth: 80,
      columns: 2,
      rowHeight: 130,
    },
  });

我使用此代码在模板中创建两列布局。有没有办法添加任何填充或增加两列之间的间隙?

最佳答案

可以通过在 layout 配置中分别设置水平和垂直间隙的 dxdy 属性来完成 -

this.stencil = new joint.ui.Stencil({
    paper: this.paper,
    width: 240,
    height: 500,
    label: 'Components',
    layout: {
      columnWidth: 80,
      columns: 2,
      rowHeight: 130,
      dy: 10,
      dx: 10,
      deep: true
    },
  });

您可以改变 dxdy 的值来实现您真正想要的间隙。

您可以引用 ui.Stencil 下的“布局”。这是链接 - https://resources.jointjs.com/docs/rappid/v2.3/ui.html#ui.Stencil

布局配置的说明可以在 - https://resources.jointjs.com/docs/rappid/v2.3/layout.html#layout.GridLayout 找到。

关于javascript - 如何增加模板柱之间的间隙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51658331/

相关文章:

jquery - joint.js 在新的克隆元素上触发拖动开始

jointjs - 将元素粘贴到 Rappid 中的另一个图表中?

jointjs - rappid Joint js 是否能够在布局完好的情况下从 JSON 保存和重新加载图表

javascript - 更加模块化;在 .js 文件中包含 html 元素?

javascript - 在同一页面上管理两个 facebook 像素

javascript - 如何使用 JavaScriptCore 将错误记录到 XCode?

javascript - 是否可以遍历一个对象并获取键名($key => $value)?

hyperlink - JointJs 如何使链接相互避开。不要结 block