@@ -400,6 +400,7 @@ function windowFitsInSnapGroup(client){
400400
401401 /// check rest of windows in that group
402402 const snappedWindows = snappedWindowGroups [ indexOfGroup ] . windows ;
403+ let intercectsWithAnyOtherWindow = false ;
403404
404405 for ( let i = 0 , l = snappedWindows . length ; i < l ; i ++ ) {
405406 const w = getClientFromId ( snappedWindows [ i ] ) ;
@@ -427,6 +428,20 @@ function windowFitsInSnapGroup(client){
427428 snappedWindowGroups [ indexOfGroup ] . windows . push ( client . internalId ) ;
428429 return true ;
429430 }
431+
432+ /// check if windows intercept
433+ if ( intercectsWithAnyOtherWindow == false ) {
434+ if ( windowRectanglesIntersect ( w . x , w . y , w . x + w . width , w . y + w . height , client . x , client . y , client . x + client . width , client . y + client . height ) ) {
435+ intercectsWithAnyOtherWindow = true ;
436+ }
437+ }
438+ }
439+
440+ /// if window does not intercect with other windows in the group, let it in
441+ if ( intercectsWithAnyOtherWindow == false ) {
442+ snappedWindowGroups [ indexOfGroup ] . windows . push ( client . internalId ) ;
443+ AssistManager . preventAssistFromShowing ( ) ;
444+ return true ;
430445 }
431446
432447 return false ;
@@ -480,3 +495,14 @@ function setOneTimeTimeout(cb, delayTime){
480495 } ) ;
481496 timer . start ( ) ;
482497}
498+
499+ function windowRectanglesIntersect (
500+ minAx , minAy , maxAx , maxAy ,
501+ minBx , minBy , maxBx , maxBy ) {
502+ const aLeftOfB = maxAx < minBx ;
503+ const aRightOfB = minAx > maxBx ;
504+ const aAboveB = minAy > maxBy ;
505+ const aBelowB = maxAy < minBy ;
506+
507+ return maxAx > minBx && minAx < maxBx && minAy < maxBy && maxAy > minBy ;
508+ }
0 commit comments