Fix unexpected tab bar scrolling while clicking on a tab.

This commit is contained in:
Martín Lucas Golini
2024-12-11 15:23:20 -03:00
parent 88f38c313a
commit 43a6f34eaf
3 changed files with 19 additions and 14 deletions

View File

@@ -34,11 +34,11 @@ class EE_API UISlider : public UIWidget {
const Float& getValue() const;
virtual void setMinValue( const Float& MinVal );
virtual void setMinValue( const Float& minVal );
const Float& getMinValue() const;
virtual void setMaxValue( const Float& MaxVal );
virtual void setMaxValue( const Float& maxVal );
const Float& getMaxValue() const;

View File

@@ -369,26 +369,30 @@ const Float& UISlider::getValue() const {
return mValue;
}
void UISlider::setMinValue( const Float& MinVal ) {
mMinValue = MinVal;
void UISlider::setMinValue( const Float& minVal ) {
if ( minVal != mMinValue ) {
mMinValue = minVal;
if ( mValue < mMinValue )
mValue = mMinValue;
if ( mValue < mMinValue )
mValue = mMinValue;
fixSliderPos();
fixSliderPos();
}
}
const Float& UISlider::getMinValue() const {
return mMinValue;
}
void UISlider::setMaxValue( const Float& MaxVal ) {
mMaxValue = MaxVal;
void UISlider::setMaxValue( const Float& maxVal ) {
if ( maxVal != mMaxValue ) {
mMaxValue = maxVal;
if ( mValue > mMaxValue )
mValue = mMaxValue;
if ( mValue > mMaxValue )
mValue = mMaxValue;
fixSliderPos();
fixSliderPos();
}
}
const Float& UISlider::getMaxValue() const {

View File

@@ -244,9 +244,9 @@ void App::updateEditorTabTitle( UICodeEditor* editor ) {
if ( editor->getData() ) {
UITab* tab = (UITab*)editor->getData();
auto doc = editor->getDocumentRef();
tab->setText( doc->getFilename() );
std::string fileName( doc->getFilename() );
if ( tab->getText() != doc->getDefaultFileName() && !isUniqueTabTitle( tab ) ) {
if ( fileName != doc->getDefaultFileName() && !isUniqueTabTitle( tab ) ) {
auto tabsTitles = getUniqueNameForTabs( getTabWithSameTitle( tab ) );
for ( auto [ntab, title] : tabsTitles ) {
ntab->setText( title );
@@ -255,6 +255,7 @@ void App::updateEditorTabTitle( UICodeEditor* editor ) {
}
} else if ( tab->getOwnedWidget()->isType( UI_TYPE_CODEEDITOR ) ) {
tab->getOwnedWidget()->asType<UICodeEditor>()->removeClass( NOT_UNIQUE_FILENAME );
tab->setText( fileName );
}
bool dirty = doc->isDirty();