mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-31 17:17:50 -05:00
#14459 Sort Z-scale factors and step through custom values with shortcuts
Introduce RiaZScaleTools as a single source for the Z-scale factor list, merging the predefined factors with custom values entered during the session. The toolbar combo box, the property editor combo box and the Ctrl+Shift+Up/Down shortcuts all use this shared sorted list. The toolbar combo box previously appended custom values at the end, producing an unsorted, ever-growing list, and the shortcuts stepped through the predefined factors only, skipping custom values visible in the list.
This commit is contained in:
1 parent
45a212d6c3
commit
15323a46cb
8 files changed
+259
-21
No files matched your search
@@ -19,14 +19,12 @@
|
||||
#include "RicZScaleFeatures.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaZScaleTools.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicIncreaseZScaleFeature, "RicIncreaseZScaleFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicDecreaseZScaleFeature, "RicDecreaseZScaleFeature" );
|
||||
|
||||
@@ -56,12 +54,8 @@ void RicIncreaseZScaleFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
if ( Rim3dView* view = activeViewWithEditableZScale() )
|
||||
{
|
||||
auto scaleOptions = RiaDefines::viewScaleOptions();
|
||||
auto it = std::upper_bound( scaleOptions.begin(), scaleOptions.end(), view->scaleZ() );
|
||||
if ( it != scaleOptions.end() )
|
||||
{
|
||||
view->setScaleZAndUpdate( *it );
|
||||
}
|
||||
double nextScale = RiaZScaleTools::nextScaleFactor( view->scaleZ(), RiaZScaleTools::scaleFactorOptions() );
|
||||
view->setScaleZAndUpdate( nextScale );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,12 +85,8 @@ void RicDecreaseZScaleFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
if ( Rim3dView* view = activeViewWithEditableZScale() )
|
||||
{
|
||||
auto scaleOptions = RiaDefines::viewScaleOptions();
|
||||
auto it = std::lower_bound( scaleOptions.begin(), scaleOptions.end(), view->scaleZ() );
|
||||
if ( it != scaleOptions.begin() )
|
||||
{
|
||||
view->setScaleZAndUpdate( *( it - 1 ) );
|
||||
}
|
||||
double previousScale = RiaZScaleTools::previousScaleFactor( view->scaleZ(), RiaZScaleTools::scaleFactorOptions() );
|
||||
view->setScaleZAndUpdate( previousScale );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user