@@ -53,7 +53,7 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
5353 protected helperContainment : HTMLElement ;
5454 /** @internal #1541 can't have {passive: true} on Safari as otherwise it reverts animate back to old location on drop */
5555 protected static dragEventListenerOption = true ; // DDUtils.isEventSupportPassiveOption ? { capture: true, passive: true } : true;
56- /** @internal */
56+ /** @internal properties we change during dragging, and restore back */
5757 protected static originStyleProp = [ 'transition' , 'pointerEvents' , 'position' ,
5858 'left' , 'top' , 'opacity' , 'zIndex' , 'width' , 'height' , 'willChange' , 'min-width' ] ;
5959
@@ -232,19 +232,15 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
232232
233233 /** @internal */
234234 protected _removeHelperStyle ( ) : DDDraggable {
235+ let node = ( this . helper as GridItemHTMLElement ) ?. gridstackNode ;
235236 // don't bother restoring styles if we're gonna remove anyway...
236- let node = this . helper ? ( this . helper as GridItemHTMLElement ) . gridstackNode : undefined ;
237237 if ( this . dragElementOriginStyle && ( ! node || ! node . _isAboutToRemove ) ) {
238- DDDraggable . originStyleProp . forEach ( prop => {
239- this . helper . style [ prop ] = this . dragElementOriginStyle [ prop ] || null ;
240- } ) ;
238+ let helper = this . helper ;
239+ DDDraggable . originStyleProp . forEach ( prop => helper . style [ prop ] = this . dragElementOriginStyle [ prop ] || null ) ;
241240 // show up instantly otherwise we animate to off the grid when switching back to 'absolute' from 'fixed'
242- this . helper . style . transition = 'none' ;
243- setTimeout ( ( ) => {
244- if ( this . helper ) {
245- this . helper . style . transition = this . dragElementOriginStyle [ 'transition' ] ; // recover animation
246- }
247- } , 0 ) ;
241+ helper . style . transition = 'none' ;
242+ let transition = this . dragElementOriginStyle [ 'transition' ] || null ;
243+ setTimeout ( ( ) => helper . style . transition = transition , 0 ) ; // recover animation from saved vars
248244 }
249245 delete this . dragElementOriginStyle ;
250246 return this ;
0 commit comments