# @bpmn-io/align-to-origin

> Align diagrams to the diagram origin

Latest version **0.7.0** (published 2021-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @bpmn-io/align-to-origin
pnpm add @bpmn-io/align-to-origin
yarn add @bpmn-io/align-to-origin
bun add @bpmn-io/align-to-origin
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2021-04-07 |
| First published | 2019-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 350.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Nico Rehwaldt |
| Maintainers | bpmn-io-admin, nikku, pinussilvestrus, barmac, philippfromme, maxtru |
| Keywords | BPMN, CMMN, DMN, plugin, bpmn-js, dmn-js, cmmn-js, diagram-js |

## Links

- npm: https://www.npmjs.com/package/@bpmn-io/align-to-origin
- Repository: https://github.com/bpmn-io/align-to-origin
- Homepage: https://github.com/bpmn-io/align-to-origin#readme
- Issues: https://github.com/bpmn-io/align-to-origin/issues
- npm.io page: https://npm.io/package/@bpmn-io/align-to-origin

## Recent versions

- 0.7.0 (latest) — 2021-04-07
- 0.6.0 — 2019-06-19
- 0.5.0 — 2019-02-14
- 0.4.2 — 2019-02-12
- 0.4.1 — 2019-02-11
- 0.4.0 — 2019-02-11
- 0.3.0 — 2019-02-10
- 0.2.0 — 2019-02-09
- 0.1.0 — 2019-02-09

## README

# @bpmn-io/align-to-origin

[![CI](https://github.com/bpmn-io/align-to-origin/workflows/CI/badge.svg)](https://github.com/bpmn-io/align-to-origin/actions?query=workflow%3ACI)


Aligns your diagrams to the coordinate origin `(0,0)`, manually triggered or on diagram save.

Plugs into your favorite [BPMN](https://github.com/bpmn-io/bpmn-js), [DMN](https://github.com/bpmn-io/dmn-js) and [CMMN](https://github.com/bpmn-io/cmmn-js) editor.

<img src="https://raw.githubusercontent.com/bpmn-io/align-to-origin/master/resources/screencapture.gif" width="600" alt="Automatic Origin Adjustment" />

_Alignment in action. [Diagram origin marker](https://github.com/bpmn-io/diagram-js-origin), alignment corridor, and element boxes shown for demonstration purposes only._


## Usage

```javascript
import BpmnModeler from 'bpmn-js/lib/Modeler';

import AlignToOrigin from '@bpmn-io/align-to-origin';


// extend the BPMN editor with the exporter module
const modeler = new BpmnModeler({
  alignToOrigin: {
    alignOnSave: true,
    offset: 150,
    tolerance: 50
  },
  additionalModules: [
    AlignToOrigin
  ]
});


// hooks into #saveXML to align the diagram elements
modeler.saveXML(function(err, xml) {
  ...
});

// may be used standalone, too
const alignToOrigin = modeler.get('alignToOrigin');

alignToOrigin.align();
```


## License

MIT

---
_Source: https://npm.io/package/@bpmn-io/align-to-origin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
