0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-03 01:52:42 +00:00

Merge pull request #4237 from naturalcrit/fix-toolbar-issues

Add defaults to the toolbar for rowGap and columnGap
This commit is contained in:
Víctor Losada Hernández
2025-06-25 17:01:10 +02:00
committed by GitHub
3 changed files with 12 additions and 10 deletions

View File

@@ -113,7 +113,9 @@ const BrewRenderer = (props)=>{
zoomLevel : 100, zoomLevel : 100,
spread : 'single', spread : 'single',
startOnRight : true, startOnRight : true,
pageShadows : true pageShadows : true,
rowGap : 5,
columnGap : 10,
}); });
//useEffect to store or gather toolbar state from storage //useEffect to store or gather toolbar state from storage

View File

@@ -21,8 +21,9 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa
}, [visiblePages]); }, [visiblePages]);
useEffect(()=>{ useEffect(()=>{
const visibility = localStorage.getItem('hb_toolbarVisibility') === 'true'; const Visibility = localStorage.getItem('hb_toolbarVisibility');
setToolsVisible(visibility); if (Visibility) setToolsVisible(Visibility === 'true');
}, []); }, []);
const handleZoomButton = (zoom)=>{ const handleZoomButton = (zoom)=>{
@@ -68,7 +69,7 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa
} 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.
let minDimRatio; let minDimRatio;
if(displayOptions.spread === 'active') if(displayOptions.spread === 'single')
minDimRatio = [...pages].reduce( minDimRatio = [...pages].reduce(
(minRatio, page)=>Math.min(minRatio, (minRatio, page)=>Math.min(minRatio,
iframeWidth / page.offsetWidth, iframeWidth / page.offsetWidth,
@@ -165,7 +166,7 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa
id='single-spread' id='single-spread'
className='tool' className='tool'
title='Single Page' title='Single Page'
onClick={()=>{handleOptionChange('spread', 'active');}} onClick={()=>{handleOptionChange('spread', 'single');}}
aria-checked={displayOptions.spread === 'single'} aria-checked={displayOptions.spread === 'single'}
><i className='fac single-spread' /></button> ><i className='fac single-spread' /></button>
<button role='radio' <button role='radio'

View File

@@ -175,6 +175,10 @@
opacity : 0; opacity : 0;
transition : all 0.2s ease; transition : all 0.2s ease;
} }
.toggleButton button i {
filter: drop-shadow(0 0 2px black) drop-shadow(0 0 1px black);
}
} }
} }
@@ -184,9 +188,4 @@
z-index : 5; z-index : 5;
display : flex; display : flex;
height : 100%; height : 100%;
button i {
filter: drop-shadow(0 0 2px black) drop-shadow(0 0 1px black);
}
} }