Skip to content

fix(overlay): avoid edit toolbar covering keys#45

Merged
qiin2333 merged 1 commit into
masterfrom
codex/edit-toolbar-avoidance
Jun 18, 2026
Merged

fix(overlay): avoid edit toolbar covering keys#45
qiin2333 merged 1 commit into
masterfrom
codex/edit-toolbar-avoidance

Conversation

@qiin2333

@qiin2333 qiin2333 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

改了啥呀

  • 让自定义按键编辑工具栏变成浮层,根据当前选中/拖拽按键的位置在顶部和底部之间避让
  • 拖拽时会识别当前按键以及同组按键的包围区域,底部快被挡住时就乖乖挪到顶部
  • 保留原来的坐标体系,xPercent/yPercent、拖拽保存、吸附、微调、缩放都不再被工具栏高度影响,杂鱼遮挡状态退退退

为啥要改

底部常驻 edit bar 会挡住靠下的编辑区域。改坐标会牵连保存和布局语义,所以这次只让 bar 自己识别附近操作并避让。

验证

  • git diff --check -- entry/src/main/ets/components/CustomKeyOverlay.ets
  • DEVECO_SDK_HOME="/Applications/DevEco-Studio.app/Contents/sdk" JAVA_HOME="/Applications/DevEco-Studio.app/Contents/jbr/Contents/Home" PATH="/Applications/DevEco-Studio.app/Contents/jbr/Contents/Home/bin:$PATH" NODE_PATH="/Users/mac/Program/moonlight-harmony/node_modules:/Users/mac/Program/moonlight-harmony/hvigor/node_modules:/Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor/node_modules" node hvigorw.js assembleHap --mode module -p module=entry@default -p product=default --no-daemon

Summary by CodeRabbit

发布说明

  • 改进
    • 编辑工具栏现在会智能躲避拖拽的按键区域。
    • 工具栏自动在顶部或底部显示,避免遮挡关键内容。
    • 打开属性、分享、配色等面板时,工具栏会自动隐藏。

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@qiin2333, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 31 minutes and 30 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 40311adf-03a9-494b-87f7-0520d2b5cb9e

📥 Commits

Reviewing files that changed from the base of the PR and between ff1b196 and 8a35f98.

📒 Files selected for processing (1)
  • entry/src/main/ets/components/CustomKeyOverlay.ets
📝 Walkthrough

Walkthrough

CustomKeyOverlay 中新增编辑工具栏拖拽避让能力:追踪当前拖拽键的 ID 与纵向位置,通过新增私有方法计算目标键视口位置后动态决定工具栏停靠顶部或底部,并将工具栏可见性与 Y 坐标改为方法调用;根布局同步从 Column 切换为 Stack

Changes

编辑工具栏拖拽避让

Layer / File(s) Summary
拖拽状态与工具栏位置计算方法
entry/src/main/ets/components/CustomKeyOverlay.ets
新增 activeDragKeyIdactiveDragY 两个内部状态,以及私有方法组:isEditToolbarVisible()(面板打开时返回 false)、目标键聚合逻辑(拖拽键优先、按 groupId 合并)、视口顶底位置计算,和 getEditToolbarY() 根据目标键中点与视口中线的比较返回停靠 Y 坐标。
拖拽回调更新与工具栏渲染集成
entry/src/main/ets/components/CustomKeyOverlay.ets
根容器切换为 Stack()onGroupDragMove 实时写入拖拽状态,onDragFinish 清空;工具栏条件渲染改为 isEditToolbarVisible(),并追加 .position({ x: 0, y: this.getEditToolbarY() }) 应用动态停靠。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要改动:通过动态重定位编辑工具栏来避免其遮挡键盘按键,与PR的核心目标完全对应。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/edit-toolbar-avoidance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qiin2333 qiin2333 force-pushed the codex/edit-toolbar-avoidance branch from ff1b196 to 8a35f98 Compare June 18, 2026 07:50
@qiin2333 qiin2333 merged commit dfda356 into master Jun 18, 2026
2 checks passed
@qiin2333 qiin2333 deleted the codex/edit-toolbar-avoidance branch June 18, 2026 08:28
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.

1 participant