File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,10 @@ export class ElementChatComponent implements OnInit, OnDestroy {
6262
6363 elements . forEach ( element => {
6464 element . addEventListener ( 'mousedown' , ( event : MouseEvent ) => {
65+ if ( event . button !== 0 ) {
66+ return ;
67+ }
68+
6569 event . stopPropagation ( ) ;
6670 event . preventDefault ( ) ;
6771 const offsetY = dragBox . getBoundingClientRect ( ) . top ;
@@ -70,6 +74,7 @@ export class ElementChatComponent implements OnInit, OnDestroy {
7074 clientOffset . clientY = event . clientY ;
7175 this . isLongPress = false ;
7276
77+ // @ts -ignore
7378 this . longPressTimeout = setTimeout ( ( ) => {
7479 this . isLongPress = true ;
7580 document . onmousemove = ( ev : MouseEvent ) => {
@@ -89,14 +94,14 @@ export class ElementChatComponent implements OnInit, OnDestroy {
8994 ev . preventDefault ( ) ;
9095 ev . stopPropagation ( ) ;
9196 } ;
92- } , 300 ) ; // 300ms 作为长按检测时间
97+ } , 300 ) ;
9398
9499 document . onmouseup = ( ) => {
95100 document . onmousemove = null ;
96101 document . onmouseup = null ;
97102
98103 if ( ! this . isLongPress ) {
99- clearTimeout ( this . longPressTimeout ) ; // 确保清除长按检测
104+ clearTimeout ( this . longPressTimeout ) ;
100105 this . isShow = ! this . isShow ;
101106 }
102107
You can’t perform that action at this time.
0 commit comments