KiCad PCB EDA Suite
Loading...
Searching...
No Matches
HOVER_PICKER Class Reference

The board item under the pointer, and the highlight that follows it. More...

#include <hover_picker.h>

Public Types

using ACCEPTS = std::function<bool( BOARD_ITEM& aItem )>
 Everything it sees is already selectable.
 
using PROXIMITY = std::function<double( const BOARD_ITEM& aItem, const VECTOR2I& aPointer )>
 Optional tie-break among what the selection heuristics left. Nearest wins.
 

Public Member Functions

 HOVER_PICKER (TOOL_MANAGER *aToolMgr)
 
 ~HOVER_PICKER ()
 Puts back whatever is still lit, so an early exit cannot strand a highlight.
 
BOARD_ITEMPick (const VECTOR2I &aPointer, const ACCEPTS &aAccepts, const PROXIMITY &aProximity=nullptr) const
 The item a click would take, or null.
 
void Brighten (BOARD_ITEM *aItem)
 
void BrightenOnly (const std::vector< BOARD_ITEM * > &aItems)
 Light exactly these, leaving what is already lit alone.
 
void ClearBrightening ()
 Items go back by id, so a commit that replaced one still puts the original back.
 

Private Attributes

TOOL_MANAGERm_toolMgr
 
PCB_SELECTION_TOOLm_selectionTool
 
std::vector< KIIDm_brightened
 

Detailed Description

The board item under the pointer, and the highlight that follows it.

Definition at line 34 of file hover_picker.h.

Member Typedef Documentation

◆ ACCEPTS

using HOVER_PICKER::ACCEPTS = std::function<bool( BOARD_ITEM& aItem )>

Everything it sees is already selectable.

Definition at line 38 of file hover_picker.h.

◆ PROXIMITY

using HOVER_PICKER::PROXIMITY = std::function<double( const BOARD_ITEM& aItem, const VECTOR2I& aPointer )>

Optional tie-break among what the selection heuristics left. Nearest wins.

Definition at line 41 of file hover_picker.h.

Constructor & Destructor Documentation

◆ HOVER_PICKER()

HOVER_PICKER::HOVER_PICKER ( TOOL_MANAGER * aToolMgr)
explicit

Definition at line 32 of file hover_picker.cpp.

References m_selectionTool, and m_toolMgr.

◆ ~HOVER_PICKER()

HOVER_PICKER::~HOVER_PICKER ( )

Puts back whatever is still lit, so an early exit cannot strand a highlight.

Definition at line 39 of file hover_picker.cpp.

References ClearBrightening().

Member Function Documentation

◆ Brighten()

void HOVER_PICKER::Brighten ( BOARD_ITEM * aItem)

Definition at line 83 of file hover_picker.cpp.

References m_brightened, m_selectionTool, and EDA_ITEM::m_Uuid.

◆ BrightenOnly()

void HOVER_PICKER::BrightenOnly ( const std::vector< BOARD_ITEM * > & aItems)

Light exactly these, leaving what is already lit alone.

A preview recomputes its whole set on every motion, and clearing it first would redraw items that did not change.

Definition at line 90 of file hover_picker.cpp.

References m_brightened, m_selectionTool, m_toolMgr, and BOARD::ResolveItem().

Referenced by GRAPHIC_EDIT_TOOL::runInteractive().

◆ ClearBrightening()

void HOVER_PICKER::ClearBrightening ( )

Items go back by id, so a commit that replaced one still puts the original back.

Definition at line 120 of file hover_picker.cpp.

References m_brightened, m_selectionTool, m_toolMgr, and BOARD::ResolveItem().

Referenced by GRAPHIC_EDIT_TOOL::runInteractive(), and ~HOVER_PICKER().

◆ Pick()

BOARD_ITEM * HOVER_PICKER::Pick ( const VECTOR2I & aPointer,
const ACCEPTS & aAccepts,
const PROXIMITY & aProximity = nullptr ) const

The item a click would take, or null.

CollectPoint() decides, so the layer and size preferences and the Selection Filter all apply. Highlights nothing by itself.

Definition at line 45 of file hover_picker.cpp.

References COLLECTOR::GetCount(), m_selectionTool, and COLLECTOR::Remove().

Referenced by GRAPHIC_EDIT_TOOL::runInteractive().

Member Data Documentation

◆ m_brightened

std::vector<KIID> HOVER_PICKER::m_brightened
private

Definition at line 65 of file hover_picker.h.

Referenced by Brighten(), BrightenOnly(), and ClearBrightening().

◆ m_selectionTool

PCB_SELECTION_TOOL* HOVER_PICKER::m_selectionTool
private

Definition at line 64 of file hover_picker.h.

Referenced by Brighten(), BrightenOnly(), ClearBrightening(), HOVER_PICKER(), and Pick().

◆ m_toolMgr

TOOL_MANAGER* HOVER_PICKER::m_toolMgr
private

Definition at line 63 of file hover_picker.h.

Referenced by BrightenOnly(), ClearBrightening(), and HOVER_PICKER().


The documentation for this class was generated from the following files: