mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 14:42:40 +00:00
actually fix it
This commit is contained in:
@@ -63,17 +63,27 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa
|
|||||||
if(displayOptions.spread === 'facing')
|
if(displayOptions.spread === 'facing')
|
||||||
desiredZoom = (iframeWidth / ((widestPage * 2) + parseInt(displayOptions.columnGap))) * 100;
|
desiredZoom = (iframeWidth / ((widestPage * 2) + parseInt(displayOptions.columnGap))) * 100;
|
||||||
else
|
else
|
||||||
desiredZoom = (iframeWidth / widestPage) * 100;
|
desiredZoom = (iframeWidth / (widestPage + 20)) * 100;
|
||||||
|
|
||||||
} else if(mode == 'fit'){
|
} else if(mode == 'fit'){
|
||||||
// find the page with the largest single dim (height or width) so that zoom can be adapted to fit it.
|
// find the page with the largest single dim (height or width) so that zoom can be adapted to fit it.
|
||||||
const minDimRatio = [...pages].reduce(
|
let minDimRatio;
|
||||||
(minRatio, page)=>Math.min(minRatio,
|
if(displayOptions.spread === 'active')
|
||||||
iframeWidth / ((page.offsetWidth * 2) + parseInt(displayOptions.columnGap)),
|
minDimRatio = [...pages].reduce(
|
||||||
iframeHeight / page.offsetHeight
|
(minRatio, page)=>Math.min(minRatio,
|
||||||
),
|
iframeWidth / page.offsetWidth,
|
||||||
Infinity
|
iframeHeight / page.offsetHeight
|
||||||
);
|
),
|
||||||
|
Infinity
|
||||||
|
);
|
||||||
|
else
|
||||||
|
minDimRatio = [...pages].reduce(
|
||||||
|
(minRatio, page)=>Math.min(minRatio,
|
||||||
|
iframeWidth / ((page.offsetWidth * 2) + parseInt(displayOptions.columnGap)),
|
||||||
|
iframeHeight / page.offsetHeight
|
||||||
|
),
|
||||||
|
Infinity
|
||||||
|
);
|
||||||
|
|
||||||
desiredZoom = minDimRatio * 100;
|
desiredZoom = minDimRatio * 100;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user