Socket
Book a DemoInstallSign in
Socket

@logicflow/layout

Package Overview
Dependencies
Maintainers
7
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logicflow/layout

LogicFlow layout

2.0.1
latest
Source
npmnpm
Version published
Weekly downloads
161
-1.23%
Maintainers
7
Weekly downloads
 
Created
Source

layout

layout 扩展包

安装

npm install @logicflow/layout

or

yarn add @logicflow/layout

or

pnpm add @logicflow/layout

使用方式

import LogicFlow from '@logicflow/core';
import { Dagre } from '@logicflow/layout';

const lf = new LogicFlow({
  container: '#app',
  plugins: [Dagre]
})

// 基本使用方式 - 无参数
lf.extension.dagre.layout()

// 使用布局参数
lf.extension.dagre.layout({
  rankdir: 'LR', // 从坐到右布局
  ranksep: 100    // 层级间距
  nodesep: 50,   // 节点间距
})

DagreOption 参数说明

参数名类型默认值说明
rankdirstring'LR'布局方向,'LR'(左到右), 'TB'(上到下), 'BT'(下到上), 'RL'(右到左)
alignstring'UL'节点对齐方式,'UL'(上左), 'UR'(上右), 'DL'(下左), 'DR'(下右)
nodesepnumber100节点间的水平间距(像素)
ranksepnumber150层级间的垂直间距(像素)
marginxnumber120图的水平边距(像素)
marginynumber120图的垂直边距(像素)
rankerstring'tight-tree'排名算法,'network-simplex', 'tight-tree', 'longest-path'
edgesepnumber10边之间的水平间距(像素)
acyclicerstringundefined如果设置为'greedy',使用贪心算法查找反馈弧集,用于使图变为无环图
isDefaultAnchorbooleanfalse是否是系统默认锚点(默认上下左右4个锚点),当为true时会自动调整连线的路径

布局方向示例

从左到右 (LR)

lf.extension.dagre.layout({
  rankdir: 'LR'  // 默认值
})

从上到下 (TB)

lf.extension.dagre.layout({
  rankdir: 'TB'
})

默认锚点的话(默认上下左右4个锚点), 会自动调整连线的路径以及起终点位置

lf.extension.dagre.layout({
  rankdir: 'TB',
  isDefaultAnchor: true  // 调整连线锚点
})

Keywords

@logicflow/layout

FAQs

Package last updated on 02 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.