MCPcopy Create free account
hub / github.com/BobbyAnguelov/Esoterica / StartDraggingNode

Method StartDraggingNode

Code/EngineTools/NodeGraph/NodeGraph_View.cpp:1749–1794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1747 {
1748 if ( selectionWindowRect.Overlaps( nodeWindowRect ) )
1749 {
1750 newSelection.emplace_back( nodeInstance.Get() );
1751 }
1752 }
1753 }
1754
1755 UpdateSelection( eastl::move( newSelection ) );
1756 m_dragState.Reset();
1757 }
1758
1759 //-------------------------------------------------------------------------
1760
1761 void GraphView::StartDraggingNode( DrawContext const& ctx )
1762 {
1763 EE_ASSERT( !m_isReadOnly );
1764 EE_ASSERT( m_dragState.m_mode == DragMode::None );
1765 EE_ASSERT( m_dragState.m_pNode != nullptr );
1766
1767 m_dragState.m_mode = DragMode::Node;
1768 m_dragState.m_startValue = m_dragState.m_pNode->GetPosition();
1769
1770 //-------------------------------------------------------------------------
1771
1772 auto ProcessCommentNode = [this] ( CommentNode* pCommentNode )
1773 {
1774 ImRect const& unscaledCommentRect = pCommentNode->GetRect();
1775 for ( TTypeInstance<BaseNode>& nodeInstance : m_pGraph->m_nodes )
1776 {
1777 if ( unscaledCommentRect.Contains( nodeInstance->GetRect() ) )
1778 {
1779 VectorEmplaceBackUnique( m_dragState.m_draggedNodes, nodeInstance.Get() );
1780 }
1781 }
1782 };
1783
1784 // Create the dragged set of nodes
1785 for ( auto const& selectedNode : m_selectedNodes )
1786 {
1787 VectorEmplaceBackUnique( m_dragState.m_draggedNodes, selectedNode.m_pNode );
1788
1789 // Add all enclosed nodes to the dragged set
1790 if ( auto pCommentNode = TryCast<CommentNode>( m_dragState.m_draggedNodes.back() ) )
1791 {
1792 ProcessCommentNode( pCommentNode );
1793 }
1794 }
1795
1796 // Add any child comments nodes as well
1797 for ( int32_t i = 0; i < m_dragState.m_draggedNodes.size(); i++ )

Callers

nothing calls this directly

Calls 8

VectorEmplaceBackUniqueFunction · 0.85
GetViewedGraphFunction · 0.85
GetRectMethod · 0.80
ContainsMethod · 0.45
GetMethod · 0.45
backMethod · 0.45
sizeMethod · 0.45
BeginModificationMethod · 0.45

Tested by

no test coverage detected