@@ -14,6 +14,8 @@ const zoomableMap = {
1414 'sw' : 'bl'
1515}
1616
17+ const MAIN_BUTTON = 0 ;
18+
1719export default class Rect extends PureComponent {
1820 static propTypes = {
1921 styles : PropTypes . object ,
@@ -35,6 +37,7 @@ export default class Rect extends PureComponent {
3537
3638 // Drag
3739 startDrag = ( e ) => {
40+ if ( e . button !== MAIN_BUTTON ) return
3841 let { clientX : startX , clientY : startY } = e
3942 this . props . onDragStart && this . props . onDragStart ( )
4043 this . _isMouseDown = true
@@ -61,7 +64,7 @@ export default class Rect extends PureComponent {
6164
6265 // Rotate
6366 startRotate = ( e ) => {
64- if ( e . button !== 0 ) return
67+ if ( e . button !== MAIN_BUTTON ) return
6568 const { clientX, clientY } = e
6669 const { styles : { transform : { rotateAngle : startAngle } } } = this . props
6770 const rect = this . $element . getBoundingClientRect ( )
@@ -99,7 +102,7 @@ export default class Rect extends PureComponent {
99102
100103 // Resize
101104 startResize = ( e , cursor ) => {
102- if ( e . button !== 0 ) return
105+ if ( e . button !== MAIN_BUTTON ) return
103106 document . body . style . cursor = cursor
104107 const { styles : { position : { centerX, centerY } , size : { width, height } , transform : { rotateAngle } } } = this . props
105108 const { clientX : startX , clientY : startY } = e
0 commit comments