merge: Fixed startup crash with seasonal effects (!459)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/459 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Amelia Yukii <amelia.yukii@shourai.de>
This commit is contained in:
commit
421f1d46a2
@ -73,27 +73,31 @@ export async function mainBoot() {
|
|||||||
mainRouter.push('/search');
|
mainRouter.push('/search');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
try {
|
||||||
if (defaultStore.state.enableSeasonalScreenEffect) {
|
if (defaultStore.state.enableSeasonalScreenEffect) {
|
||||||
const month = new Date().getMonth() + 1;
|
const month = new Date().getMonth() + 1;
|
||||||
if (defaultStore.state.hemisphere === 'S') {
|
if (defaultStore.state.hemisphere === 'S') {
|
||||||
// ▼南半球
|
// ▼南半球
|
||||||
if (month === 7 || month === 8) {
|
if (month === 7 || month === 8) {
|
||||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||||
new SnowfallEffect({}).render();
|
new SnowfallEffect({}).render();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// ▼北半球
|
||||||
|
if (month === 12 || month === 1) {
|
||||||
|
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||||
|
new SnowfallEffect({}).render();
|
||||||
|
} else if (month === 3 || month === 4) {
|
||||||
|
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||||
|
new SakuraEffect({
|
||||||
|
sakura: true,
|
||||||
|
}).render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
// ▼北半球
|
} catch (error) {
|
||||||
if (month === 12 || month === 1) {
|
// console.error(error);
|
||||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
console.error('Failed to initialise the seasonal screen effect canvas context:', error);
|
||||||
new SnowfallEffect({}).render();
|
|
||||||
} else if (month === 3 || month === 4) {
|
|
||||||
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
|
||||||
new SakuraEffect({
|
|
||||||
sakura: true,
|
|
||||||
}).render();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
|
@ -155,7 +155,9 @@ export class SnowfallEffect {
|
|||||||
max: 0.125,
|
max: 0.125,
|
||||||
easing: 0.0005,
|
easing: 0.0005,
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @throws {Error} - Thrown when it fails to get WebGL context for the canvas
|
||||||
|
*/
|
||||||
constructor(options: {
|
constructor(options: {
|
||||||
sakura?: boolean;
|
sakura?: boolean;
|
||||||
}) {
|
}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user