nutui-react icon indicating copy to clipboard operation
nutui-react copied to clipboard

fix: 修复小程序在真机中canvas层级错误导致的问题

Open yi-boide opened this issue 1 year ago • 4 comments

🤔 这个变动的性质是?

  • [ ] 新特性提交
  • [x] 日常 bug 修复
  • [ ] 站点、文档改进
  • [ ] 演示代码改进
  • [ ] 组件样式/交互改进
  • [ ] TypeScript 定义更新
  • [ ] 包体积优化
  • [ ] 性能优化
  • [ ] 功能增强
  • [ ] 国际化改进
  • [ ] 重构
  • [ ] 代码风格优化
  • [ ] 测试用例
  • [ ] 分支合并
  • [ ] 其他改动(是关于什么的改动?)

🔗 相关 Issue

#2168

💡 需求背景和解决方案

使用canvas2d进行渲染绘制

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项。⚠️

  • [x] 文档已补充或无须补充
  • [x] 代码演示已提供或无须提供
  • [x] TypeScript 定义已补充或无须补充
  • [x] fork仓库代码是否为最新避免文件冲突
  • [x] Files changed 没有 package.json lock 等无关文件

Summary by CodeRabbit

  • 新功能
    • AvatarCropper 组件中进行了多个逻辑和命名的调整,以提高跨平台兼容性和代码可读性。

yi-boide avatar May 30 '24 06:05 yi-boide

Walkthrough

AvatarCropper 组件中进行了重构,移除了冗余的属性,简化了图像处理逻辑,并针对不同平台优化了画布功能。这些改动提升了代码的可读性、组织性和适应性,使组件在多环境下表现更加稳定。

Changes

文件路径 变更摘要
src/packages/avatarcropper/avatarcropper.taro.tsx 1. DrawImage 接口不再包含 src 属性。
2. 将 showAlipayCanvas2D 重命名为 showCanvas2D 并调整其逻辑。
3. 替换所有 showAlipayCanvas2D 的引用为 showCanvas2D
4. 删除 defDrawImage 中的 src 属性初始化。
5. 更新 useReady 和相关函数以使用 showCanvas2D
6. 重构 canvas2dDraw 以使用 canvasImage 而不是 src
7. 将 alipayDraw 重命名为 canvas2dContextDraw 并调整其使用。
8. 替换各处 showAlipayCanvas2D 的引用为 showCanvas2D
9. 更新 confirmCanvas2D 中的逻辑以根据 Taro.getEnv() 处理不同平台。

Poem

代码如画布,重构如新,
简化属性,逻辑清晰。
多平台支持,功能齐全,
画布绘制,妙笔生辉。
🐇✨


Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2d1b42a4a71d4736c86d2aaacb83c7622d203d2b and e830ab127fe68856d3902bdddd11f681e4c83c23.

Files selected for processing (1)
  • src/packages/avatarcropper/avatarcropper.taro.tsx (13 hunks)
Additional context used
GitHub Check: lint
src/packages/avatarcropper/avatarcropper.taro.tsx

[warning] 118-118: React Hook useMemo has missing dependencies: 'systemInfo.SDKVersion' and 'systemInfo.platform'. Either include them or remove the dependency array


[warning] 270-270: React Hook useCallback has missing dependencies: 'pixelRatio' and 'space'. Either include them or remove the dependency array

Biome
src/packages/avatarcropper/avatarcropper.taro.tsx

[error] 307-307: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Additional comments not posted (1)
src/packages/avatarcropper/avatarcropper.taro.tsx (1)

146-149: 代码变更已批准

setCanvasImage 函数正确处理了不同的环境。没有发现问题。


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

:bangbang: IMPORTANT Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 30 '24 06:05 coderabbitai[bot]

ME1717120254584 ios真机获取不到裁剪图片

irisSong avatar May 31 '24 01:05 irisSong

ME1717120254584 ios真机获取不到裁剪图片

这个我使用ios真机预览模式下测试了下,是正常的

yi-boide avatar Aug 07 '24 13:08 yi-boide

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.17%. Comparing base (2993e06) to head (e830ab1). Report is 62 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #2305   +/-   ##
=======================================
  Coverage   83.17%   83.17%           
=======================================
  Files         217      217           
  Lines       17799    17799           
  Branches     2570     2570           
=======================================
  Hits        14805    14805           
  Misses       2989     2989           
  Partials        5        5           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 07 '24 13:08 codecov[bot]