Sfoglia il codice sorgente

Code refactoring: simplified implementation of centeredBalloonPositionForLongWidgets().

Aleksander Nowodzinski 5 anni fa
parent
commit
0a1ef91237
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      packages/ckeditor5-widget/src/utils.js

+ 1 - 1
packages/ckeditor5-widget/src/utils.js

@@ -391,7 +391,7 @@ export function centeredBalloonPositionForLongWidgets( widgetRect, balloonRect )
 	// like, for instance, "south west" or whatever. Just try to keep the balloon in the middle of the visible area of
 	// the widget for as long as it is possible. If the widgets becomes invisible (because cropped by the viewport),
 	// just... place the balloon in the middle of it (because why not?).
-	const targetRect = viewportWidgetInsersectionRect.width > 0 ? viewportWidgetInsersectionRect : widgetRect;
+	const targetRect = viewportWidgetInsersectionRect || widgetRect;
 	const left = targetRect.left + targetRect.width / 2 - balloonRect.width / 2;
 
 	// Case (C).