合并后提交
This commit is contained in:
parent
617cac6d8a
commit
b7b2834564
|
@ -8,6 +8,7 @@
|
||||||
#include "base/HGInc.h"
|
#include "base/HGInc.h"
|
||||||
#include "imgfmt/HGImgFmt.h"
|
#include "imgfmt/HGImgFmt.h"
|
||||||
#include "HGUIGlobal.h"
|
#include "HGUIGlobal.h"
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
HGImgView::HGImgView(QWidget* parent)
|
HGImgView::HGImgView(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
@ -997,6 +998,21 @@ HGResult HGImgView::zoomIn(const HGPoint *pCenter)
|
||||||
float fNewWidth = fCurWidth * 1.2f;
|
float fNewWidth = fCurWidth * 1.2f;
|
||||||
float fNewHeight = fCurHeight * 1.2f;
|
float fNewHeight = fCurHeight * 1.2f;
|
||||||
|
|
||||||
|
// support 1% zoom-in when 'ctrl' pressed (added on 2022-05-24)
|
||||||
|
if(QApplication::queryKeyboardModifiers() == Qt::CTRL)
|
||||||
|
{
|
||||||
|
// 1%
|
||||||
|
fNewWidth = info.width * .01f;
|
||||||
|
if(fNewWidth < 1.0f)
|
||||||
|
fNewWidth = 1.0f;
|
||||||
|
fNewWidth += fCurWidth;
|
||||||
|
|
||||||
|
fNewHeight = info.height * .01f;
|
||||||
|
if(fNewHeight < 1.0f)
|
||||||
|
fNewHeight = 1.0f;
|
||||||
|
fNewHeight += fCurHeight;
|
||||||
|
}
|
||||||
|
|
||||||
if (fabs(fMaxWidth - fCurWidth) > 1e-3 || fabs(fMaxHeight - fCurHeight) > 1e-3)
|
if (fabs(fMaxWidth - fCurWidth) > 1e-3 || fabs(fMaxHeight - fCurHeight) > 1e-3)
|
||||||
{
|
{
|
||||||
if (fNewWidth - fMaxWidth > -1e-3 || fNewHeight - fMaxHeight > -1e-3
|
if (fNewWidth - fMaxWidth > -1e-3 || fNewHeight - fMaxHeight > -1e-3
|
||||||
|
@ -1063,6 +1079,21 @@ HGResult HGImgView::zoomOut(const HGPoint *pCenter)
|
||||||
float fNewWidth = fCurWidth * 1.0f / 1.2f;
|
float fNewWidth = fCurWidth * 1.0f / 1.2f;
|
||||||
float fNewHeight = fCurHeight * 1.0f / 1.2f;
|
float fNewHeight = fCurHeight * 1.0f / 1.2f;
|
||||||
|
|
||||||
|
// support 1% zoom-out when 'ctrl' pressed (added on 2022-05-24)
|
||||||
|
if(QApplication::queryKeyboardModifiers() == Qt::CTRL)
|
||||||
|
{
|
||||||
|
// 1%
|
||||||
|
fNewWidth = info.width * .01f;
|
||||||
|
if(fNewWidth < 1.0f)
|
||||||
|
fNewWidth = 1.0f;
|
||||||
|
fNewWidth = fCurWidth - fNewWidth;
|
||||||
|
|
||||||
|
fNewHeight = info.height * .01f;
|
||||||
|
if(fNewHeight < 1.0f)
|
||||||
|
fNewHeight = 1.0f;
|
||||||
|
fNewHeight = fCurHeight - fNewHeight;
|
||||||
|
}
|
||||||
|
|
||||||
if (fabs(fMinWidth - fCurWidth) > 1e-3 || fabs(fMinHeight - fCurHeight) > 1e-3)
|
if (fabs(fMinWidth - fCurWidth) > 1e-3 || fabs(fMinHeight - fCurHeight) > 1e-3)
|
||||||
{
|
{
|
||||||
if (fNewWidth - fMinWidth < 1e-3 || fNewHeight - fMinHeight < 1e-3
|
if (fNewWidth - fMinWidth < 1e-3 || fNewHeight - fMinHeight < 1e-3
|
||||||
|
|
Loading…
Reference in New Issue