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 {
62
62
63
63
elements . forEach ( element => {
64
64
element . addEventListener ( 'mousedown' , ( event : MouseEvent ) => {
65
+ if ( event . button !== 0 ) {
66
+ return ;
67
+ }
68
+
65
69
event . stopPropagation ( ) ;
66
70
event . preventDefault ( ) ;
67
71
const offsetY = dragBox . getBoundingClientRect ( ) . top ;
@@ -70,6 +74,7 @@ export class ElementChatComponent implements OnInit, OnDestroy {
70
74
clientOffset . clientY = event . clientY ;
71
75
this . isLongPress = false ;
72
76
77
+ // @ts -ignore
73
78
this . longPressTimeout = setTimeout ( ( ) => {
74
79
this . isLongPress = true ;
75
80
document . onmousemove = ( ev : MouseEvent ) => {
@@ -89,14 +94,14 @@ export class ElementChatComponent implements OnInit, OnDestroy {
89
94
ev . preventDefault ( ) ;
90
95
ev . stopPropagation ( ) ;
91
96
} ;
92
- } , 300 ) ; // 300ms 作为长按检测时间
97
+ } , 300 ) ;
93
98
94
99
document . onmouseup = ( ) => {
95
100
document . onmousemove = null ;
96
101
document . onmouseup = null ;
97
102
98
103
if ( ! this . isLongPress ) {
99
- clearTimeout ( this . longPressTimeout ) ; // 确保清除长按检测
104
+ clearTimeout ( this . longPressTimeout ) ;
100
105
this . isShow = ! this . isShow ;
101
106
}
102
107
You can’t perform that action at this time.
0 commit comments