antvis/G6

G6图片缩放的时候锯齿问题 #4081

Fadingvision posted onGitHub

Describe the bug

addShape('image') 图片缩放锯齿问题。 节点图片: image 原始图片: Ofac

Your Example Website or App

null

Steps to Reproduce the Bug or Issue

  1. 通过addShape('image') 为节点添加图片,为了zoom的时候图片效果清晰,图片尺寸比节点大。
  2. canvas缩放图片,导致锯齿严重。
  3. 经过一番搜索stackoverflow,尝试用下面的代码将canvasimageSmoothingQuality 设为high, 但是每次设置完之后,重新布局这个值又被重置回low了。
    const canvas = graph.get('canvas').cfg.el
    const ctx = canvas.getContext('2d')
    ctx.imageSmoothingQuality = 'high'

Expected behavior

期望:

  1. g6能够实现一个addShape图片缩小的算法,让大图缩小的时候不要有锯齿?
  2. 能够默认将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


Fund this Issue

$0.00
Funded

Pull requests