Commit fcbb9511 authored by Tobias Neeb's avatar Tobias Neeb
Browse files

[FIX 760] extend on mouseReleaseEvent of controlPoints to update the widget-polygon correctly

parent cdaeffbb
......@@ -94,7 +94,7 @@ QVariant WTransferFunction2DControlPoint::itemChange( GraphicsItemChange change,
newPos.setY( qMin( rect.bottom(), qMax( newPos.y(), rect.top() ) ) );
return newPos;
}
}
}
return QGraphicsItem::itemChange( change, value );
}
......@@ -143,7 +143,34 @@ void WTransferFunction2DControlPoint::mouseMoveEvent( QGraphicsSceneMouseEvent *
void WTransferFunction2DControlPoint::mouseReleaseEvent( QGraphicsSceneMouseEvent *event )
{
m_pressed = false;
switch( m_handleLocation )
{
case TOPRIGHT:
emit( resizeHandleChanged( TOPRIGHT, this->pos() ) );
break;
case BOTTOMRIGHT:
emit( resizeHandleChanged( BOTTOMRIGHT, this->pos() ) );
break;
case BOTTOMLEFT:
emit( resizeHandleChanged( BOTTOMLEFT, this->pos() ) );
break;
case TOPLEFT:
emit( resizeHandleChanged( TOPLEFT, this->pos() ) );
break;
case LEFT_TRI:
emit( resizeHandleChanged( LEFT_TRI, this->pos() ) );
break;
case MID_TRI:
emit( resizeHandleChanged( MID_TRI, this->pos() ) );
break;
case RIGHT_TRI:
emit( resizeHandleChanged( RIGHT_TRI, this->pos() ) );
break;
default:
break;
}
update();
m_parent->update();
BaseClass::mouseReleaseEvent( event );
}
......
......@@ -108,6 +108,7 @@ QVariant WTransferFunction2DTriangleWidget::itemChange( GraphicsItemChange chang
newPos.setX( qMin( rect.right(), qMax( newPos.x(), rect.left() ) ) );
newPos.setY( qMin( rect.bottom(), qMax( newPos.y(), rect.top() ) ) );
QPointF translationVector = QPointF( newPos.x() - this->pos().x(), newPos.y() - this->pos().y() );
//TODO(T.Neeb): Make Function of code below
m_triangle.setLeft( QPointF( m_triangle.left() + translationVector ) );
m_triangle.setMid( QPointF( m_triangle.mid() + translationVector ) );
m_triangle.setRight( QPointF( m_triangle.right() + translationVector ) );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment