Improved code for handling zone corner dragging (GAL).
This commit is contained in:
parent
666e825e17
commit
a6c94e26f6
|
@ -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();
|
||||
|
@ -252,15 +270,10 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
|||
break;
|
||||
}
|
||||
|
||||
if( evt->IsMotion() )
|
||||
{
|
||||
EDIT_POINT* point = m_editPoints->FindPoint( evt->Position() );
|
||||
if ( !modified )
|
||||
updateEditedPoint( *evt );
|
||||
|
||||
if( m_editedPoint != point )
|
||||
setEditedPoint( point );
|
||||
}
|
||||
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::pointEditorAddCorner ) )
|
||||
if( evt->IsAction( &COMMON_ACTIONS::pointEditorAddCorner ) )
|
||||
{
|
||||
addCorner( controls->GetCursorPosition() );
|
||||
updatePoints();
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue