MCPcopy Create free account
hub / github.com/SpartanJ/eepp / onMouseDown

Method onMouseDown

src/eepp/ui/uicodeeditor.cpp:1549–1633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1547}
1548
1549Uint32 UICodeEditor::onMouseDown( const Vector2i& position, const Uint32& flags ) {
1550 mLastActivity.restart();
1551 for ( auto& plugin : mPlugins )
1552 if ( plugin->onMouseDown( this, position, flags ) )
1553 return UIWidget::onMouseDown( position, flags );
1554
1555 if ( mMinimapEnabled ) {
1556 updateMipmapHover( position.asFloat() );
1557
1558 Rectf rect( getMinimapRect( getScreenStart() ) );
1559 if ( ( flags & EE_BUTTON_LMASK ) && !getEventDispatcher()->isNodeDragging() &&
1560 getEventDispatcher()->getMouseDownNode() == this && !mMinimapDragging &&
1561 rect.contains( position.asFloat() ) ) {
1562 if ( mMouseDown )
1563 return 1;
1564 if ( !mMinimapHover && !mMouseDown ) {
1565 mMinimapScrollOffset = 0;
1566 scrollToVisibleIndex( calculateMinimapClickedLine( position ), false, true );
1567 } else {
1568 mMinimapScrollOffset = calculateMinimapClickedLine( position ) -
1569 static_cast<Int64>( getVisibleLineRange().first );
1570 }
1571 mMouseDown = true;
1572 mMouseDownMinimap = true;
1573 mMinimapDragging = true;
1574 getEventDispatcher()->setNodeDragging( this );
1575 mVScrollBar->setEnabled( false );
1576 getUISceneNode()->setCursor( Cursor::Arrow );
1577 return 1;
1578 } else if ( mMinimapDragging ) {
1579 if ( ( flags & EE_BUTTON_LMASK ) && mMouseDown &&
1580 rect.contains( position.asFloat() ) ) {
1581 scrollToVisibleIndex(
1582 calculateMinimapClickedLine( position ) - mMinimapScrollOffset, false, true );
1583 getUISceneNode()->setCursor( Cursor::Arrow );
1584 }
1585 return 1;
1586 }
1587 }
1588
1589 MouseBindings::Shortcut shortcut{ MouseAction::Down, flags,
1590 getInput()->getSanitizedModState() };
1591
1592 if ( ( flags & ( EE_BUTTON_LMASK | EE_BUTTON_RMASK ) ) && isTextSelectionEnabled() &&
1593 !getEventDispatcher()->isNodeDragging() && NULL != mFont && !mMouseDown &&
1594 getEventDispatcher()->getMouseDownNode() == this ) {
1595 mMouseDown = true;
1596 Input* input = getInput();
1597 input->captureMouse( true );
1598 setFocus();
1599
1600 auto textScreenPos( resolveScreenPosition( position.asFloat() ) );
1601 Vector2f localPos( convertToNodeSpace( position.asFloat() ) );
1602 if ( localPos.y < mPluginsTopSpace )
1603 return UIWidget::onMouseDown( position, flags );
1604
1605 bool downOverGutter = localPos.x < mPaddingPx.Left + getGutterWidth();
1606

Callers

nothing calls this directly

Calls 15

MillisecondsFunction · 0.85
isNodeDraggingMethod · 0.80
getMouseDownNodeMethod · 0.80
setNodeDraggingMethod · 0.80
getSanitizedModStateMethod · 0.80
captureMouseMethod · 0.80
isModStateMethod · 0.80
selectToMethod · 0.80
getElapsedTimeMethod · 0.80
selectLineMethod · 0.80
restartMethod · 0.45
asFloatMethod · 0.45

Tested by

no test coverage detected