Use CTRL modifier to deselect items
This commit is contained in:
parent
8b49c6e5ed
commit
b53ba56ac2
|
@ -30,8 +30,8 @@
|
||||||
using namespace KIGFX::PREVIEW;
|
using namespace KIGFX::PREVIEW;
|
||||||
|
|
||||||
// Selection area colours
|
// Selection area colours
|
||||||
const COLOR4D SELECT_COLOR_L2R( 0.3, 0.3, 0.5, 0.3 ); // Slight blue
|
const COLOR4D SELECT_COLOR_L2R( 0.3, 0.3, 0.6, 0.3 ); // Slight blue
|
||||||
const COLOR4D SELECT_COLOR_R2L( 0.3, 0.5, 0.3, 0.3 ); // Slight green
|
const COLOR4D SELECT_COLOR_R2L( 0.3, 0.6, 0.3, 0.3 ); // Slight green
|
||||||
|
|
||||||
|
|
||||||
SELECTION_AREA::SELECTION_AREA()
|
SELECTION_AREA::SELECTION_AREA()
|
||||||
|
|
|
@ -230,6 +230,10 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// become the new selection (discarding previously selected items)
|
// become the new selection (discarding previously selected items)
|
||||||
m_additive = evt->Modifier( MD_SHIFT );
|
m_additive = evt->Modifier( MD_SHIFT );
|
||||||
|
|
||||||
|
// Should selected items be REMOVED from the current selection?
|
||||||
|
// This will be ignored if the SHIFT modifier is pressed
|
||||||
|
m_subtractive = !m_additive && evt->Modifier( MD_CTRL );
|
||||||
|
|
||||||
// single click? Select single object
|
// single click? Select single object
|
||||||
if( evt->IsClick( BUT_LEFT ) )
|
if( evt->IsClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
|
@ -269,7 +273,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
|
// drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
|
||||||
else if( evt->IsDrag( BUT_LEFT ) )
|
else if( evt->IsDrag( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
if( m_additive )
|
if( m_additive || m_subtractive )
|
||||||
{
|
{
|
||||||
selectMultiple();
|
selectMultiple();
|
||||||
}
|
}
|
||||||
|
@ -483,8 +487,10 @@ bool SELECTION_TOOL::selectMultiple()
|
||||||
|
|
||||||
if( evt->IsDrag( BUT_LEFT ) )
|
if( evt->IsDrag( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
if( !m_additive )
|
if( !m_additive && !m_subtractive )
|
||||||
|
{
|
||||||
clearSelection();
|
clearSelection();
|
||||||
|
}
|
||||||
|
|
||||||
// Start drawing a selection box
|
// Start drawing a selection box
|
||||||
area.SetOrigin( evt->DragOrigin() );
|
area.SetOrigin( evt->DragOrigin() );
|
||||||
|
@ -529,14 +535,20 @@ bool SELECTION_TOOL::selectMultiple()
|
||||||
{
|
{
|
||||||
if( selectionBox.Contains( item->ViewBBox() ) )
|
if( selectionBox.Contains( item->ViewBBox() ) )
|
||||||
{
|
{
|
||||||
select( item );
|
if( m_subtractive )
|
||||||
|
unselect( item );
|
||||||
|
else
|
||||||
|
select( item );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( item->HitTest( selectionRect, false ) )
|
if( item->HitTest( selectionRect, false ) )
|
||||||
{
|
{
|
||||||
select( item );
|
if( m_subtractive )
|
||||||
|
unselect( item );
|
||||||
|
else
|
||||||
|
select( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,6 +323,9 @@ private:
|
||||||
/// Flag saying if items should be added to the current selection or rather replace it.
|
/// Flag saying if items should be added to the current selection or rather replace it.
|
||||||
bool m_additive;
|
bool m_additive;
|
||||||
|
|
||||||
|
/// Flag saying if items should be removed from the current selection
|
||||||
|
bool m_subtractive;
|
||||||
|
|
||||||
/// Flag saying if multiple selection mode is active.
|
/// Flag saying if multiple selection mode is active.
|
||||||
bool m_multiple;
|
bool m_multiple;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue