Skip to content

fix(widget): keep popup inside schedule view bounds - #351

Open
wangruoxuan3782 wants to merge 1 commit into
linuxdeepin:masterfrom
wangruoxuan3782:fix/day-view-popup-overflow
Open

wangruoxuan3782 wants to merge 1 commit into
linuxdeepin:masterfrom
wangruoxuan3782:fix/day-view-popup-overflow

Conversation

@wangruoxuan3782

@wangruoxuan3782 wangruoxuan3782 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

修复内容

日视图里点击日程弹出的浮窗有时显示不全,被右侧迷你日历遮挡。

原因

浮窗右边界判断用的是 this->window()->width()(整个窗口宽度),但 rPos 是相对于 CScheduleView 的坐标。日视图中 CScheduleView 只占窗口左侧约一半,右侧还有迷你日历,导致边界判断几乎永远不成立,浮窗总是往右弹,超出 CScheduleView 右边界被裁剪。

改动

  1. 浮窗右边界判断由窗口宽度改为 CScheduleView 自身宽度,避免浮窗超出日视图右边界被迷你日历遮挡。
  2. 限制浮窗纵向位置,箭头保持垂直居中,防止浮窗上下溢出日程视图。
  3. 日视图与周视图共用同一弹窗路径,一并修复。

关联

PMS: https://pms.uniontech.com/bug-view-374977.html

Summary by Sourcery

Keep schedule reminder popups fully visible within day and week schedule views.

Bug Fixes:

  • Keep schedule reminder popups within the schedule view's horizontal bounds so they are not clipped or obscured by the mini calendar.
  • Constrain popup placement vertically within the schedule view while preserving the arrow's centered alignment.

1. Replace window width with CScheduleView width for popup right-bound check so the popup no longer overflows past the day view's right edge into the mini calendar.
2. Clamp the popup vertical position so the arrow stays centered and the popup never spills above or below the schedule view.
3. Apply the bounds fix to both day and week views since they share the same popup show path.

Log: Clamp popup position to CScheduleView bounds so it is fully visible in day view.
Influence: Popup no longer clipped by right-side mini calendar.

fix(widget): 修复日视图浮窗被右侧内容遮挡

1. 浮窗右边界判断由窗口宽度改为 CScheduleView 自身宽度,避免浮窗超出日视图右边界被迷你日历遮挡。
2. 限制浮窗纵向位置,箭头保持垂直居中,防止浮窗上下溢出日程视图。
3. 日视图与周视图共用同一弹窗路径,一并修复。

Log: 将浮窗定位限制在日程视图范围内,解决日视图浮窗显示不全。
PMS: BUG-374977
Influence: 日视图浮窗不再被右侧迷你日历遮挡。
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wangruoxuan3782

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

Hi @wangruoxuan3782. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates schedule popup positioning so day- and week-view popups remain fully visible within CScheduleView, avoiding obstruction by the mini calendar and preventing vertical overflow.

Flow diagram for schedule popup boundary positioning

flowchart TD
    A[Schedule clicked] --> B[mapFromGlobal]
    B --> C[Compute popup dimensions and arrow offset]
    C --> D{Popup exceeds CScheduleView width?}
    D -->|Yes| E[setDirection ArrowRight]
    D -->|No| F[setDirection ArrowLeft]
    E --> G[Clamp showY within CScheduleView height]
    F --> G
    G --> H[show popup within schedule view]
Loading

File-Level Changes

Change Details Files
Keep the schedule reminder popup within the schedule view’s horizontal and vertical bounds.
  • Use the schedule view width instead of the parent window width for right-edge placement decisions.
  • Calculate popup dimensions and arrow-centered vertical offset, then clamp the popup position to the view’s top and bottom edges.
  • Apply the corrected position for both left- and right-facing popup placement.
src/calendar-client/src/customWidget/scheduleview.cpp

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

@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 1 issue

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

## Individual Comments

### Comment 1
<location path="src/calendar-client/src/customWidget/scheduleview.cpp" line_range="551-552" />
<code_context>
+        int showY = rPos.y();
+        if (showY - arrowY < 0)
+            showY = arrowY;
+        else if (showY - arrowY + popupH > this->height())
+            showY = this->height() - popupH + arrowY;
+
+        if ((rPos.x() + popupW + offsetPx) > this->width()) {
</code_context>
<issue_to_address>
**issue (bug_risk):** When the popup is too close to the bottom edge, `showY` is set to `height() - popupH + arrowY` and then passed directly to `show()`, so the popup's bottom edge becomes `height() + arrowY` and overflows the `CScheduleView` by the arrow offset.

**Triggers:** When the clicked schedule is near the bottom of the schedule view.

**Suggested fix:** Clamp the actual popup top-left position to `0..height() - popupH`, or subtract `arrowY` before passing the position to `show()` if the API expects the arrow anchor coordinate.
</issue_to_address>

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 on lines +551 to +552
else if (showY - arrowY + popupH > this->height())
showY = this->height() - popupH + arrowY;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): When the popup is too close to the bottom edge, showY is set to height() - popupH + arrowY and then passed directly to show(), so the popup's bottom edge becomes height() + arrowY and overflows the CScheduleView by the arrow offset.

Triggers: When the clicked schedule is near the bottom of the schedule view.

Suggested fix: Clamp the actual popup top-left position to 0..height() - popupH, or subtract arrowY before passing the position to show() if the API expects the arrow anchor coordinate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants