mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-10 20:03:03 +00:00
"Removed '%' symbol handling from zoom input value"
This commit is contained in:
@@ -45,14 +45,13 @@ const ToolBar = ({ updateZoom, currentPage, onPageChange, totalPages }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleInputChange = (value, type) => {
|
const handleInputChange = (value, type) => {
|
||||||
// Remove the "%" symbol from the input value
|
const newValue = parseInt(value, 10);
|
||||||
const newValue = parseInt(value.replace('%', ''), 10);
|
|
||||||
|
|
||||||
// Check the type of input (zoom or page)
|
// Check the type of input (zoom or page)
|
||||||
if (type === 'zoom') {
|
if (type === 'zoom') {
|
||||||
// Check if zoom level is within the allowed range
|
// Check if zoom level is within the allowed range
|
||||||
if (newValue >= 10 && newValue <= 300) {
|
if (newValue >= 10 && newValue <= 300) {
|
||||||
setZoomInput(newValue + '%'); // Add "%" back to the value
|
setZoomInput(newValue);
|
||||||
}
|
}
|
||||||
} else if (type === 'page') {
|
} else if (type === 'page') {
|
||||||
// Check if page number is within the allowed range
|
// Check if page number is within the allowed range
|
||||||
@@ -83,7 +82,7 @@ const ToolBar = ({ updateZoom, currentPage, onPageChange, totalPages }) => {
|
|||||||
onChange={(e) => handleInputChange(e.target.value, 'zoom')}
|
onChange={(e) => handleInputChange(e.target.value, 'zoom')}
|
||||||
onBlur={(e) => {
|
onBlur={(e) => {
|
||||||
const newZoomLevel = parseInt(
|
const newZoomLevel = parseInt(
|
||||||
e.target.value.replace('%', ''),
|
e.target.value,
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
if (newZoomLevel !== state.zoomLevel) {
|
if (newZoomLevel !== state.zoomLevel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user