element.getBBox()

Return the bounding box of the element model, represented as a g.Rect.

Keep in mind that this function reports the dimensions of the element's model, not the dimensions of the element's view. (For example, the model bounding box does not include any associated ports). See the documentation of the elementView.getBBox function for details about the differences.

Example usage:

if (element1.getBBox().intersect(element2.getBBox())) {
    // intersection of the two elements
}