fix: 缩略图

This commit is contained in:
unanmed 2025-06-23 11:10:45 +08:00
parent b026287a71
commit dd4d94d513

View File

@ -15,6 +15,7 @@ export interface ThumbnailProps extends SpriteProps {
// configs // configs
damage?: boolean; damage?: boolean;
all?: boolean; all?: boolean;
size?: number;
} }
export const Thumbnail = defineComponent<ThumbnailProps>(props => { export const Thumbnail = defineComponent<ThumbnailProps>(props => {
@ -25,13 +26,14 @@ export const Thumbnail = defineComponent<ThumbnailProps>(props => {
}; };
const drawThumbnail = (canvas: MotaOffscreenCanvas2D) => { const drawThumbnail = (canvas: MotaOffscreenCanvas2D) => {
const ctx = canvas.ctx;
const hero = props.hero; const hero = props.hero;
const options: Partial<DrawThumbnailConfig> = { const options: Partial<DrawThumbnailConfig> = {
damage: props.damage, damage: props.damage,
ctx: canvas.ctx, ctx: ctx,
x: 0, x: 0,
y: 0, y: 0,
size: 1, size: props.size ?? 1,
all: props.all, all: props.all,
noHD: false, noHD: false,
v2: true, v2: true,
@ -44,7 +46,11 @@ export const Thumbnail = defineComponent<ThumbnailProps>(props => {
options.centerX = hero.loc.x; options.centerX = hero.loc.x;
options.centerY = hero.loc.y; options.centerY = hero.loc.y;
} }
ctx.save();
ctx.fillStyle = props.padStyle;
ctx.fillRect(0, 0, canvas.width, canvas.height);
core.drawThumbnail(props.floorId, props.map, options); core.drawThumbnail(props.floorId, props.map, options);
ctx.restore();
}; };
watch(props, update); watch(props, update);