diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2024-07-19 10:11:44 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-19 10:11:44 +0900 |
| commit | 56a43dc01d15f1d41bbda9a973da18294389d7c7 (patch) | |
| tree | bf9127069e65090e2f289fbfc63592c993d0bae9 /packages | |
| parent | Disable ESLint for migration files (#14262) (diff) | |
| download | sharkey-56a43dc01d15f1d41bbda9a973da18294389d7c7.tar.gz sharkey-56a43dc01d15f1d41bbda9a973da18294389d7c7.tar.bz2 sharkey-56a43dc01d15f1d41bbda9a973da18294389d7c7.zip | |
fix(frontend): blurhashが無い場合に何も出力されないのを修正 (#14250)
* fix(frontend): blurhashが無い場合に何も出力されないのを修正
* Update Changelog
* Update packages/frontend/src/components/MkImgWithBlurhash.vue
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
* attempt to fix test
* Update packages/frontend/src/components/MkImgWithBlurhash.vue
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
* attempt to ignore test
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/frontend/src/components/MkImgWithBlurhash.vue | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/frontend/src/components/MkImgWithBlurhash.vue b/packages/frontend/src/components/MkImgWithBlurhash.vue index 617404f5c4..8d301f16bd 100644 --- a/packages/frontend/src/components/MkImgWithBlurhash.vue +++ b/packages/frontend/src/components/MkImgWithBlurhash.vue @@ -151,22 +151,26 @@ function drawImage(bitmap: CanvasImageSource) { } function drawAvg() { - if (!canvas.value || !props.hash) return; + if (!canvas.value) return; + + const color = (props.hash != null && extractAvgColorFromBlurhash(props.hash)) || '#888'; const ctx = canvas.value.getContext('2d'); if (!ctx) return; // avgColorでお茶をにごす ctx.beginPath(); - ctx.fillStyle = extractAvgColorFromBlurhash(props.hash) ?? '#888'; + ctx.fillStyle = color; ctx.fillRect(0, 0, canvasWidth.value, canvasHeight.value); } async function draw() { - if (props.hash == null) return; + if (import.meta.env.MODE === 'test' && props.hash == null) return; drawAvg(); + if (props.hash == null) return; + if (props.onlyAvgColor) return; const work = await canvasPromise; |