use of org.kie.workbench.common.stunner.lienzo.toolbox.items.AbstractPrimitiveItem in project kie-wb-common by kiegroup.
the class ItemGridImpl method itemsUpdated.
private ItemGridImpl itemsUpdated() {
// Reposition items as for the given grid.
repositionItems();
// Calculate BB.
double maxw = 0;
double maxh = 0;
for (final AbstractDecoratedItem item : items) {
final Point2D location = item.asPrimitive().getLocation();
final BoundingBox itemBB = (BoundingBox) item.getBoundingBox().get();
final double itemw = itemBB.getWidth() + location.getX();
final double itemh = itemBB.getHeight() + location.getY();
if (itemw > maxw) {
maxw = itemw;
}
if (itemh > maxh) {
maxh = itemh;
}
}
boundingBox = new BoundingBox(0, 0, maxw, maxh);
// Update decorator.
if (null != getWrapped().getDecorator()) {
getWrapped().getDecorator().setBoundingBox(getBoundingBox().get());
if (getWrapped().getDecorator() instanceof AbstractPrimitiveItem) {
((AbstractPrimitiveItem) getWrapped().getDecorator()).asPrimitive().moveToBottom();
}
}
return this;
}
Aggregations