File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export const TransformComponent: React.FC<Props> = ({
2424 wrapperProps = { } ,
2525 contentProps = { } ,
2626} : Props ) => {
27- const { init } = useContext ( Context ) ;
27+ const { init, cleanupWindowEvents } = useContext ( Context ) ;
2828
2929 const wrapperRef = useRef < HTMLDivElement | null > ( null ) ;
3030 const contentRef = useRef < HTMLDivElement | null > ( null ) ;
@@ -33,9 +33,12 @@ export const TransformComponent: React.FC<Props> = ({
3333 const wrapper = wrapperRef . current ;
3434 const content = contentRef . current ;
3535 if ( wrapper !== null && content !== null && init ) {
36- init ( wrapper , content ) ;
36+ init ?. ( wrapper , content ) ;
3737 }
3838 // eslint-disable-next-line react-hooks/exhaustive-deps
39+ return ( ) => {
40+ cleanupWindowEvents ?.( ) ;
41+ } ;
3942 } , [ ] ) ;
4043
4144 return (
Original file line number Diff line number Diff line change @@ -32,9 +32,6 @@ export const TransformWrapper = React.forwardRef(
3232
3333 useEffect ( ( ) => {
3434 instance . update ( props ) ;
35- return ( ) => {
36- instance . cleanupWindowEvents ( ) ;
37- } ;
3835 } , [ instance , props ] ) ;
3936
4037 return < Context . Provider value = { instance } > { content } </ Context . Provider > ;
Original file line number Diff line number Diff line change @@ -170,26 +170,15 @@ export function getMouseBoundedPosition(
170170 paddingY = paddingValueY ;
171171 }
172172
173- const rubberbandX = rubberbandIfOutOfBounds (
174- positionX ,
175- minPositionX ,
176- maxPositionX ,
177- ) ;
178- const rubberbandY = rubberbandIfOutOfBounds (
179- positionY ,
180- minPositionY ,
181- maxPositionY ,
182- ) ;
183-
184173 const x = boundLimiter (
185- rubberbandX ,
174+ positionX ,
186175 minPositionX - paddingX ,
187176 maxPositionX + paddingX ,
188177 limitToBounds ,
189178 ) ;
190179
191180 const y = boundLimiter (
192- rubberbandY ,
181+ positionY ,
193182 minPositionY - paddingY ,
194183 maxPositionY + paddingY ,
195184 limitToBounds ,
Original file line number Diff line number Diff line change @@ -208,9 +208,9 @@ export class ZoomPanPinch {
208208 const keysPressed = this . isPressingKeys ( this . setup . panning . activationKeys ) ;
209209 if ( ! keysPressed ) return ;
210210
211- if ( event . button == 0 && ! this . setup . panning . allowLeftClickPan ) return ;
212- if ( event . button == 1 && ! this . setup . panning . allowMiddleClickPan ) return ;
213- if ( event . button == 2 && ! this . setup . panning . allowRightClickPan ) return ;
211+ if ( event . button = == 0 && ! this . setup . panning . allowLeftClickPan ) return ;
212+ if ( event . button = == 1 && ! this . setup . panning . allowMiddleClickPan ) return ;
213+ if ( event . button = == 2 && ! this . setup . panning . allowRightClickPan ) return ;
214214
215215 event . preventDefault ( ) ;
216216 event . stopPropagation ( ) ;
You can’t perform that action at this time.
0 commit comments