void KeyHandlesSheet::OnCursorStillDown(const Input::Cursor& cursor) { if (cursor.isPressed) { if (!mIsFrameSelecting) { if (cursor.delta != Vec2F()) mIsFrameSelecting = true; } if (mIsFrameSelecting) { mSelectionFrame->enabled = true; Vec2F current(mTimeline->WorldToLocal(cursor.position.x), mTree->GetLineNumber(cursor.position.y)); mSelectionRect.left = Math::Min(mBeginSelectPoint.x, current.x); mSelectionRect.right = Math::Max(mBeginSelectPoint.x, current.x); mSelectionRect.top = Math::Floor(Math::Min(mBeginSelectPoint.y, current.y)); mSelectionRect.bottom = Math::Ceil(Math::Max(mBeginSelectPoint.y, current.y)); DeselectAll(); for (auto handle : mBeginSelectHandles) SelectHandle(handle); for (auto handle : mHandles) { Vec2F handlePos(handle->GetPosition().x, mTree->GetLineNumber(handle->GetScreenPosition().y)); if (handlePos.x > mSelectionRect.left && handlePos.x < mSelectionRect.right && handlePos.y > mSelectionRect.top && handlePos.y < mSelectionRect.bottom + 0.5f) { SelectHandle(handle); } } } } }
foreach (Handle * handle, m_handles) { handle->setPos(handlePos(handle->handlePos())); handle->setRotation(-m_path->style()->rotation()); }