Improved code for handling zone corner dragging (GAL).

This commit is contained in:
Henrik Nyberg 2015-08-12 10:15:45 +02:00 committed by Maciej Suminski
parent 666e825e17
commit a6c94e26f6
2 changed files with 25 additions and 9 deletions

View File

@ -219,6 +219,24 @@ bool POINT_EDITOR::Init()
}
void POINT_EDITOR::updateEditedPoint( const TOOL_EVENT& aEvent )
{
EDIT_POINT* point = NULL;
if( aEvent.IsMotion() )
{
point = m_editPoints->FindPoint( aEvent.Position() );
}
else if( aEvent.IsDrag( BUT_LEFT ) )
{
point = m_editPoints->FindPoint( aEvent.DragOrigin() );
}
if( m_editedPoint != point )
setEditedPoint( point );
}
int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
@ -251,16 +269,11 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
{
break;
}
if ( !modified )
updateEditedPoint( *evt );
if( evt->IsMotion() )
{
EDIT_POINT* point = m_editPoints->FindPoint( evt->Position() );
if( m_editedPoint != point )
setEditedPoint( point );
}
else if( evt->IsAction( &COMMON_ACTIONS::pointEditorAddCorner ) )
if( evt->IsAction( &COMMON_ACTIONS::pointEditorAddCorner ) )
{
addCorner( controls->GetCursorPosition() );
updatePoints();

View File

@ -86,6 +86,9 @@ private:
///> Updates edit points with item's points.
void updatePoints();
///> Updates which point is being edited.
void updateEditedPoint( const TOOL_EVENT& aEvent );
///> Sets the current point being edited. NULL means none.
void setEditedPoint( EDIT_POINT* aPoint );