Conversation
|
你好 @xxxxZ-zhang,非常感谢你的贡献. Hello, @xxxxZ-zhang, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the docs if there are API changes. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #3340 +/- ##
==========================================
+ Coverage 75.77% 78.65% +2.88%
==========================================
Files 257 224 -33
Lines 11994 12518 +524
Branches 2464 2843 +379
==========================================
+ Hits 9088 9846 +758
+ Misses 1398 961 -437
- Partials 1508 1711 +203 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces video rendering support, featuring a new VideoRenderer that handles aspect ratio calculations and first-frame display, alongside updates to the PreviewClick interaction for video detection. It also includes a suite of tests for various sheet configurations. The review feedback highlights opportunities to improve test reliability by replacing sleep calls with event-based waiting, enhance type safety by avoiding any casts, and improve maintainability by replacing a magic number with a named constant.
|
Size Change: +144 B (+0.02%) Total Size: 744 kB 📦 View Changed
ℹ️ View Unchanged
|
|
你好, @xxxxZ-zhang CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。 Hello, @xxxxZ-zhang CI run failed, please click the [Details] button for detailed log information and fix it. |
048edec to
c7360fd
Compare
0d5edae to
051c0b3
Compare
051c0b3 to
d4807e0
Compare
autoplay: true → autoplay: false 原来:视频创建后自动播放,单元格里的视频一直在动。 现在:不自动播放,只展示首帧静态画面。preload: 'auto' 告诉浏览器主动加载视频数据(否则 autoplay:
video.pause(); onloadeddata 触发时视频数据已到位,但部分浏览器(尤其 Chromium)在 autoplay: false
这是核心变更,解决两个问题:宽高比拉伸 和 icon 溢出。 3.1 可用宽度计算 (L81-82) const { y, height } = cell.getBBoxByType(CellClipBox.CONTENT_BOX); 原始代码直接用 contentBox.width 作为视频宽度。但 contentBox.width 是整个内容区宽度,没有扣除 icon getMaxTextWidth() 在 DataCell 中的实现是 contentBox.width - iconWidth,已经扣除了条件格式 icon 3.2 等比缩放 (L87-106) if (element instanceof HTMLVideoElement) { calculateImageSize 的逻辑: widthRatio = availableWidth / videoWidth // 宽方向缩放比 举例:可用宽 220px,内容高 180px,视频原始 1920×1080:
原始代码独立计算 scaleX = width/videoWidth、scaleY = 3.3 pattern fill 的 transform (L98-105) const scaleX = videoWidth / element.videoWidth; @antv/g 的 pattern fill 用原始视频帧作为贴图源。Rect 尺寸是 videoWidth × 3.4 fallback 处理 (L85) let fill: RectStyleProps['fill'] = 'transparent'; 当视频加载失败时 element 是 fallback 字符串,不进入 if 分支,fill 保持 3.5 定位 (L108-111) const { x: videoX } = cell.getContentPosition({ contentWidth: videoWidth });
4.1 命名标识 (L130) const rect = new Rect({ ...config, name: VIDEO_RECT_NAME }); 给视频 Rect 加 name: 'videoRect',用于 preview-click.ts 中区分点击目标——只有点击视频 Rect 4.2 Play 图标居中于视频区域 (L131-148) const { x, y, width, height } = config.style; 原始代码用 this.getCellInfo(cell) 获取整个内容区的 x/y/width/height,Play |
|
🎉 This PR is included in version @antv/s2-v2.7.1-alpha.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
👀 PR includes
✨ Feature
🎨 Enhance
🐛 Bugfix
🔧 Chore
📝 Description
🖼️ Screenshot
🔗 Related issue link
🔍 Self-Check before the merge