context.isPointInPath(x, y);
发布于 4 年前 作者 yyu 16015 次浏览 来自 问答

this.inCtx.beginPath();

this.inCtx.arc(100, 100, 50, 0, 2 * Math.PI, false);

console.log(this.inCtx.isPointInPath(100, 100));

this.inCtx.closePath();

这段代码在开发这工具中输出true,在真机中却输出false;费解!求高手解惑!感谢!

4 回复

我也碰到这问题了,iphoneX和6Plus都有问题

没有有这个API你们的开发工具却可以使用,这不是坑人嘛

你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

两部安卓机都有这个问题:

设备名称:HUAWEI Mate 9,型号:MHA-AL00,安卓版本:8.0.0,微信版本:6.6.7;

设备名称:HUAWEI nova,型号:HUAWEI CAZ-TL10,安卓版本:7.0,微信版本:6.6.7;

export default class Main {

    constructor () {

        this.inCanvas = wx.createCanvas();

        this.inCtx = this.inCanvas.getContext(‘2d’);

        this.inCtx.beginPath();

        this.inCtx.arc(100, 100, 50, 0, 2 * Math.PI, false);

        console.log(this.inCtx.isPointInPath(100, 100));

        this.inCtx.closePath();

    }

}

这段代码可以复现问题。

回到顶部