Skip to content

Commit

Permalink
Original Size toggle mode enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpurcell committed Jul 13, 2024
1 parent 2ad29d8 commit 24401fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/qvgraphicsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void QVGraphicsView::postLoad()
if (!loadIsFromSessionRestore)
{
if (navigationResetsZoom && calculatedZoomMode != defaultCalculatedZoomMode)
setCalculatedZoomMode(defaultCalculatedZoomMode);
setCalculatedZoomMode(defaultCalculatedZoomMode, true);
else
fitOrConstrainImage();
}
Expand Down Expand Up @@ -602,7 +602,7 @@ const std::optional<Qv::CalculatedZoomMode> &QVGraphicsView::getCalculatedZoomMo
return calculatedZoomMode;
}

void QVGraphicsView::setCalculatedZoomMode(const std::optional<Qv::CalculatedZoomMode> &value)
void QVGraphicsView::setCalculatedZoomMode(const std::optional<Qv::CalculatedZoomMode> &value, const bool isNavigating)
{
if (calculatedZoomMode == value)
{
Expand All @@ -611,9 +611,9 @@ void QVGraphicsView::setCalculatedZoomMode(const std::optional<Qv::CalculatedZoo
return;
}

if (value == Qv::CalculatedZoomMode::OriginalSize && zoomLevel == 1 && defaultCalculatedZoomMode != Qv::CalculatedZoomMode::OriginalSize && qvApp->getSettingsManager().getBoolean("originalsizeastoggle"))
if (value == Qv::CalculatedZoomMode::OriginalSize && zoomLevel == 1 && !isNavigating && qvApp->getSettingsManager().getBoolean("originalsizeastoggle"))
{
setCalculatedZoomMode(defaultCalculatedZoomMode);
setCalculatedZoomMode(defaultCalculatedZoomMode != Qv::CalculatedZoomMode::OriginalSize ? defaultCalculatedZoomMode : Qv::CalculatedZoomMode::ZoomToFit);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/qvgraphicsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class QVGraphicsView : public QGraphicsView
void zoomAbsolute(const qreal absoluteLevel, const std::optional<QPoint> &mousePos = {}, const bool isApplyingCalculation = false);

const std::optional<Qv::CalculatedZoomMode> &getCalculatedZoomMode() const;
void setCalculatedZoomMode(const std::optional<Qv::CalculatedZoomMode> &value);
void setCalculatedZoomMode(const std::optional<Qv::CalculatedZoomMode> &value, const bool isNavigating = false);

bool getNavigationResetsZoom() const;
void setNavigationResetsZoom(const bool value);
Expand Down

0 comments on commit 24401fa

Please sign in to comment.