Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[g] 对 Image 新增一种 pointer-events 值(pixels) #1373

Closed
xiaoiver opened this issue Jun 14, 2023 · 1 comment
Closed

[g] 对 Image 新增一种 pointer-events 值(pixels) #1373

xiaoiver opened this issue Jun 14, 2023 · 1 comment
Assignees
Labels

Comments

@xiaoiver
Copy link
Contributor

xiaoiver commented Jun 14, 2023

在标注场景中,对于 Image 希望在非透明像素点才判定拾取通过。目前 Image 的拾取表现如下图所示:

Jun-14-2023 10-40-11

在 pointer-events 中并没有考虑像素点的值,因此考虑新增一种:
https://developer.mozilla.org/zh-CN/docs/Web/CSS/pointer-events

仅对 Image 生效,由于需要使用 getImageData 读取图片像素值,暂时仅在 g-canvas 中实现:

image.style.pointerEvents = 'non-transparent-pixel';
@xiaoiver xiaoiver self-assigned this Jun 14, 2023
@xiaoiver
Copy link
Contributor Author

xiaoiver commented Jun 14, 2023

效果如下,实现在 g-plugin-canvas-picker 中,由于需要绘制 Image,因此该插件需要依赖 g-plugin-canvas-renderer

Jun-14-2023 15-04-17

xiaoiver added a commit that referenced this issue Jun 15, 2023
* feat: support 'pixels' in pointer-events #1373

* fix: add to image cache when it loaded #1325

* fix: rename to non-transparent-pixel #1373

* feat: use vertex compression to reduce GPU memory using #1375

* Publish

 - @antv/g-canvas@1.9.48
 - @antv/g-canvaskit@0.8.45
 - @antv/g-gesture@0.0.83
 - @antv/g-lite@1.0.70
 - @antv/g-mobile-canvas@0.8.56
 - @antv/g-mobile-svg@0.8.60
 - @antv/g-mobile-webgl@0.7.74
 - @antv/g-plugin-3d@1.7.57
 - @antv/g-plugin-a11y@0.4.52
 - @antv/g-plugin-annotation@0.2.69
 - @antv/g-plugin-box2d@1.7.53
 - @antv/g-plugin-canvas-picker@1.8.51
 - @antv/g-plugin-canvas-renderer@1.7.60
 - @antv/g-plugin-canvaskit-renderer@1.1.54
 - @antv/g-plugin-control@1.7.54
 - @antv/g-plugin-device-renderer@1.7.70
 - @antv/g-plugin-dom-interaction@1.7.52
 - @antv/g-plugin-dragndrop@1.6.51
 - @antv/g-plugin-gpgpu@1.7.50
 - @antv/g-plugin-html-renderer@1.7.56
 - @antv/g-plugin-image-loader@1.1.54
 - @antv/g-plugin-matterjs@1.7.53
 - @antv/g-plugin-mobile-interaction@0.7.51
 - @antv/g-plugin-physx@1.7.54
 - @antv/g-plugin-rough-canvas-renderer@1.7.54
 - @antv/g-plugin-rough-svg-renderer@1.7.56
 - @antv/g-plugin-svg-renderer@1.8.60
 - @antv/g-plugin-webgl-device@1.7.54
 - @antv/g-plugin-webgpu-device@1.7.51
 - @antv/g-plugin-yoga@1.7.51
 - @antv/g-plugin-zdog-canvas-renderer@1.0.19
 - @antv/g-plugin-zdog-svg-renderer@1.0.18
 - @antv/g-shader-components@1.7.55
 - @antv/g-svg@1.8.60
 - @antv/g-webgl@1.7.74
 - @antv/g-webgpu@1.7.73
 - @antv/g@5.16.33
 - @antv/react-g@1.8.79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant