Improve handling of skins without gen.bmp

This commit is contained in:
Jordan Eldredge 2018-01-14 13:02:33 -08:00
parent d6eb60338e
commit 64468fef98
2 changed files with 18 additions and 12 deletions

View file

@ -90,16 +90,20 @@ const Skin = props => {
});
}
});
LETTERS.forEach(letter => {
const width = skinGenLetterWidths[`GEN_TEXT_${letter}`];
const selectedWidth = skinGenLetterWidths[`GEN_LETTER_SELECTED_${letter}`];
cssRules.push(
`#winamp2-js .gen-text-${letter.toLowerCase()} {width: ${width}px;}`
);
cssRules.push(
`#winamp2-js .selected .gen-text-${letter.toLowerCase()} {width: ${selectedWidth}px;}`
);
});
if (skinGenLetterWidths != null) {
LETTERS.forEach(letter => {
const width = skinGenLetterWidths[`GEN_TEXT_${letter}`];
const selectedWidth =
skinGenLetterWidths[`GEN_LETTER_SELECTED_${letter}`];
cssRules.push(
`#winamp2-js .gen-text-${letter.toLowerCase()} {width: ${width}px;}`
);
cssRules.push(
`#winamp2-js .selected .gen-text-${letter.toLowerCase()} {width: ${selectedWidth}px;}`
);
});
}
Object.keys(cursorSelectors).forEach(cursorName => {
const cursorUrl = skinCursors[cursorName];
if (cursorUrl) {

View file

@ -210,7 +210,7 @@ async function genRegion(zip) {
async function genGenTextSprites(zip) {
const img = await genImgFromFilename(zip, "GEN");
if (img == null) {
return {};
return null;
}
const canvas = document.createElement("canvas");
@ -263,7 +263,7 @@ async function skinParser(zipFile) {
images,
cursors,
region,
[genLetterWidths, genTextImages]
genTextSprites
] = await Promise.all([
genColors(zip),
genPlaylistStyle(zip),
@ -273,6 +273,8 @@ async function skinParser(zipFile) {
genGenTextSprites(zip)
]);
const [genLetterWidths, genTextImages] = genTextSprites || [null, {}];
return {
colors,
playlistStyle,