0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 16:12:37 +00:00

Set preview zoom to update with onChange

Commented out the existing onChange handler, switched the onMouseUp that actually applies the zoom to onChange.
This commit is contained in:
Gazook89
2024-08-17 13:59:58 -05:00
parent ee4eb19f1e
commit e9e49e39fb

View File

@@ -78,8 +78,8 @@ const ToolBar = ({ updateZoom, currentPage, onPageChange, totalPages })=>{
max={maxZoom}
step={zoomStep}
value={state.zoomInput}
onChange={(e)=>handleInputChange(e.target.value, 'zoom')}
onMouseUp={(e)=>{
// onChange={(e)=>handleInputChange(e.target.value, 'zoom')}
onChange={(e)=>{
const newZoomLevel = parseInt(e.target.value, 10);
if(newZoomLevel !== state.zoomLevel) {
setState((prevState)=>({
@@ -92,15 +92,7 @@ const ToolBar = ({ updateZoom, currentPage, onPageChange, totalPages })=>{
}}
/>
<datalist id='zoomLevels'>
{Array.from(
{
length :
Math.floor((maxZoom - minZoom) / zoomStep) + 1,
},
(_, i)=>minZoom + i * zoomStep
).map((option)=>(
<option key={option} value={option} />
))}
<option value='100' />
</datalist>
</div>