Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么canvas context.fill(path)在Chrome上不起作用?_Javascript_Google Chrome_Canvas_Path_Fill - Fatal编程技术网

Javascript 为什么canvas context.fill(path)在Chrome上不起作用?

Javascript 为什么canvas context.fill(path)在Chrome上不起作用?,javascript,google-chrome,canvas,path,fill,Javascript,Google Chrome,Canvas,Path,Fill,这段代码在Chrome上一直有效,直到最近 var canvasB=document.getElementById('b'); var contextB=canvasB.getContext("2d"); contextB.width=50; contextB.height=50; contextB.beginPath(); contextB.fillStyle="#0A0"; contextB.fill(contextB.arc(25,2

这段代码在Chrome上一直有效,直到最近

    var canvasB=document.getElementById('b');
    var contextB=canvasB.getContext("2d");
    contextB.width=50;
    contextB.height=50;
    contextB.beginPath();
    contextB.fillStyle="#0A0";
    contextB.fill(contextB.arc(25,25,24,0,7,0));
请注意,在填充方法中,路径指定为绘制圆。根据这一点,这是可以接受的。解决方案是将路径放在自己的行上,只使用fill()而不使用任何参数

    var canvasA=document.getElementById('a');
    var contextA=canvasA.getContext("2d");
    contextA.width=50;
    contextA.height=50;
    contextA.beginPath();
    contextA.fillStyle="#0A0";
    contextA.arc(25,25,24,0,7,0);
    contextA.fill();
还有,为什么这会停止工作,或者我做错了什么?

任何已发布的浏览器都不支持fill(Path)参数

它本不应该起作用的。截至2013年3月,WHATWG规范中的路径是新的,目前还没有浏览器实现独立的路径

有可能(但不太可能)是错误的开发实现使该功能在短时间内成为可能,但它现在不起作用,即使是在夜间。您将得到相应的类型错误