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

Method onMouseMove

src/tools/ecode/plugins/debugger/debuggerplugin.cpp:2501–2558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2499}
2500
2501bool DebuggerPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& position, const Uint32& ) {
2502 if ( !mDebugger || !mListener || !mDebugger->isServerConnected() ||
2503 mDebuggingState != StatusDebuggerController::State::Paused ) {
2504 return false;
2505 }
2506
2507 auto localPos( editor->convertToNodeSpace( position.asFloat() ) );
2508 if ( localPos.x <= editor->getGutterWidth() )
2509 return false;
2510
2511 if ( editor->getTooltip() )
2512 editor->getTooltip()->hide();
2513
2514 editor->debounce(
2515 [this, editor, position]() {
2516 if ( !mManager->getSplitter()->editorExists( editor ) )
2517 return;
2518 auto docPos = editor->resolveScreenPosition( position.asFloat() );
2519 auto range = editor->getDocument().getWordRangeInPosition( docPos, true );
2520 auto expression = editor->getDocument().getWordInPosition( docPos, true ).toUtf8();
2521
2522 if ( !range.isValid() || expression.empty() ||
2523 LuaPattern::hasMatches( expression, "^[%p%s]+$" ) )
2524 return;
2525
2526 if ( !mDebugger )
2527 return;
2528
2529 mCurrentHover = range;
2530
2531 mDebugger->evaluate(
2532 expression, "hover", mListener->getCurrentFrameId(),
2533 [this, editor, expression]( const std::string&,
2534 const std::optional<EvaluateInfo>& info ) {
2535 if ( info && mManager->getSplitter()->editorExists( editor ) &&
2536 !info->result.empty() ) {
2537 editor->runOnMainThread(
2538 [this, editor, info = std::move( *info ), expression]() {
2539 auto mousePos = editor->getInput()->getMousePos();
2540 if ( !editor->getScreenRect().contains( mousePos.asFloat() ) )
2541 return;
2542
2543 auto docPos = editor->resolveScreenPosition( mousePos.asFloat() );
2544 auto range =
2545 editor->getDocument().getWordRangeInPosition( docPos, true );
2546
2547 if ( mCurrentHover.contains( range ) ) {
2548 mCurrentHover = range;
2549 displayTooltip( editor, expression, info, mousePos.asFloat() );
2550 }
2551 } );
2552 }
2553 } );
2554 },
2555 mHoverDelay, getMouseMoveHash( editor ) );
2556 editor->updateMouseCursor( position.asFloat() );
2557 return false;
2558}

Callers

nothing calls this directly

Calls 15

isServerConnectedMethod · 0.80
convertToNodeSpaceMethod · 0.80
getGutterWidthMethod · 0.80
getTooltipMethod · 0.80
debounceMethod · 0.80
resolveScreenPositionMethod · 0.80
getDocumentMethod · 0.80
toUtf8Method · 0.80
getWordInPositionMethod · 0.80
evaluateMethod · 0.80
getCurrentFrameIdMethod · 0.80

Tested by

no test coverage detected