@@ -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 ) ) return false ;
1960
+ if ( ! ( source instanceof Applet . Applet ) || ! this . _dragPlaceholder ) 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
@@ -1968,31 +1968,20 @@ PanelZoneDNDHandler.prototype = {
1968
1968
}
1969
1969
}
1970
1970
1971
- let children = this . _panelZone . get_children ( ) ;
1972
1971
let curAppletPos = 0 ;
1973
- let insertAppletPos = - 1 ;
1974
-
1975
- const {
1976
- panel : { panelId : sourceAppletPanel } ,
1977
- locationLabel : sourceAppletLocation ,
1978
- } = source . actor . _applet ;
1972
+ let insertAppletPos = 0 ;
1979
1973
1980
- for ( let i = 0 , len = children . length ; i < len ; i ++ ) {
1981
- if ( children [ i ] . _delegate instanceof Applet . Applet ) {
1982
- children [ i ] . _applet . _newOrder = curAppletPos ;
1974
+ this . _panelZone . get_children ( ) . forEach ( child => {
1975
+ if ( child . _delegate instanceof Applet . Applet && child . _delegate !== source . actor . _applet ) {
1976
+ child . _applet . _newOrder = curAppletPos ;
1983
1977
curAppletPos ++ ;
1984
- } else if ( children [ i ] == this . _dragPlaceholder . actor ) {
1978
+ } else if ( child == this . _dragPlaceholder . actor ) {
1985
1979
insertAppletPos = curAppletPos ;
1986
1980
curAppletPos ++ ;
1987
1981
}
1988
- }
1982
+ } ) ;
1989
1983
1990
- const isSameLocation = (
1991
- sourceAppletPanel === this . _panelId
1992
- && sourceAppletLocation === this . _zoneString
1993
- && insertAppletPos === - 1
1994
- ) ;
1995
- if ( ! isSameLocation ) source . actor . _applet . _newOrder = insertAppletPos === - 1 ? 0 : insertAppletPos ;
1984
+ source . actor . _applet . _newOrder = insertAppletPos ;
1996
1985
source . actor . _applet . _newPanelLocation = this . _panelZone ;
1997
1986
source . actor . _applet . _zoneString = this . _zoneString ;
1998
1987
source . actor . _applet . _newPanelId = this . _panelId ;
@@ -2012,9 +2001,7 @@ PanelZoneDNDHandler.prototype = {
2012
2001
}
2013
2002
2014
2003
if ( sourcebox . has_style_class_name ( "panelRight" ) || sourcebox . has_style_class_name ( "panelLeft" ) ) {
2015
- children = sourcebox . get_children ( ) ;
2016
-
2017
- if ( children . length == 0 ) { /* put back some minimum space if the source box is now empty */
2004
+ if ( sourcebox . get_children ( ) . length == 0 ) { /* put back some minimum space if the source box is now empty */
2018
2005
if ( sourcebox . get_parent ( ) . _delegate . is_vertical ) {
2019
2006
let height = sourcebox . get_height ( ) ;
2020
2007
if ( height < EDIT_MODE_MIN_BOX_SIZE * global . ui_scale )
0 commit comments