From 5473d0c46ad920022e41ab07584783df31180a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Fri, 17 Jul 2020 12:00:33 +0200 Subject: [PATCH] fix blending context --- src/components/Collage.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Collage.vue b/src/components/Collage.vue index 422527b..ad356d1 100644 --- a/src/components/Collage.vue +++ b/src/components/Collage.vue @@ -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); } }