Skip to content

fix: Dock can overlapping right-click menu#566

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

fix: Dock can overlapping right-click menu#566
BLumia merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-316719

Conversation

@wjyrich
Copy link
Copy Markdown
Contributor

@wjyrich wjyrich commented May 20, 2025

PR-455 and PR-454.
Set menu margin according to dock location

PMS-BUG-316719

Summary by Sourcery

Bug Fixes:

  • Add dynamic margins to context menus in both AppItemMenu and DummyAppItemMenu to account for dock position and prevent overlap in fullscreen mode.

PR-455 and PR-454.
Set menu margin according to dock location

PMS-BUG-316719
@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 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

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 代码重复

    • AppItemMenu.qmlDummyAppItemMenu.qml中,isFullscreenisHorizontalDockdockSpacing的计算逻辑是相同的。建议将这些逻辑提取到一个公共的函数或模块中,以避免代码重复。
  2. 逻辑清晰度

    • AppItemMenu.qmlDummyAppItemMenu.qml中,topMarginbottomMarginleftMarginrightMargin的计算逻辑较为复杂,建议使用更清晰的逻辑来设置这些值,例如使用一个函数来根据方向和全屏状态返回适当的边距值。
  3. 性能考虑

    • dockSpacing的计算依赖于isHorizontalDock,如果isHorizontalDock的值在短时间内频繁变化,可能会导致dockSpacing的重复计算。建议使用缓存机制来优化性能。
  4. 可维护性

    • 将重复的逻辑提取到公共函数或模块中,可以提高代码的可维护性。如果将来需要修改这些逻辑,只需在一个地方进行修改即可。
  5. 代码风格

    • AppItemMenu.qmlDummyAppItemMenu.qml中,新增的属性和信号应该遵循项目的代码风格指南,例如使用一致的缩进和空格。
  6. 注释

    • 考虑为新增的属性和信号添加注释,说明它们的用途和如何使用,以提高代码的可读性。

综上所述,建议对代码进行重构,以提高代码质量、性能和可维护性。

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 20, 2025

Reviewer's Guide

Context menus in AppItemMenu and DummyAppItemMenu now compute dock orientation and spacing at runtime and apply corresponding margins in fullscreen mode to avoid overlapping the dock.

Sequence Diagram: Context Menu Margin Calculation Logic

sequenceDiagram
    actor User
    participant MenuLoader as "AppItemMenu/DummyAppItemMenu"
    participant ContextMenu
    participant LauncherController
    participant DesktopIntegration

    User->>+MenuLoader: Right-click (triggers menu)
    MenuLoader->>ContextMenu: Show menu
    activate ContextMenu

    ContextMenu->>MenuLoader: Get isFullscreen property
    MenuLoader->>LauncherController: Get currentFrame
    LauncherController-->>MenuLoader: Returns currentFrame
    MenuLoader-->>ContextMenu: Provides isFullscreen (computed)

    ContextMenu->>MenuLoader: Get dockSpacing property
    MenuLoader->>DesktopIntegration: Get dockPosition
    DesktopIntegration-->>MenuLoader: Returns dockPosition
    MenuLoader->>DesktopIntegration: Get dockGeometry
    DesktopIntegration-->>MenuLoader: Returns dockGeometry
    MenuLoader-->>ContextMenu: Provides dockSpacing (computed)

    ContextMenu->>DesktopIntegration: Get dockPosition (for margin side)
    DesktopIntegration-->>ContextMenu: Returns dockPosition

    ContextMenu-->>User: Display menu with correct margins
    deactivate ContextMenu
    deactivate MenuLoader
Loading

Class Diagram: Updated Menu Component Structure

classDiagram
    class AppItemMenu {
      +isFullscreen: bool
      +isHorizontalDock: bool
      +dockSpacing: int
    }
    class DummyAppItemMenu {
      +isFullscreen: bool
      +isHorizontalDock: bool
      +dockSpacing: int
    }
    class Menu {
      +topMargin: int
      +bottomMargin: int
      +leftMargin: int
      +rightMargin: int
    }
    AppItemMenu "1" o-- "1" Menu : contains_internal_menu
    DummyAppItemMenu "1" o-- "1" Menu : contains_internal_menu
Loading

File-Level Changes

Change Details Files
Compute dock orientation and spacing for context menus
  • Add isFullscreen property based on current frame
  • Add isHorizontalDock property for dock orientation
  • Add dockSpacing property using dock geometry and devicePixelRatio
qml/AppItemMenu.qml
qml/DummyAppItemMenu.qml
Apply dynamic margins to offset menus from the dock
  • Set topMargin when dock is at the top
  • Set bottomMargin when dock is at the bottom
  • Set leftMargin when dock is on the left
  • Set rightMargin when dock is on the right
qml/AppItemMenu.qml
qml/DummyAppItemMenu.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 and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 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.

@BLumia BLumia merged commit 6339267 into linuxdeepin:master May 21, 2025
7 of 10 checks passed
@wjyrich wjyrich deleted the fix-bug-316719 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