currentFont = textOwner.getFont();
}
public void invokeStep(int x, int y, int anchorX, int anchorY, DrawingView view)
{
TextElementFigure textOwner = (TextElementFigure) owner();
// Compute the distance to the original position; apply a factor so the resizing effect won't be too strong
int xDiff = x - anchorX;
int yDiff = y - anchorY;
int dist = (int) Math.sqrt(xDiff * xDiff + yDiff * yDiff) / 10;
if (xDiff + yDiff < 0)
{
// Moving to the upper left means smaller
dist = -dist;
}
int newSize = currentFont.getSize() + dist;
if (newSize < 8)
{
// No smaller than 8 pt
newSize = 8;
}
textOwner.setFont(new Font(currentFont.getName(), currentFont.getStyle(), newSize));
}