Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →For basic image controls, keep zoom and rotation in React state and apply them together in one CSS transform. This avoids one control accidentally replacing another. Use an accessible <img> with a useful alt description, and add panning or pinch gestures only if the viewer needs them.
Build zoom and rotation controls with React state
This component provides zoom-in, zoom-out, clockwise rotation, and reset buttons. It uses native buttons for keyboard activation and composes scale and rotation into a single transform.
As an Amazon Associate I earn from qualifying purchases.
import { useState } from 'react';
export default function ImageViewer() {
const [scale, setScale] = useState(1);
const [rotation, setRotation] = useState(0);
function reset() {
setScale(1);
setRotation(0);
}
return (
<section aria-label="Image viewer">
<div className="image-viewport">
<img
className="zoomable-image"
src="/images/example.jpg"
alt="A red bicycle parked beside a brick wall"
style={{ transform: `scale(${scale}) rotate(${rotation}deg)` }}
/>
</div>
<div className="image-controls">
<button type="button" onClick={() => setScale(value => Math.min(value + 0.2, 3))}>
Zoom in
</button>
<button type="button" onClick={() => setScale(value => Math.max(value - 0.2, 0.5))}>
Zoom out
</button>
<button type="button" onClick={() => setRotation(value => (value + 90) % 360)}>
Rotate clockwise
</button>
<button type="button" onClick={reset}>Reset
</div>
</section>
);
}
The sample clamps zoom between 0.5× and 3× so repeated clicks cannot shrink or enlarge the image without limit. Change those bounds and the 0.2 increment to suit the interface. Rotation advances in 90-degree steps; for free rotation, use a range input and store a number of degrees instead.
React documents src as the image URL and alt as its text alternative in the official image reference. React’s common components reference includes pointer event handlers if you later add drag interactions.
#1 Best Overall
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
Contain the image in a viewport
Clip overflow when the zoomed image should stay within a viewer frame. The image itself should remain responsive before transforms are applied:
.image-viewport {
width: min(100%, 48rem);
height: 32rem;
overflow: hidden;
display: grid;
place-items: center;
background: #f2f2f2;
}
.zoomable-image {
max-width: 100%;
max-height: 100%;
object-fit: contain;
transform-origin: center;
transition: transform 160ms ease;
}
.image-controls {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-top: 0.75rem;
}
A 90-degree rotation swaps the apparent width and height, so a portrait image may extend beyond a fixed viewport even at 1× scale. If that matters, allow scrolling, size the viewport for the rotated orientation, or add translation and fit-to-frame logic. Respect reduced-motion preferences if you use animated transitions.
Rank #2
- The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
- Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
- G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
- Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
- The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere
Keep transform values coordinated
CSS transform functions are order-sensitive. The example scales and then rotates; if you add pan offsets, decide whether translation should be in the viewer’s coordinate system or rotate with the image. Keep translation, scale, and rotation in state and produce one composed transform string. Do not assign a separate transform in a second handler or style rule, because it will replace the first transform rather than merge with it.
Add panning or pinch interactions when needed
For a viewer that needs drag-to-pan, mouse-wheel zoom, pinch gestures, bounds, or reset behavior, a dedicated library can handle more of the interaction state than a few buttons. The react-zoom-pan-pinch README shows an image inside TransformWrapper and TransformComponent and documents interaction options.
Rank #3
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
import { TransformComponent, TransformWrapper } from 'react-zoom-pan-pinch';
export default function PanZoomImage() {
return (
<TransformWrapper>
<TransformComponent>
<img src="/images/example.jpg" alt="A red bicycle parked beside a brick wall" />
</TransformComponent>
</TransformWrapper>
);
}
The reviewed 4.0.3 type declarations expose zoom, reset, transform, scale, position, wheel, pinch, and panning configuration, but do not show a dedicated rotation property or handler. Add rotation separately and verify that its wrapper and CSS compose correctly with the library’s transform. Check the API for the version actually installed; declarations for a different major version may not match your project.
Choose custom controls or a library
| Consideration | React state and CSS | Zoom/pan library |
|---|---|---|
| Best fit | A few explicit buttons and a simple viewer. | Wheel, pinch, drag, bounds, callbacks, and coordinated reset behavior. |
| Rotation | Directly controlled by your composed transform. | Reviewed 4.0.3 declarations do not establish a built-in rotation API; implement and test rotation separately. |
| Accessibility | You control button labels, keyboard behavior, and image alternative text. | Verify the library’s resulting controls and gestures meet your interface’s accessibility needs. |
| Maintenance | You own gesture handling, bounds, and state coordination if you add them. | You take on a dependency and its version-specific API surface. |
| Performance evidence | No comparative measurements are established by the cited sources. | No comparative measurements or bundle-size figures are established by the cited sources. |
Handle touch, keyboard, and image semantics
- Use actual
<button>elements for controls, with descriptive labels such as “Zoom in,” “Rotate clockwise,” and “Reset.” - Keep meaningful alternative text on the image; do not use the controls’ labels as the image description.
- For touch panning or pinch zoom, avoid assuming that mouse behavior transfers cleanly. Test the gestures and viewport bounds on the devices and browsers your app supports.
- Decide whether dragging beyond the image boundary should be possible. Clamping translation keeps the image in view but requires calculating bounds as scale and rotation change.
Troubleshooting common problems
Zooming resets rotation, or rotation resets zoom
Both handlers are probably writing competing transform values. Store scale and rotation independently, then render them in the same transform declaration.
Rank #4
- Computer mouse for easily navigating a computer interface; click, scroll, and more
- USB-A wired connection; if existing device only supports USB-C, an additional adapter will be required
- High-definition (1000 dpi) optical tracking ensures responsive cursor control for precise tracking and easy text selection
- 3 buttons offer effortless fingertip control
- Plug-and-go ready for instant use
The image disappears or gets clipped after rotation
Rotation can make the rendered bounds larger than the unrotated image box. Check the viewport’s fixed dimensions and overflow setting; allow scrolling or adjust the available space if the rotated image must remain fully visible.
Free tools Windows power users keep installed
One-click scans. No signup required.
Library controls work, but rotation does not
Do not assume zoom/pan support implies rotation support. The reviewed 4.0.3 declarations show no dedicated rotation API; add a compatible rotation layer and test how it interacts with the wrapper’s own transform.
Best Value
- 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
- 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
- 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
- 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
- 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.
Examples do not match the installed library
Confirm the installed package version and consult its corresponding API. The declarations reviewed for 4.0.3 differ in scope from what can safely be inferred from another version.
Or skip the browser setup
If the goal is to capture a webpage rather than build an interactive image viewer, ScreenshotNeo returns a screenshot or PDF from one GET request. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000.
See the ScreenshotNeo API documentation for options. This cURL example saves a webpage screenshot as WebP:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchcurl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for 1,000 free screenshots a month, with no card required.
Quick Recap
Sources
- React: <img>
- React: Common components
- react-zoom-pan-pinch README
- react-zoom-pan-pinch 4.0.3 declarations
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




