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:
@@ -97,7 +97,7 @@ export const ReaderPage = forwardRef(
|
||||
...applyStyles(!display, {
|
||||
display: 'none',
|
||||
}),
|
||||
...getImageMarginStyling(readingMode.value, doublePage, position),
|
||||
...getImageMarginStyling(doublePage, position),
|
||||
...applyStyles(marginTop !== undefined, {
|
||||
mt: `${marginTop}px`,
|
||||
}),
|
||||
@@ -119,7 +119,7 @@ export const ReaderPage = forwardRef(
|
||||
objectFit: 'contain',
|
||||
objectPosition: position,
|
||||
userSelect: 'none',
|
||||
...getImageMarginStyling(readingMode.value, doublePage, position),
|
||||
...getImageMarginStyling(doublePage, position),
|
||||
...applyStyles(marginTop !== undefined, {
|
||||
mt: `${marginTop}px`,
|
||||
}),
|
||||
|
||||
@@ -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 ' }),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user