画布:JavaScript 未捕获错误:INDEX_SIZE_ERR:DOM 异常 1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2444073/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 00:22:43  来源:igfitidea点击:

Canvas: JavaScript Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1

javascripthtmlcanvas

提问by Travis

The site is: http://www.clubloc.com/

该网站是:http: //www.clubloc.com/

And it works in firefox but not in google chrome. Internet explorer also has problems but thats pretty much a given when using HTML5 Canvas.

它在 Firefox 中有效,但在 google chrome 中无效。Internet Explorer 也有问题,但这在使用 HTML5 Canvas 时几乎是给定的。

Anyways I'm trying to figure out why it throws the error: Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1

无论如何,我试图弄清楚为什么它会抛出错误:未捕获的错误:INDEX_SIZE_ERR:DOM Exception 1

When the arrays clearly have all those elements, I even logged their size and it says 100.

当数组清楚地包含所有这些元素时,我什至记录了它们的大小并显示为 100。

Any help/guidance would be greatly appreciated.

任何帮助/指导将不胜感激。

回答by Travis

Zneak has the answer right, I just fixed it.

Zneak 的答案是正确的,我刚刚修复了它。

I wasn't doing the radial boundary testing early enough... Canvas doesn't like it if you have a negative radius :-).

我没有足够早地进行径向边界测试......如果半径为负,Canvas 不喜欢它:-)。

Thanks zneak!

谢谢zneak!