@@ -12,6 +12,7 @@ import {
12
12
13
13
const DRAG_THRESHOLD = 10
14
14
15
+ let epoch = 0
15
16
let pressed = false
16
17
let dragging = false
17
18
let startX = 0
@@ -37,11 +38,13 @@ interface ShadowBox {
37
38
}
38
39
39
40
export function resize (
41
+ new_epoch : number ,
40
42
dx : number ,
41
43
dy : number ,
42
44
dragging : boolean ,
43
45
hasContextmenu : boolean ,
44
46
) {
47
+ epoch = new_epoch
45
48
function adaptWindowSize ( reserveSpaceForContextmenu : boolean ) {
46
49
let {
47
50
anchorTop,
@@ -85,7 +88,7 @@ export function resize(
85
88
const { borderRadius, borderWidth } = getComputedStyle ( panel )
86
89
const bWidth = Math . max ( ...borderWidth . split ( ' ' ) . map ( Number . parseFloat ) )
87
90
const pRadius = Math . max ( ...borderRadius . split ( ' ' ) . map ( Number . parseFloat ) )
88
- window . fcitx . _resize ( dx , dy , anchorTop , anchorRight , anchorBottom , anchorLeft , pRect . top , pRect . right , pRect . bottom , pRect . left , pRadius , bWidth , right , bottom , dragging )
91
+ window . fcitx . _resize ( epoch , dx , dy , anchorTop , anchorRight , anchorBottom , anchorLeft , pRect . top , pRect . right , pRect . bottom , pRect . left , pRadius , bWidth , right , bottom , dragging )
89
92
}
90
93
adaptWindowSize ( hasContextmenu )
91
94
if ( ! dragging ) {
@@ -165,7 +168,7 @@ export function showContextmenu(x: number, y: number, index: number, actions: Ca
165
168
contextmenu . style . top = `${ y } px`
166
169
contextmenu . style . left = `${ x } px`
167
170
contextmenu . style . display = 'block'
168
- resize ( 0 , 0 , false , true )
171
+ resize ( epoch , 0 , 0 , false , true )
169
172
}
170
173
171
174
export function hideContextmenu ( ) {
@@ -207,7 +210,7 @@ receiver.addEventListener('mousemove', (e) => {
207
210
dX += dx
208
211
dY += dy
209
212
dragOffset = Math . max ( dragOffset , dX * dX + dY * dY )
210
- resize ( dx , dy , true , false )
213
+ resize ( epoch , dx , dy , true , false )
211
214
} )
212
215
213
216
receiver . addEventListener ( 'mouseup' , ( e ) => {
0 commit comments