Repository navigation
Conversation
Record press position before filtering the first out-of-range move.\nDisable system move while the image content holds the pointer.\n\nLog: 修复看图内容拖拽移动窗口与首尾空白页\nPMS: BUG-345097\nInfluence: 图片翻页边界与内容区拖拽手势。
Pin PathView navigation to a single committed page per left-button gesture, clear leftover drag state on hover/release at the window boundary, and only treat left-button moves as boundary drags. 修复 Treeland 看图拖动:一次左键手势最多翻一页,松开/悬停不再拖动图片。 Log: 修复看图窗口跟随移动与快速拖拽连翻两页 PMS: BUG-345097 Influence: 图片拖拽翻页、窗口移动与首末页边界行为。
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: JWWTSL The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideThe PR coordinates QML gesture state, PathView clamping, and C++ event filtering to keep image drags from moving the Treeland window, limit fast gestures to one page, eliminate blank edge pages, and recover safely when pointer-release events are lost. Sequence diagram for guarded image dragging on TreelandsequenceDiagram
actor User
participant ImageInputHandler
participant Window as ApplicationWindow
participant PathViewRangeHandler
participant Treeland
User->>ImageInputHandler: MouseButtonPress
ImageInputHandler->>Window: imagePointerDown = true
Window->>Treeland: DWindow.enableSystemMove = false
User->>PathViewRangeHandler: MouseMove with LeftButton
PathViewRangeHandler->>PathViewRangeHandler: Capture press position and check boundary
alt Out-of-range drag
PathViewRangeHandler-->>Treeland: Consume move
else Valid drag
PathViewRangeHandler-->>ImageInputHandler: Allow image navigation
end
User->>Window: MouseButtonRelease
Window->>Window: imagePointerDown = false
Window->>Treeland: DWindow.enableSystemMove = true
Sequence diagram for single-page PathView navigationsequenceDiagram
actor User
participant PathView
participant ImageViewer
participant ViewModel
User->>PathView: Left-button drag
PathView->>ImageViewer: beginBoundaryDrag()
ImageViewer->>ImageViewer: Capture boundary availability
PathView->>ImageViewer: currentIndex change
ImageViewer->>ViewModel: previousImage() or nextImage()
ImageViewer->>ImageViewer: navigationCommitted = true
PathView->>ImageViewer: Additional flick movement
ImageViewer->>PathView: Clamp to committedIndex()
User->>PathView: Release
PathView->>ImageViewer: onMovementEnded
ImageViewer->>ImageViewer: Clear boundary drag state
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['确认 IV.GControl.nextImage()/previousImage() 返回布尔值,或在 QML 层显式处理 undefined 返回值', '可考虑在 beginBoundaryDrag 入口加 if (boundaryDragActive) return; 防御重复调用'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['为 distance 阈值添加注释或提取为命名常量,说明为何以 1 为单位距离阈值', '考虑将 onOffsetChanged 的钳位逻辑提取为独立函数以降低嵌套深度'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['可考虑缓存 QQuickWindow 的 imagePointerDown 属性索引或使用 QML 直接绑定替代 setProperty,但当前实现开销可忽略'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// ImageViewer.qml — 为 distance 阈值添加注释并防御重复调用
function beginBoundaryDrag() {
if (boundaryDragActive)
return; // 防御 TapHandler + Connections 重复调用
boundaryDragOffset = offset;
pressProxyIndex = IV.GControl.viewModel.currentIndex;
canDragPrevious = IV.GControl.hasPreviousImage;
canDragNext = IV.GControl.hasNextImage;
navigationCommitted = false;
committedDirection = 0;
boundaryDragActive = true;
}
// onOffsetChanged 中为阈值添加注释
// threshold = 1: PathView 以 delegate 宽度为偏移单位,
// |distance| > 1 表示已越过相邻 delegate 边界
var DRAG_THRESHOLD = 1;
if (distance > DRAG_THRESHOLD) {
offset = (boundaryDragOffset + 1) % count;
} else if (distance < -DRAG_THRESHOLD) {
offset = (boundaryDragOffset - 1 + count) % count;
}本报告由 AI 代码审查工具自动生成 |
Log: Fix the viewer window following the pointer and double-page flick on Treeland
Influence:
Verify dragging inside the image no longer moves the window.
Verify a fast drag advances at most one page.
Verify the first and last pages no longer show blank pages when dragging.
Verify normal paging and window move still work.
记录按下位置后再过滤首个越界移动;图片内容持有指针时禁用系统窗口移动。
一次左键手势最多翻一页,松开或悬停在边界时清理残留拖拽状态,仅左键移动才当作边界拖拽。
Log: 修复看图窗口跟随指针移动与快速拖拽连翻两页的问题
Influence:
PMS: BUG-345097
Summary by Sourcery
Prevent Treeland pointer gestures from moving the viewer window or causing multiple page advances during a single drag.
Bug Fixes:
Enhancements:
Tests: