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

在已有内容的canvas上画二维码会清空之前的画布 #54

Open
erguotou520 opened this issue Nov 28, 2019 · 4 comments
Open

Comments

@erguotou520
Copy link

Description

我需要在一个有内容的canvas上某个区域显示一个小的二维码,但是使用如下代码后会直接清空之前的画布

      // 绘制二维码
      drawQrcode({
        width: canvasWidth,
        height: canvasHeight,
        ctx,
        text: this.shareUrl,
        x: rpxToPx(32),
        y: rpxToPx(652)
      })

尝试使用save+restore也不能恢复

Environment

  • Platform: 开发者工具
  • Platform version: 1.02.1910120
  • Wechat version: 无
  • weapp-qrcode version: 1.0.0

Reproduce

问题复现步骤:

  1. [第一步]
    新建一个画布,画一些内容
  2. [第二步]
    使用传ctx的方式画二维码
  3. [第三步]
    再画一些别的东西

期望的表现:
2者都能显示

观察到的表现:
最后画的才能显示

@yingye
Copy link
Owner

yingye commented Nov 28, 2019

因为二维码的背景色是白色,不是透明的,所以[第一步]的操作是会被覆盖的。

@yingye yingye closed this as completed Nov 28, 2019
@erguotou520
Copy link
Author

  1. 第2步画的二维码在第三步也会被覆盖
  2. 有办法不设置背景色么

@yingye
Copy link
Owner

yingye commented Nov 29, 2019

好,我看一下怎么解决

@yingye yingye reopened this Nov 29, 2019
@dengttuo-1994
Copy link

怎么重绘二维码?我清了画布页还是绘制不了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants