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>
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user