bounds = new Rectangle(first);
bounds.add(e.getPoint());
if (graphComponent.isSignificant(bounds.width, bounds.height))
{
mxGraphControl control = graphComponent.getGraphControl();
// Repaints exact difference between old and new bounds
Rectangle union = new Rectangle(oldBounds);
union.add(bounds);
if (bounds.x != oldBounds.x)
{
int maxleft = Math.max(bounds.x, oldBounds.x);
Rectangle tmp = new Rectangle(union.x - 1, union.y, maxleft
- union.x + 2, union.height);
control.repaint(tmp);
}
if (bounds.x + bounds.width != oldBounds.x + oldBounds.width)
{
int minright = Math.min(bounds.x + bounds.width,
oldBounds.x + oldBounds.width);
Rectangle tmp = new Rectangle(minright - 1, union.y,
union.x + union.width - minright + 1, union.height);
control.repaint(tmp);
}
if (bounds.y != oldBounds.y)
{
int maxtop = Math.max(bounds.y, oldBounds.y);
Rectangle tmp = new Rectangle(union.x, union.y - 1,
union.width, maxtop - union.y + 2);
control.repaint(tmp);
}
if (bounds.y + bounds.height != oldBounds.y + oldBounds.height)
{
int minbottom = Math.min(bounds.y + bounds.height,
oldBounds.y + oldBounds.height);
Rectangle tmp = new Rectangle(union.x, minbottom - 1,
union.width, union.y + union.height - minbottom + 1);
control.repaint(tmp);
}
if (!graphComponent.isToggleEvent(e)
&& !graphComponent.getGraph().isSelectionEmpty())
{