Canvar2D:将will ReadFurly属性设置为True Warning时,使用getImageData的多个读回操作速度更快

j8yoct9x  于 2022-10-15  发布在  React
关注(0)|答案(2)|浏览(1260)

我使用的是react-wordcloud包,每当容器的大小改变时,它都会对单词Cloud进行排序,以适应当前(70%)的屏幕大小。
我的主机收到垃圾邮件警告:

我尝试使用该程序包的默认设置,但仍收到此警告。

import ReactWordcloud from "react-wordcloud";
const options = {
    colors: ["#FFF7E5", "#F9D3AB", "#f4cc72", "#ffbe2d", "#ffb100"],
    enableTooltip: false,
    deterministic: true,
    fontFamily: "impact",
    fontSizes: [40, 80],
    fontStyle: "normal",
    fontWeight: "normal",
    padding: 2,
    rotations: 1,
    rotationAngles: [0],
    scale: "sqrt",
    spiral: "archimedean",
    transitionDuration: 1000,
  };
return(<div
   style={{ width: "100%", height: "100%" }}
   >
   <ReactWordcloud options={options} words={props.wordCloud} />
</div>)
3zwtqj6y

3zwtqj6y1#

您可以尝试此getContext(‘2d’,{will ReadFurly:True});
有关详细信息,请参阅:
https://developer.mozilla.org/pt-BR/docs/Web/API/HTMLCanvasElement/getContext
TKS

wkyowqbh

wkyowqbh2#

这也发生在我身上。我认为这与Dark Reader Chrome扩展有关。
为警告引用的URL:https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

相关问题