Skip to content

feat: Disable two-finger rotation gesture in pinch handling. - #184

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
LiHua000:master
Nov 19, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
LiHua000:master

Conversation

@LiHua000

@LiHua000 LiHua000 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requirement port: backport 0e90e77 from develop/eagle to master. Pinch gestures no longer trigger rotation, only two-finger zoom is kept. Keep non-gesture rotation paths unchanged, including toolbar/shortcut rotation and delayed rotate save behavior.

Log: as title

Task: https://pms.uniontech.com/task-view-387789.html https://pms.uniontech.com/task-view-387787.html

Summary by Sourcery

Disable image rotation from pinch gestures while retaining two-finger zoom and existing non-gesture rotation controls.

Bug Fixes:

  • Prevent pinch gestures from rotating images, leaving two-finger zoom behavior unchanged.

Enhancements:

  • Remove gesture-rotation animation, state management, and panel integration while preserving non-gesture rotation paths.

Chores:

  • Update copyright years in the affected source files.

@sourcery-ai

sourcery-ai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Remove the gesture-rotation signal and its ViewPanel connection because pinch gestures no longer complete image rotations.

  • libimageviewer/viewpanel/scen/imagegraphicsview.h L1, L135 (removed lines)
  • libimageviewer/viewpanel/viewpanel.cpp L1, L130 (removed lines)

Implementation

Keep pinch handling for zoom while suppressing rotation, and remove the gesture-only rotation completion logic and state.

  • libimageviewer/viewpanel/scen/imagegraphicsview.cpp L1-1385 (4 small edits)
  • libimageviewer/viewpanel/scen/imagegraphicsview.h L184 (removed lines), L232 (removed lines)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

lzwind
lzwind previously approved these changes Nov 19, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="libimageviewer/viewpanel/scen/imagegraphicsview.h" line_range="191" />
<code_context>
-     * @brief OnFinishPinchAnimal
-     * 旋转图片松开手指回到特殊位置结束动画槽函数
-     */
-    void OnFinishPinchAnimal();
-
 private:
</code_context>
<issue_to_address>
**Test target fails to compile**

When the test target compiles `test_LibImageGraphicsView.cpp`, removing the declaration and definition leaves the test calling the missing `OnFinishPinchAnimal()` member, so the test target fails to compile.

Keep the test and class API consistent by restoring the slot or updating the test to use the replacement.

Also at `libimageviewer/viewpanel/scen/imagegraphicsview.cpp:1442`.
</issue_to_address>

### Comment 2
<location path="libimageviewer/viewpanel/scen/imagegraphicsview.cpp" line_range="1355" />
<code_context>
-        if (!m_rotateflag) {
-            qDebug() << "ratateflag" << gesture->lastRotationAngle();
-            gesture->setRotationAngle(gesture->lastRotationAngle());
-            return;
-        }
-        qreal rotationDelta = gesture->rotationAngle() - gesture->lastRotationAngle();
</code_context>
<issue_to_address>
**Later zooms use stale center**

When the final pinch event reports `RotationAngleChanged`, including when it also reports `GestureFinished`, `pinchTriggered` returns before the `GestureFinished` cleanup resets `m_isFirstPinch` and handles the saved `m_centerPoint`, so the next pinch reuses the previous center and anchors zoom at the wrong location.

Ensure the `GestureFinished` cleanup runs before returning from the rotation-change branch.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

}
// 新需求:不再支持双指触发旋转,仅保留双指缩放
gesture->setRotationAngle(gesture->lastRotationAngle());
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Later zooms use stale center

When the final pinch event reports RotationAngleChanged, including when it also reports GestureFinished, pinchTriggered returns before the GestureFinished cleanup resets m_isFirstPinch and handles the saved m_centerPoint, so the next pinch reuses the previous center and anchors zoom at the wrong location.

Ensure the GestureFinished cleanup runs before returning from the rotation-change branch.

Prompt for AI agents
In `libimageviewer/viewpanel/scen/imagegraphicsview.cpp` at line 1355:

**Later zooms use stale center**

When the final pinch event reports `RotationAngleChanged`, including when it also reports `GestureFinished`, `pinchTriggered` returns before the `GestureFinished` cleanup resets `m_isFirstPinch` and handles the saved `m_centerPoint`, so the next pinch reuses the previous center and anchors zoom at the wrong location.

Ensure the `GestureFinished` cleanup runs before returning from the rotation-change branch.

Requirement port: backport 0e90e77 from develop/eagle to master.
Pinch gestures no longer trigger rotation, only two-finger zoom is
kept. Keep non-gesture rotation paths unchanged, including
toolbar/shortcut rotation and delayed rotate save behavior.

Log: as title
PMS: https://pms.uniontech.com/task-view-387789.html
PMS: https://pms.uniontech.com/task-view-387787.html
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: LiHua000, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@LiHua000

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot

deepin-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

This pr cannot be merged! (status: unstable)

@LiHua000

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit 871e5a0 into linuxdeepin:master Nov 19, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants