Is it possible to make it fully controlled?
See original GitHub issueSomething like this
import React, { Component } from "react";
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
class Example extends Component {
const [state, setState] = useState([0, 0, 1]);
render() {
return (
<TransformWrapper
positionX={state[0]}
positionY={state[1]}
scale={state[2]}
onChange={(newPositionX, newPositionY, newZoom) => setState([newPositionX, newPositionY, newZoom])}
>
{({ zoomIn, zoomOut, resetTransform, ...rest }) => (
<React.Fragment>
<div className="tools">
<button onClick={zoomIn}>+</button>
<button onClick={zoomOut}>-</button>
<button onClick={resetTransform}>x</button>
</div>
<TransformComponent>
<img src="image.jpg" alt="test" />
<div>Example text</div>
</TransformComponent>
</React.Fragment>
)}
</TransformWrapper>
);
}
}
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Experimental implementation of fully controlled dephasing ...
Here, we demonstrate full experimental control of dephasing allowing us to implement arbitrary decoherence dynamics of a qubit.
Read more >321.366 Acts prohibited on fully controlled-access facilities.
1. It is unlawful for a person, except a person operating highway maintenance equipment or an authorized emergency vehicle, to do any of...
Read more >Wireless Fan Fully Controlled Using Your Phone! - Instructables
In this project, we will be creating a wireless fan that you can fully control using your phone over WiFi. You can rotate...
Read more >CDC Updates and Shortens Recommended Isolation and ...
Individuals who have received their booster shot do not need to quarantine following an exposure, but should wear a mask for 10 days...
Read more >Create forms that users complete or print in Word
Create forms that users complete or print in Word · Start with a form template · Start with a blank document · Insert...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What do you need? You can use onZoom and onPanning to get changes
and to set transform externally you can use “useRef”
Hi, I’ve tested the new API and it works well.
Here’s my sandbox link just for showing how to use a external state to unify the control if there were another controller.