From c71eb853c5b10a503eb4fcfec3340ccbed0e5aa3 Mon Sep 17 00:00:00 2001 From: Allilengyi Date: Sun, 4 Feb 2024 00:02:58 +0100 Subject: [PATCH 1/2] transferred PR 1055 of upstream --- src/components/Event/EventBanner.vue | 4 +- src/components/Event/EventMetadataSidebar.vue | 92 +++++++++++++++++++ src/components/Image/BlurhashImg.vue | 14 ++- src/components/Image/BlurhashImgWrapper.vue | 80 ++++++++++++++++ 4 files changed, 185 insertions(+), 5 deletions(-) create mode 100644 src/components/Image/BlurhashImgWrapper.vue diff --git a/src/components/Event/EventBanner.vue b/src/components/Event/EventBanner.vue index 22ffc704c..3cb8e47e7 100644 --- a/src/components/Event/EventBanner.vue +++ b/src/components/Event/EventBanner.vue @@ -1,11 +1,11 @@ + -- 2.44.1 From 195e2d37bc1b6a2377ae678f6f61257c177b4489 Mon Sep 17 00:00:00 2001 From: Allilengyi Date: Sun, 4 Feb 2024 01:26:14 +0100 Subject: [PATCH 2/2] migrated files to vue.js 3.x --- src/components/Image/BlurhashImg.vue | 30 ++++---- src/components/Image/BlurhashImgWrapper.vue | 80 ++++++--------------- 2 files changed, 36 insertions(+), 74 deletions(-) diff --git a/src/components/Image/BlurhashImg.vue b/src/components/Image/BlurhashImg.vue index 306efdc87..fa93943f3 100644 --- a/src/components/Image/BlurhashImg.vue +++ b/src/components/Image/BlurhashImg.vue @@ -18,25 +18,21 @@ const props = withDefaults( const canvas = ref(undefined); onMounted(() => { - try { - if (canvas.value) { - const pixels = decode(props.hash, 128, 32); - const imageData = new ImageData(pixels, 128, 32); - const context = canvas.value.getContext("2d"); - if (context) { - context.putImageData(imageData, 0, 0); - } - } + updateCanvas(); +}); - @Watch("hash") - updateHashChange(): void { - try { - const pixels = decode(this.hash, 128, 32); - const imageData = new ImageData(pixels, 128, 32); - const context = this.canvas.getContext("2d"); - context.putImageData(imageData, 0, 0); +watch(() => props.hash, () => { + updateCanvas(); +}); + +function updateCanvas() { + try { + const pixels = decode(props.hash, 128, 32); + const imageData = new ImageData(pixels, 128, 32); + const context = canvasRef.value.getContext('2d'); + context.putImageData(imageData, 0, 0); } catch (e) { console.error(e); } -}); +} diff --git a/src/components/Image/BlurhashImgWrapper.vue b/src/components/Image/BlurhashImgWrapper.vue index 8a6b15b01..c1bb3a555 100644 --- a/src/components/Image/BlurhashImgWrapper.vue +++ b/src/components/Image/BlurhashImgWrapper.vue @@ -10,71 +10,37 @@ - - -- 2.44.1