Skip to content

Latest commit

 

History

History
71 lines (48 loc) · 1.38 KB

README.md

File metadata and controls

71 lines (48 loc) · 1.38 KB

diagram-js Element Detection

⚠️ This is a highly experimental feature! Do NOT use this in production!

A utility that detects elements at a point or in a rectangular area.

Screencast

To verify the usefulness of such a feature this project also implements ExpandSubProcessBehavior solving a common issue in bpmn-js.

const elementDetection = bpmnModeler.get('elementDetection');

// works with points
const point = {
  x: 100,
  y: 100
};

let detectedElements = elementDetection.detectAt(point);

// works with rects
const rect = {
  x: 100,
  y: 100,
  width: 100,
  height: 100
};

detectedElements = elementDetection.detectAt(rect);

const trbl = {
  top: 100,
  right: 200,
  bottom: 200,
  left: 100
};

detectedElements = elementDetection.detectAt(trbl);

Run

Install:

npm install

Run an example featuring ExpandSubProcessBehavior:

npm start

Test:

npm test

or

npm run dev

License

MIT