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 )
|
int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
const SELECTION& selection = m_selectionTool->GetSelection();
|
const SELECTION& selection = m_selectionTool->GetSelection();
|
||||||
|
@ -251,16 +269,11 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !modified )
|
||||||
|
updateEditedPoint( *evt );
|
||||||
|
|
||||||
if( evt->IsMotion() )
|
if( evt->IsAction( &COMMON_ACTIONS::pointEditorAddCorner ) )
|
||||||
{
|
|
||||||
EDIT_POINT* point = m_editPoints->FindPoint( evt->Position() );
|
|
||||||
|
|
||||||
if( m_editedPoint != point )
|
|
||||||
setEditedPoint( point );
|
|
||||||
}
|
|
||||||
|
|
||||||
else if( evt->IsAction( &COMMON_ACTIONS::pointEditorAddCorner ) )
|
|
||||||
{
|
{
|
||||||
addCorner( controls->GetCursorPosition() );
|
addCorner( controls->GetCursorPosition() );
|
||||||
updatePoints();
|
updatePoints();
|
||||||
|
|
|
@ -86,6 +86,9 @@ private:
|
||||||
///> Updates edit points with item's points.
|
///> Updates edit points with item's points.
|
||||||
void updatePoints();
|
void updatePoints();
|
||||||
|
|
||||||
|
///> Updates which point is being edited.
|
||||||
|
void updateEditedPoint( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
///> Sets the current point being edited. NULL means none.
|
///> Sets the current point being edited. NULL means none.
|
||||||
void setEditedPoint( EDIT_POINT* aPoint );
|
void setEditedPoint( EDIT_POINT* aPoint );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue