antvis/G6
The issue has been closed
G6图片缩放的时候锯齿问题 #4081
Fadingvision posted onGitHub
Describe the bug
addShape('image') 图片缩放锯齿问题。
节点图片:
原始图片:
Your Example Website or App
null
Steps to Reproduce the Bug or Issue
- 通过addShape('image') 为节点添加图片,为了zoom的时候图片效果清晰,图片尺寸比节点大。
- canvas缩放图片,导致锯齿严重。
- 经过一番搜索stackoverflow,尝试用下面的代码将
canvas
的imageSmoothingQuality
设为high
, 但是每次设置完之后,重新布局这个值又被重置回low
了。const canvas = graph.get('canvas').cfg.el const ctx = canvas.getContext('2d') ctx.imageSmoothingQuality = 'high'
Expected behavior
期望:
- g6能够实现一个addShape图片缩小的算法,让大图缩小的时候不要有锯齿?
- 能够默认将
imageSmoothingQuality
设为'high',或者提供API选项控制?
Screenshots or Videos
No response
Platform
- OS: Windows
- Browser:chrome 107.0.5304.107
- Version:"@antv/g6": "^4.7.3",
Additional context
No response