@@ -1957,7 +1957,7 @@ PanelZoneDNDHandler.prototype = {
19571957    acceptDrop : function ( source ,  actor ,  x ,  y ,  time )  { 
19581958        this . _origAppletCenters  =  null ; 
19591959
1960-         if  ( ! ( source  instanceof  Applet . Applet )    ||   ! this . _dragPlaceholder )  return  false ; 
1960+         if  ( ! ( source  instanceof  Applet . Applet ) )  return  false ; 
19611961
19621962        //  We want to ensure that applets placed in a panel can be shown correctly 
19631963        //  If the applet is of type Icon Applet then should be fine 
@@ -1969,10 +1969,15 @@ PanelZoneDNDHandler.prototype = {
19691969        } 
19701970
19711971        let  curAppletPos  =  0 ; 
1972-         let  insertAppletPos  =  0 ; 
1972+         let  insertAppletPos  =  - 1 ; 
1973+ 
1974+         const  { 
1975+             panel : {  panelId : sourceAppletPanel  } , 
1976+             locationLabel : sourceAppletLocation , 
1977+         }  =  source . actor . _applet ; 
19731978
19741979        this . _panelZone . get_children ( ) . forEach ( child  =>  { 
1975-             if  ( child . _delegate  instanceof  Applet . Applet   &&   child . _delegate   !==   source . actor . _applet ) { 
1980+             if  ( child . _delegate  instanceof  Applet . Applet ) { 
19761981                child . _applet . _newOrder  =  curAppletPos ; 
19771982                curAppletPos ++ ; 
19781983            }  else  if  ( child  ==  this . _dragPlaceholder . actor ) { 
@@ -1981,7 +1986,12 @@ PanelZoneDNDHandler.prototype = {
19811986            } 
19821987        } ) ; 
19831988
1984-         source . actor . _applet . _newOrder  =  insertAppletPos ; 
1989+         const  isSameLocation  =  ( 
1990+             sourceAppletPanel  ===  this . _panelId 
1991+             &&  sourceAppletLocation  ===  this . _zoneString 
1992+             &&  insertAppletPos  ===  - 1 
1993+         ) ; 
1994+         if  ( ! isSameLocation )  source . actor . _applet . _newOrder  =  insertAppletPos  ===  - 1  ? 0  : insertAppletPos ; 
19851995        source . actor . _applet . _newPanelLocation  =  this . _panelZone ; 
19861996        source . actor . _applet . _zoneString  =  this . _zoneString ; 
19871997        source . actor . _applet . _newPanelId  =  this . _panelId ; 
0 commit comments