Properly center images in "single page mode"

While the reader width was set images weren't centered correctly in the images wrapper element
This commit is contained in:
schroda
2024-12-17 01:01:58 +01:00
parent 38bcf4aecc
commit e4253633c9
2 changed files with 8 additions and 17 deletions

View File

@@ -205,21 +205,12 @@ export const getImageWidthStyling = (
}
};
export const getImageMarginStyling = (
readingMode: IReaderSettings['readingMode'],
doublePage: boolean,
objectFitPosition?: 'left' | 'right',
): CSSObject => ({
...applyStyles(!isContinuousReadingMode(readingMode), {
my: 'auto',
...applyStyles(doublePage, {
// the applied margin is the opposite of the objectFitPosition
...applyStyles(objectFitPosition === 'right', { ml: 'auto ' }),
...applyStyles(objectFitPosition === 'left', { mr: 'auto ' }),
}),
}),
...applyStyles(isContinuousReadingMode(readingMode), {
m: 'auto',
export const getImageMarginStyling = (doublePage: boolean, objectFitPosition?: 'left' | 'right'): CSSObject => ({
m: 'auto',
...applyStyles(doublePage, {
// the applied margin is the opposite of the objectFitPosition
...applyStyles(objectFitPosition === 'right', { ml: 'auto ' }),
...applyStyles(objectFitPosition === 'left', { mr: 'auto ' }),
}),
});