public synchronized void resizeTo(int x, int y, int direction) {
		if (direction == 1) {
			setBreadth(2.0 * Math.abs(ry - y));
		} else if (direction == 0) {
			setLength(2.0 * Math.abs(rx - x));
		}
		if (breadth < MIN_BREADTH)
			setBreadth(MIN_BREADTH);
		else if (breadth > MAX_BREADTH)
			setBreadth(MAX_BREADTH);
		if (length < MIN_LENGTH)
			setLength(MIN_LENGTH);
		else if (length > MAX_LENGTH)
			setLength(MAX_LENGTH);
		if (breadth > length) {
			double temp = length;
			setLength(breadth);
			setBreadth(temp);
		}
		if (length - breadth < GayBerneConfigure.GB_LIMIT) {
			setLength(breadth + GayBerneConfigure.GB_LIMIT);
		}
		locateRects();
		model.view.repaint();
	}