Access bpmn-js internals from bpmn-js-seed

Hi there,

I’m trying to implement a function which centers on a selected element(s). I’m using the pre-packaged bpmn-js-seed at which offers the bpmn-modeler.js at since I am rather new to the whole webtech/bower/require stuff.

I’ve had a look at the SearchPad feature and would like to just use the implementation of the function SearchPad.prototype._centerViewbox, which uses the function getBoundingBox like this var box = getBoundingBox(element); to define the box around the element(s). The function is included from Elements.js at

I cannot seem to access the required function from the pre-packaged bpmn-modeler.js. Where could I find it or how could I access it / the Element.js parts? I have looked at the offered functions of an initialised modeler as well as its canvas for example, but cannot seem to find it.


You are correct, you cannot easily access bundle details such as functions from diagram-js/lib/util/Elements.

This is intentional, as the library is meant to be used by its main entry points (Modeler, Viewer, …) in the bundled version only. If you would like to have more control use the non-bundled version. Write a few test cases, too to make sure you recognize once we decide to remove Elements or the methods provided by it.

To be safe simply copy whatever you need from Elements. This decreases your extensions likelihood with future library changes.