mirror of
https://github.com/MaurycyLiebner/enve.git
synced 2024-12-20 07:32:08 +00:00
Compare commits
No commits in common. "ab466faa5b2ebca529c4fb33277c3700efe8f980" and "a55a5470b5d09892fb2d52fd4bae1b0fbb102b1e" have entirely different histories.
ab466faa5b
...
a55a5470b5
@ -155,8 +155,6 @@ public:
|
||||
|
||||
void fitCanvasToSize();
|
||||
void resetTransormation();
|
||||
void zoomInView();
|
||||
void zoomOutView();
|
||||
};
|
||||
|
||||
#endif // CANVASWINDOW_H
|
||||
|
@ -70,22 +70,6 @@ void CanvasWindow::fitCanvasToSize() {
|
||||
mViewTransform.scale(minScale, minScale);
|
||||
}
|
||||
|
||||
void CanvasWindow::zoomInView() {
|
||||
if(!mCurrentCanvas) return;
|
||||
const auto canvasSize = mCurrentCanvas->getCanvasSize();
|
||||
mViewTransform.translate(canvasSize.width()*0.5, canvasSize.height()*0.5);
|
||||
mViewTransform.scale(1.1, 1.1);
|
||||
mViewTransform.translate(-canvasSize.width()*0.5, -canvasSize.height()*0.5);
|
||||
}
|
||||
|
||||
void CanvasWindow::zoomOutView() {
|
||||
if(!mCurrentCanvas) return;
|
||||
const auto canvasSize = mCurrentCanvas->getCanvasSize();
|
||||
mViewTransform.translate(canvasSize.width()*0.5, canvasSize.height()*0.5);
|
||||
mViewTransform.scale(0.9, 0.9);
|
||||
mViewTransform.translate(-canvasSize.width()*0.5, -canvasSize.height()*0.5);
|
||||
}
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
bool CanvasWindow::event(QEvent *e) {
|
||||
|
@ -606,53 +606,6 @@ void MainWindow::setupMenuBar() {
|
||||
|
||||
mViewMenu = mMenuBar->addMenu(tr("View", "MenuBar"));
|
||||
|
||||
const auto ViewTransformMenu = mViewMenu->addMenu(
|
||||
tr("Views","MenuBar_View"));
|
||||
|
||||
mZoomInMenu = ViewTransformMenu->addAction(
|
||||
tr("Zoom In", "MenuBar_Views"));
|
||||
mZoomInMenu->setShortcut(Qt::Key_Plus);
|
||||
connect(mZoomInMenu, &QAction::triggered,
|
||||
this, [](){
|
||||
const auto target = KeyFocusTarget::KFT_getCurrentTarget();
|
||||
const auto cwTarget = dynamic_cast<CanvasWindow*>(target);
|
||||
if (!cwTarget) return;
|
||||
cwTarget->zoomInView();
|
||||
});
|
||||
|
||||
mZoomOutMenu = ViewTransformMenu->addAction(
|
||||
tr("Zoom Out", "MenuBar_Views"));
|
||||
mZoomOutMenu->setShortcut(Qt::Key_Minus);
|
||||
connect(mZoomOutMenu, &QAction::triggered,
|
||||
this, [](){
|
||||
const auto target = KeyFocusTarget::KFT_getCurrentTarget();
|
||||
const auto cwTarget = dynamic_cast<CanvasWindow*>(target);
|
||||
if (!cwTarget) return;
|
||||
cwTarget->zoomOutView();
|
||||
});
|
||||
|
||||
mFitViewMenu = ViewTransformMenu->addAction(
|
||||
tr("Fit to Canvas", "MenuBar_Views"));
|
||||
mFitViewMenu->setShortcut(Qt::Key_0);
|
||||
connect(mFitViewMenu, &QAction::triggered,
|
||||
this, [](){
|
||||
const auto target = KeyFocusTarget::KFT_getCurrentTarget();
|
||||
const auto cwTarget = dynamic_cast<CanvasWindow*>(target);
|
||||
if (!cwTarget) return;
|
||||
cwTarget->fitCanvasToSize();
|
||||
});
|
||||
|
||||
mResetZoomMenu = ViewTransformMenu->addAction(
|
||||
tr("Reset Zoom", "MenuBar_Views"));
|
||||
mResetZoomMenu->setShortcut(Qt::Key_1);
|
||||
connect(mResetZoomMenu, &QAction::triggered,
|
||||
this, [](){
|
||||
const auto target = KeyFocusTarget::KFT_getCurrentTarget();
|
||||
const auto cwTarget = dynamic_cast<CanvasWindow*>(target);
|
||||
if (!cwTarget) return;
|
||||
cwTarget->resetTransormation();
|
||||
});
|
||||
|
||||
const auto filteringMenu = mViewMenu->addMenu(
|
||||
tr("Filtering", "MenuBar_View"));
|
||||
|
||||
|
@ -282,11 +282,6 @@ private:
|
||||
//
|
||||
ActionButton *mActionNewEmptyPaintFrame;
|
||||
QAction *mActionNewEmptyPaintFrameAct;
|
||||
//
|
||||
QAction *mResetZoomMenu;
|
||||
QAction *mZoomInMenu;
|
||||
QAction *mZoomOutMenu;
|
||||
QAction *mFitViewMenu;
|
||||
//
|
||||
QAction *mNoneQuality;
|
||||
QAction *mLowQuality;
|
||||
|
Loading…
Reference in New Issue
Block a user