bool ZLTextSelectionModel::extendTo(int x, int y) {
	if (!myIsActive || myView.myTextElementMap.empty()) {
		return false;
	}

	Range oldRange = internalRange();
	setBound(mySecondBound, x, y);
	Range newRange = internalRange();
	myStoredX = x;
	myStoredY = y;

	if (!mySecondBound.Before.Exists) {
		startSelectionScrolling(false);
	} else if (!mySecondBound.After.Exists) {
		startSelectionScrolling(true);
	} else {
		stopSelectionScrolling();
	}

	if ((oldRange.first != newRange.first) || (oldRange.second != newRange.second)) {
		myTextIsUpToDate = false;
		clearData();
		myRangeVectorIsUpToDate = false;
		myRanges.clear();
		return true;
	}
	return false;
}
bool ZLTextView::onStylusMovePressed(int x, int y) {
	switch (myTextAreaController.area().selectionModel().extendTo(textArea().realX(x), y)) {
		case ZLTextSelectionModel::BOUND_NOT_CHANGED:
			stopSelectionScrolling();
			break;
		case ZLTextSelectionModel::BOUND_CHANGED:
			stopSelectionScrolling();
			ZLApplication::Instance().refreshWindow();
			break;
		case ZLTextSelectionModel::BOUND_OVER_BEFORE:
			startSelectionScrolling(false);
			ZLApplication::Instance().refreshWindow();
			break;
		case ZLTextSelectionModel::BOUND_OVER_AFTER:
			startSelectionScrolling(true);
			ZLApplication::Instance().refreshWindow();
			break;
	}
	return true;
}