1.1.0 • Published 7 days ago

diagram-js-grid-bg v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 days ago

diagram-js-grid-bg

A visual grid background for diagram-js, base on diagram-js-grid.

一个提供给 diagram-js 使用的虚拟网格背景,基于 diagram-js-grid 项目。

How to use 如何使用

  1. Clone this repository.
  2. Copy the GridLine directory to your own project.
  3. import it.
  1. 克隆这个项目.
  2. GridLine 这个目录复制到你自己的项目中.
  3. 使用 import 导入这个模块.

This project has been published as an NPM dependency package.

该项目已经发布为一个NPM依赖包

  1. Add the diagram-js-grid-bg to your project:
npm install diagram-js-grid-bg
  1. Add it to the additionalModules Array
import Modeler from 'bpmn-js/lib/Modeler'
import GridLineModule from 'diagram-js-grid-bg'


const modeler = new Modeler({
  container: '#container',
  additionalModules: [
    // ...
    GridLineModule
  ]
})

Configurations 配置项

This plugin module supports five custom configurations.

namedesctypedefaultrequired
smallGridSpacing最小网格边长number10false
gridSpacing大号网格边长numbersmallGridSpacing * 10false
gridLineStroke网格边框宽度number0.5false
gridLineOpacity网格边框透明度number0.4false
gridLineColor网格边框颜色string#cccfalse

Preview 效果预览

1. default 默认效果

default

2. custom config 自定义配置

import Modeler from 'bpmn-js/lib/Modeler'
import GridLineModule from '@/xxx/GridLine'


const modeler = new Modeler({
  container: '#container',
  additionalModules: [
    // ...
    GridLineModule
  ],
  gridLine: {
    smallGridSpacing: 20,
    gridSpacing: 80,
    gridLineStroke: 1,
    gridLineOpacity: 0.2,
    gridLineColor: '#20e512'
  }
})

custom