diff --git a/src/eepp/scene/eventdispatcher.cpp b/src/eepp/scene/eventdispatcher.cpp index 0f2ea4d90..fd837d30a 100644 --- a/src/eepp/scene/eventdispatcher.cpp +++ b/src/eepp/scene/eventdispatcher.cpp @@ -175,7 +175,7 @@ void EventDispatcher::update( const Time& time ) { sendMsg( mOverNode, NodeMessage::MouseUp, mInput->getReleaseTrigger() ); } - if ( mInput->getClickTrigger() ) { + if ( mInput->getClickTrigger() && mDownNode == mOverNode ) { mLastFocusNode->onMouseClick( mMousePosi, mInput->getClickTrigger() ); sendMsg( mLastFocusNode, NodeMessage::MouseClick, mInput->getClickTrigger() ); diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index 6859edc15..ba9faf6ab 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -1770,7 +1770,6 @@ Float UICodeEditor::getLineWidth( const Int64& docLine ) { } if ( mFont && !mFont->isMonospace() ) { - width += getGlyphWidth(); mLinesWidthCache[docLine] = { line.getHash(), width }; } @@ -1782,7 +1781,7 @@ Float UICodeEditor::getLineWidth( const Int64& docLine ) { auto found = mLinesWidthCache.find( docLine ); if ( found != mLinesWidthCache.end() && line.getHash() == found->second.first ) return found->second.second; - Float width = getTextWidth( line.getText() ) + getGlyphWidth(); + Float width = getTextWidth( line.getText() ); mLinesWidthCache[docLine] = { line.getHash(), width }; return width; } @@ -1815,10 +1814,16 @@ void UICodeEditor::updateScrollBar() { } mVScrollBar->setPixelsPosition( mSize.getWidth() - mVScrollBar->getPixelsSize().getWidth(), 0 ); - mVScrollBar->setPageStep( getViewPortLineCount().y / (float)mDoc->linesCount() ); + mVScrollBar->setPageStep( getViewPortLineCount().y / (float)mDocView.getVisibleLinesCount() ); mVScrollBar->setClickStep( 0.2f ); - mVScrollBar->setEnabled( mVerticalScrollBarEnabled && notVisibleLineCount > 0 ); - mVScrollBar->setVisible( mVerticalScrollBarEnabled && notVisibleLineCount > 0 ); + bool wasVScrollVisible = mVScrollBar->isVisible(); + bool showVScroll = mVerticalScrollBarEnabled && notVisibleLineCount > 0; + mVScrollBar->setEnabled( showVScroll ); + mVScrollBar->setVisible( showVScroll ); + + if ( wasVScrollVisible != showVScroll && mDocView.isWrapEnabled() ) + invalidateLineWrapMaxWidth( false ); + setScrollY( mScroll.y ); } diff --git a/src/tools/ecode/settingsmenu.cpp b/src/tools/ecode/settingsmenu.cpp index 1f56a59fb..c8db46a36 100644 --- a/src/tools/ecode/settingsmenu.cpp +++ b/src/tools/ecode/settingsmenu.cpp @@ -134,7 +134,7 @@ void SettingsMenu::createSettingsMenu( App* app, UIMenuBar* menuBar ) { mSettingsMenu->addSeparator(); mSettingsMenu->add( i18n( "quit", "Quit" ), findIcon( "quit" ), getKeybind( "close-app" ) ) ->setId( "close-app" ); - mSettingsButton = mUISceneNode->find( "settings" ); + mSettingsButton = mUISceneNode->find( "settings" ); mSettingsButton->on( Event::MouseClick, [this]( const Event* ) { toggleSettingsMenu(); } ); mSettingsMenu->on( Event::OnItemClicked, [this]( const Event* event ) { if ( !event->getNode()->isType( UI_TYPE_MENUITEM ) ) diff --git a/src/tools/ecode/settingsmenu.hpp b/src/tools/ecode/settingsmenu.hpp index 5c667c3e0..17f76440d 100644 --- a/src/tools/ecode/settingsmenu.hpp +++ b/src/tools/ecode/settingsmenu.hpp @@ -96,7 +96,7 @@ class SettingsMenu { App* mApp{ nullptr }; UIPopUpMenu* mSettingsMenu{ nullptr }; UIPopUpMenu* mRecentFilesMenu{ nullptr }; - UITextView* mSettingsButton{ nullptr }; + UIWidget* mSettingsButton{ nullptr }; UISceneNode* mUISceneNode{ nullptr }; UICodeEditorSplitter* mSplitter{ nullptr }; UIPopUpMenu* mDocMenu{ nullptr };