次の設定で backgroundImage を削除することは可能ですかfabric.Canvas
:
canvas.setBackgroundImage('img_url',function() {
canvas.renderAll();
それとも、標準の背景に戻りますか? to を設定するbackgroundColor
にwhite
は機能しません。
助けてくれてありがとう!あいさつマックス
次の設定で backgroundImage を削除することは可能ですかfabric.Canvas
:
canvas.setBackgroundImage('img_url',function() {
canvas.renderAll();
それとも、標準の背景に戻りますか? to を設定するbackgroundColor
にwhite
は機能しません。
助けてくれてありがとう!あいさつマックス
これは;renderAll
の関数からの抜粋です。fabric.Canvas
...
if (this.backgroundColor) {
canvasToDrawOn.fillStyle = this.backgroundColor;
canvasToDrawOn.fillRect(0, 0, this.width, this.height);
}
if (typeof this.backgroundImage === 'object') {
this._drawBackroundImage(canvasToDrawOn);
}
...
明らかに、実際には背景色は白に設定されていますcanvas.backgroundColor = white;
。しかし、canvas.backgroundImage
はまだImage
オブジェクトであるため、背景を塗りつぶした色の上に描画されます。
したがって、 を描画したくない場合は、backgroundImage
に設定する必要があります0
。とは動作null
しません. ただし、で動作します。typeof this.backgroundImage === 'object'
true
renderAll
backgroundImage
canvas.backgroundImage = 0;
例。