| 1330 | } |
| 1331 | |
| 1332 | TextPosition UICodeEditor::resolveScreenPosition( const Vector2f& position, bool clamp ) const { |
| 1333 | Vector2f localPos( convertToNodeSpace( position ) ); |
| 1334 | localPos += mScroll; |
| 1335 | localPos.x -= mPaddingPx.Left + getGutterWidth(); |
| 1336 | localPos.y -= mPaddingPx.Top; |
| 1337 | localPos.y -= getPluginsTopSpace(); |
| 1338 | auto visibleLineIndex = static_cast<VisibleIndex>( eefloor( localPos.y / getLineHeight() ) ); |
| 1339 | if ( clamp ) { |
| 1340 | visibleLineIndex = |
| 1341 | eeclamp<VisibleIndex>( visibleLineIndex, (VisibleIndex)0, |
| 1342 | static_cast<VisibleIndex>( getTotalVisibleLines() - 1 ) ); |
| 1343 | } |
| 1344 | return TextPosition( mDocView.getVisibleIndexPosition( visibleLineIndex ).line(), |
| 1345 | getColFromXOffset( visibleLineIndex, localPos.x ) ); |
| 1346 | } |
| 1347 | |
| 1348 | Rectf UICodeEditor::getVisibleScrollArea() const { |
| 1349 | return { mScroll, getViewportDimensions() }; |
no test coverage detected