mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-21 00:59:29 +00:00
Improve handling of skins without gen.bmp
This commit is contained in:
parent
d6eb60338e
commit
64468fef98
2 changed files with 18 additions and 12 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue