void SplicePicturesPanel::mouseMoveEvent(QMouseEvent *event) { int pos_x = event->pos().x(); int pos_y = event->pos().y(); if (_inDrag) { _didDrag = true; emit onDrag(_dragPosX, _dragPosY, pos_x, pos_y); _dragPosX = pos_x; _dragPosY = pos_y; } }
void ThirdPersonManipulator::onUserInput(UserInput* ui) { if (! m_enabled) { return; } if (m_dragging) { if (ui->keyDown(m_dragKey)) { // Continue dragging onDrag(ui->mouseDXY()); } else { // Stop dragging m_dragging = false; onDragEnd(ui->mouseXY()); } } else { // Highlight the axis closest to the mouse m_overAxis = NO_AXIS; float nearestDepth = (float)inf(); if (m_translationEnabled) { for (int g = FIRST_TRANSLATION; g <= LAST_TRANSLATION; ++g) { const _internal::UIGeom& geom = m_geomArray[g]; if (geom.contains(ui->mouseXY(), nearestDepth, m_dragTangent, m_dragW, m_maxAxisDistance2D)) { m_overAxis = g; } } } if (m_rotationEnabled) { for (int g = FIRST_ROTATION; g <= LAST_ROTATION; ++g) { const _internal::UIGeom& geom = m_geomArray[g]; if (geom.contains(ui->mouseXY(), nearestDepth, m_dragTangent, m_dragW, m_maxRotationDistance2D)) { m_overAxis = g; } } } // Maybe start a drag if ((m_overAxis != NO_AXIS) && ui->keyPressed(m_dragKey) && ui->keyDown(m_dragKey)) { // The user clicked on an axis m_dragAxis = m_overAxis; m_dragging = true; m_usingAxis[m_overAxis] = true; // Translation along two axes if ((m_overAxis >= XY) && (m_overAxis <= ZX)) { // Slect the two adjacent axes as well as the // box that was clicked on m_usingAxis[m_overAxis - 3] = true; m_usingAxis[(m_overAxis - 3 + 1) % 3] = true; } onDragBegin(ui->mouseXY()); } // if drag } // if already dragging } // userinput