Skip to content

philippfromme/diagram-js-element-detection

Repository files navigation

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

About

Detect elements at a given position. 🔍

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published