Skip to content

fix: The four corners can't be dragged properly in full-screen mode#545

Merged
BLumia merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-310813
May 6, 2025
Merged

fix: The four corners can't be dragged properly in full-screen mode#545
BLumia merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-310813

Conversation

@wjyrich
Copy link
Copy Markdown
Contributor

@wjyrich wjyrich commented Apr 30, 2025

pms-bug-310813

Summary by Sourcery

Refactor drag and drop functionality in the fullscreen frame to improve page navigation and item placement

Bug Fixes:

  • Fixed issues with dragging items across pages in full-screen mode

Enhancements:

  • Improved drag and drop page navigation logic
  • Added more robust handling of page creation during drag operations

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 代码重复DropArea组件的代码在两个地方被重复,建议将重复的代码提取到一个单独的组件或函数中,以减少代码冗余。

  2. 变量命名pageIntent变量名不够直观,建议使用更具描述性的名称,如pageNavigationIntent

  3. 逻辑判断:在checkDragMove函数中,isLastPage变量在每次调用时都会重新计算,可以考虑将其移到函数外部,减少不必要的计算。

  4. 空页面创建:在dndMovePageTimeronTriggered函数中,creatEmptyPage拼写错误,应为createEmptyPage

  5. 性能优化checkDragMove函数在onPositionChanged事件中会被频繁调用,如果drag对象很大,可能会导致性能问题。建议检查是否有必要每次都重新计算drag的值。

  6. 事件处理onDroppedonExited事件中,pageIntent被设置为0,但onPageIntentChanged事件中又检查了pageIntent的值,这可能导致逻辑混乱。建议在onPageIntentChanged事件中统一处理pageIntent的值。

  7. 错误处理:在onDropped事件中,如果drop.getDataAsString失败,可能会导致程序崩溃。建议添加错误处理逻辑,例如使用try-catch语句。

  8. 代码注释onDropped事件中的注释// drop over the left or right boundary of the page, do nothing不够清晰,建议使用更明确的注释说明。

  9. 代码风格onDropped事件中的代码缩进不一致,建议统一缩进风格,提高代码可读性。

  10. 安全性:在onDropped事件中,drop.getDataAsString方法可能会受到注入攻击,建议对输入进行验证和清理。

综合以上意见,建议对代码进行重构和优化,以提高代码质量、性能和安全性。

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 30, 2025

Reviewer's Guide

The DropArea component in FullscreenFrame.qml was moved from within the SearchResultGridViewContainer to be a direct child of the root InputEventItem. This restructuring aims to correct the drag-and-drop behavior at the corners in full-screen mode by adjusting the DropArea's position and z-order within the item hierarchy.

File-Level Changes

Change Details Files
Relocated the DropArea component.
  • Removed the DropArea from its previous location inside SearchResultGridViewContainer.
  • Added the DropArea as a direct child of the InputEventItem.
  • Set the z-index of the relocated DropArea to -1.
qml/FullscreenFrame.qml

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

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @wjyrich - I've reviewed your changes - here's some feedback:

  • Consider refactoring the complex logic within the moved DropArea, particularly state management (createdEmptyPage) and timer interactions, for improved clarity.
  • Replace magic numbers like 0.5 (paddingColumns) and 1000 (timer interval) with named constants.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread qml/FullscreenFrame.qml
@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, wjyrich

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

@BLumia BLumia merged commit a9c8f52 into linuxdeepin:master May 6, 2025
9 of 10 checks passed
@wjyrich wjyrich deleted the fix-bug-310813 branch June 6, 2025 00:36
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