| 794 | } |
| 795 | |
| 796 | void EditBox::frameEntered(float _frame) |
| 797 | { |
| 798 | if (mClientText == nullptr) |
| 799 | return; |
| 800 | |
| 801 | // в статике все недоступно |
| 802 | if (mModeStatic) |
| 803 | return; |
| 804 | |
| 805 | if (mCursorActive) |
| 806 | { |
| 807 | mCursorTimer += _frame; |
| 808 | |
| 809 | if (mCursorTimer > EDIT_CURSOR_TIMER) |
| 810 | { |
| 811 | mClientText->setVisibleCursor(!mClientText->isVisibleCursor()); |
| 812 | while (mCursorTimer > EDIT_CURSOR_TIMER) |
| 813 | mCursorTimer -= EDIT_CURSOR_TIMER; |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | // сдвигаем курсор по положению мыши |
| 818 | if (mMouseLeftPressed) |
| 819 | { |
| 820 | mActionMouseTimer += _frame; |
| 821 | |
| 822 | if (mActionMouseTimer > EDIT_ACTION_MOUSE_TIMER) |
| 823 | { |
| 824 | IntPoint mouse = InputManager::getInstance().getMousePositionByLayer(); |
| 825 | const IntRect& view = getClientWidget()->getAbsoluteRect(); |
| 826 | mouse.left -= view.left; |
| 827 | mouse.top -= view.top; |
| 828 | IntPoint point; |
| 829 | |
| 830 | bool action = false; |
| 831 | |
| 832 | // вверх на одну строчку |
| 833 | if ((mouse.top < 0) && (mouse.top > -EDIT_ACTION_MOUSE_ZONE)) |
| 834 | { |
| 835 | if ((mouse.left > 0) && (mouse.left <= getClientWidget()->getWidth())) |
| 836 | { |
| 837 | point = mClientText->getCursorPoint(mCursorPosition); |
| 838 | point.top -= mClientText->getFontHeight(); |
| 839 | action = true; |
| 840 | } |
| 841 | } |
| 842 | // вниз на одну строчку |
| 843 | else if ( |
| 844 | (mouse.top > getClientWidget()->getHeight()) && |
| 845 | (mouse.top < (getClientWidget()->getHeight() + EDIT_ACTION_MOUSE_ZONE))) |
| 846 | { |
| 847 | if ((mouse.left > 0) && (mouse.left <= getClientWidget()->getWidth())) |
| 848 | { |
| 849 | point = mClientText->getCursorPoint(mCursorPosition); |
| 850 | point.top += mClientText->getFontHeight(); |
| 851 | action = true; |
| 852 | } |
| 853 | } |
nothing calls this directly
no test coverage detected