Compare commits
2
Commits
f55f8c731d
...
e01718928c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e01718928c | ||
|
|
f5dbf44ec7 |
@@ -74,7 +74,7 @@ void ActionManager::setupAction(MainWindow *mainWindow)
|
|||||||
CREATE_NEW_ICON_ACTION(mainWindow, actionRotateCounterClockwise, app-icon);
|
CREATE_NEW_ICON_ACTION(mainWindow, actionRotateCounterClockwise, app-icon);
|
||||||
|
|
||||||
CREATE_NEW_ACTION(mainWindow, actionToggleAvoidResetTransform);
|
CREATE_NEW_ACTION(mainWindow, actionToggleAvoidResetTransform);
|
||||||
CREATE_NEW_ICON_ACTION(mainWindow, actionToggleCheckerboard, view-background-checkerboard);
|
CREATE_NEW_ACTION(mainWindow, actionToggleCheckerboard);
|
||||||
CREATE_NEW_ACTION(mainWindow, actionTogglePauseAnimation);
|
CREATE_NEW_ACTION(mainWindow, actionTogglePauseAnimation);
|
||||||
CREATE_NEW_ACTION(mainWindow, actionAnimationNextFrame);
|
CREATE_NEW_ACTION(mainWindow, actionAnimationNextFrame);
|
||||||
|
|
||||||
|
|||||||
+12
-1
@@ -224,7 +224,18 @@ void GraphicsView::fitByOrientation(Qt::Orientation ori, bool scaleDownOnly)
|
|||||||
QRectF originalScene = sceneRect();
|
QRectF originalScene = sceneRect();
|
||||||
QTransform currentTransform = transform();
|
QTransform currentTransform = transform();
|
||||||
|
|
||||||
// TODO: May be optimized by matrix arithmetic operation?
|
// TODO:
|
||||||
|
// I guess following code may be optimized by matrix arithmetic operation.
|
||||||
|
// There is an AI given solution. But I didn't use it.
|
||||||
|
// Because I want to keep the same behavior of upstream.
|
||||||
|
|
||||||
|
// // Horizontal fit: Let the position of top center of viewport, (cx, 0), be inversely mapped to scene.
|
||||||
|
// // And compensate the behavior of `centerOn` which put given point to the center of viewport.
|
||||||
|
// QTransform inv = currentTransform.inverted();
|
||||||
|
// QPointF viewCx = viewport()->rect().center().x();
|
||||||
|
// QPointF viewCy = viewport()->rect().center().y();
|
||||||
|
// // The target is viewport top center. Its y=0, so `centerOn` required scene point is (viewCx, -viewCy).
|
||||||
|
// centerOn(inv.map(QPointF(viewCx, -viewCy)));
|
||||||
|
|
||||||
if (ori == Qt::Horizontal) {
|
if (ori == Qt::Horizontal) {
|
||||||
// For horizontal fit (fit by width), position at top (for tall images)
|
// For horizontal fit (fit by width), position at top (for tall images)
|
||||||
|
|||||||
+1
-1
@@ -101,7 +101,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
m_am->actionRotateCounterClockwise,
|
m_am->actionRotateCounterClockwise,
|
||||||
m_am->actionRotateClockwise,
|
m_am->actionRotateClockwise,
|
||||||
m_am->actionFlipHorizontal,
|
m_am->actionFlipHorizontal,
|
||||||
m_am->actionToggleCheckerboard,
|
m_am->actionFlipVertical,
|
||||||
});
|
});
|
||||||
// Setup right click menus
|
// Setup right click menus
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user