Fix margin of double pages with set reader width

Depending on the set reader width, the auto margin of the images took effect and separated the double pages.
However, for double pages, only the margin left/right depending on the page should be set, to properly center the pages without a gap between them
This commit is contained in:
schroda
2024-12-27 20:59:17 +01:00
parent 89138fadde
commit 3c57011f0c

View File

@@ -213,6 +213,7 @@ export const getImageWidthStyling = (
export const getImageMarginStyling = (doublePage: boolean, objectFitPosition?: 'left' | 'right'): CSSObject => ({
m: 'auto',
...applyStyles(doublePage, {
m: 'unset',
// the applied margin is the opposite of the objectFitPosition
...applyStyles(objectFitPosition === 'right', { ml: 'auto ' }),
...applyStyles(objectFitPosition === 'left', { mr: 'auto ' }),