| | |
| | | GetItemRect(m_pCurItem, &rcItem); |
| | | |
| | | if (::GetCapture() == NULL) { |
| | | const int kDragThreshold = 3; // debounce: click should not trigger line recalculation |
| | | bool bDragging = false; |
| | | SetCapture(m_hWnd); |
| | | ASSERT(m_hWnd == GetCapture()); |
| | | AfxLockTempMaps(); |
| | |
| | | case WM_MOUSEMOVE: |
| | | ptNew = msg.pt; |
| | | ::ScreenToClient(m_hWnd, &ptNew); |
| | | if (!bDragging) { |
| | | if (abs(ptNew.x - pt.x) >= kDragThreshold || abs(ptNew.y - pt.y) >= kDragThreshold) { |
| | | bDragging = true; |
| | | } |
| | | else { |
| | | break; |
| | | } |
| | | } |
| | | rcNewItem.left = rcItem.left + (ptNew.x - pt.x); |
| | | rcNewItem.right = rcItem.right + (ptNew.x - pt.x); |
| | | rcNewItem.top = rcItem.top + (ptNew.y - pt.y); |
| | |
| | | case WM_LBUTTONUP: |
| | | ptNew = msg.pt; |
| | | ::ScreenToClient(m_hWnd, &ptNew); |
| | | if (!bDragging) { |
| | | ReleaseCapture(); |
| | | goto ExitLoop; |
| | | } |
| | | m_pCurItem->rect.left = m_nMagneticLinVer > 0 ? m_nMagneticLinVer : (rcItem.left + (ptNew.x - pt.x) + m_nOffsetX); |
| | | m_pCurItem->rect.right = m_pCurItem->rect.left + (rcItem.right - rcItem.left); |
| | | m_pCurItem->rect.top = m_nMagneticLinHoz > 0 ? m_nMagneticLinHoz : (rcItem.top + (ptNew.y - pt.y) + m_nOffsetY); |