@@ -58,6 +58,7 @@ const Card = (stack, targetElement, prepend) => {
58
58
let throwDirectionToEventName ;
59
59
let throwOutDistance ;
60
60
let throwWhere ;
61
+ let appendedDuringMouseDown ;
61
62
62
63
const construct = ( ) => {
63
64
card = { } ;
@@ -194,10 +195,16 @@ const Card = (stack, targetElement, prepend) => {
194
195
} ) ( ) ;
195
196
} else {
196
197
targetElement . addEventListener ( 'mousedown' , ( ) => {
198
+ appendedDuringMouseDown = Card . appendToParent ( targetElement ) || appendedDuringMouseDown ;
197
199
eventEmitter . trigger ( 'panstart' ) ;
198
200
} ) ;
199
201
200
202
targetElement . addEventListener ( 'mouseup' , ( ) => {
203
+ if ( appendedDuringMouseDown ) {
204
+ targetElement . click ( ) ;
205
+ appendedDuringMouseDown = false ;
206
+ }
207
+
201
208
if ( isDraging && ! isPanning ) {
202
209
eventEmitter . trigger ( 'dragend' , {
203
210
target : targetElement
@@ -453,11 +460,14 @@ Card.appendToParent = (element) => {
453
460
const parentNode = element . parentNode ;
454
461
const siblings = elementChildren ( parentNode ) ;
455
462
const targetIndex = siblings . indexOf ( element ) ;
463
+ const appended = targetIndex + 1 !== siblings . length ;
456
464
457
- if ( targetIndex + 1 !== siblings . length ) {
465
+ if ( appended ) {
458
466
parentNode . removeChild ( element ) ;
459
467
parentNode . appendChild ( element ) ;
460
468
}
469
+
470
+ return appended ;
461
471
} ;
462
472
463
473
/**
0 commit comments