@@ -1957,7 +1957,7 @@ PanelZoneDNDHandler.prototype = {
1957
1957
acceptDrop : function ( source , actor , x , y , time ) {
1958
1958
this . _origAppletCenters = null ;
1959
1959
1960
- if ( ! ( source instanceof Applet . Applet ) || ! this . _dragPlaceholder ) return false ;
1960
+ if ( ! ( source instanceof Applet . Applet ) ) return false ;
1961
1961
1962
1962
// We want to ensure that applets placed in a panel can be shown correctly
1963
1963
// If the applet is of type Icon Applet then should be fine
@@ -1969,10 +1969,15 @@ PanelZoneDNDHandler.prototype = {
1969
1969
}
1970
1970
1971
1971
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 ;
1973
1978
1974
1979
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 ) {
1976
1981
child . _applet . _newOrder = curAppletPos ;
1977
1982
curAppletPos ++ ;
1978
1983
} else if ( child == this . _dragPlaceholder . actor ) {
@@ -1981,7 +1986,12 @@ PanelZoneDNDHandler.prototype = {
1981
1986
}
1982
1987
} ) ;
1983
1988
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 ;
1985
1995
source . actor . _applet . _newPanelLocation = this . _panelZone ;
1986
1996
source . actor . _applet . _zoneString = this . _zoneString ;
1987
1997
source . actor . _applet . _newPanelId = this . _panelId ;
0 commit comments