File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ export const initialSetup: LibrarySetup = {
3434 velocityDisabled : false ,
3535 lockAxisX : false ,
3636 lockAxisY : false ,
37+ allowLeftClickPan : true ,
38+ allowMiddleClickPan : true ,
39+ allowRightClickPan : true ,
3740 activationKeys : [ ] ,
3841 excluded : [ ] ,
3942 } ,
Original file line number Diff line number Diff line change @@ -208,6 +208,10 @@ 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 ;
214+
211215 event . preventDefault ( ) ;
212216 event . stopPropagation ( ) ;
213217
Original file line number Diff line number Diff line change @@ -81,6 +81,9 @@ export type ReactZoomPanPinchProps = {
8181 velocityDisabled ?: boolean ;
8282 lockAxisX ?: boolean ;
8383 lockAxisY ?: boolean ;
84+ allowLeftClickPan ?: boolean ;
85+ allowMiddleClickPan ?: boolean ;
86+ allowRightClickPan ?: boolean ;
8487 activationKeys ?: string [ ] ;
8588 excluded ?: string [ ] ;
8689 } ;
Original file line number Diff line number Diff line change @@ -248,6 +248,24 @@ export const wrapperPropsTable: ComponentProps = {
248248 description :
249249 "Disable the panning feature for the Y axis (prevents vertical panning)." ,
250250 } ,
251+ allowLeftClickPan : {
252+ type : [ "boolean" ] ,
253+ defaultValue : String ( initialSetup . panning . allowLeftClickPan ) ,
254+ description :
255+ "Allow left click to initiate panning" ,
256+ } ,
257+ allowMiddleClickPan : {
258+ type : [ "boolean" ] ,
259+ defaultValue : String ( initialSetup . panning . allowMiddleClickPan ) ,
260+ description :
261+ "Allow middle click to initiate panning" ,
262+ } ,
263+ allowRightClickPan : {
264+ type : [ "boolean" ] ,
265+ defaultValue : String ( initialSetup . panning . allowRightClickPan ) ,
266+ description :
267+ "Allow right click to initiate panning" ,
268+ } ,
251269 activationKeys : {
252270 type : [ "string[]" ] ,
253271 defaultValue : String ( initialSetup . panning . activationKeys ) ,
You can’t perform that action at this time.
0 commit comments