fix blending context

This commit is contained in:
Tomáš Mládek 2020-07-17 12:00:33 +02:00
parent ebb7bc537f
commit 5473d0c46a

View file

@ -92,7 +92,8 @@ export default class Collage extends Vue {
}
private mounted() {
this.reset();
const canvas = (this.$refs.canvas as HTMLCanvasElement);
this.context = canvas.getContext("2d") as CanvasRenderingContext2D;
}
@Watch("images")
@ -114,8 +115,8 @@ export default class Collage extends Vue {
}
private reset() {
this.context.globalCompositeOperation = "source-over";
const canvas = (this.$refs.canvas as HTMLCanvasElement);
this.context = canvas.getContext("2d") as CanvasRenderingContext2D;
this.context.clearRect(0, 0, canvas.width, canvas.height);
}
}