@@ -878,6 +878,43 @@ class Filmstrip extends PureComponent <IProps, IState> {
878878 } ;
879879 }
880880
881+ /**
882+ * Adjusts indices to exclude partially visible tiles from the list.
883+ *
884+ * @param {number } startIndex - The start index from react-window.
885+ * @param {number } stopIndex - The stop index from react-window.
886+ * @param {number } containerSize - The width or height of the filmstrip container.
887+ * @param {number } itemSize - The width or height of each item including margin.
888+ * @returns {Object }
889+ */
890+ _excludePartiallyVisibleTiles (
891+ startIndex : number ,
892+ stopIndex : number ,
893+ containerSize : number ,
894+ itemSize : number
895+ ) {
896+ // Calculate how many items can fit fully in the container
897+ // Ensure at least 1 if there are any visible items
898+ const fullyVisibleCount = Math . max ( 1 , Math . floor ( containerSize / itemSize ) ) ;
899+
900+ // Calculate how many items are currently in the visible range (inclusive)
901+ const currentVisibleCount = stopIndex - startIndex + 1 ;
902+
903+ // If we have more items visible than can fit fully, we have a partially visible tile at the end
904+ if ( currentVisibleCount > fullyVisibleCount ) {
905+ // Reduce stopIndex to exclude the partially visible tile
906+ return {
907+ startIndex,
908+ stopIndex : startIndex + fullyVisibleCount - 1
909+ } ;
910+ }
911+
912+ return {
913+ startIndex,
914+ stopIndex
915+ } ;
916+ }
917+
881918 /**
882919 * Toggle the toolbar visibility when tabbing into it.
883920 *
@@ -944,8 +981,31 @@ class Filmstrip extends PureComponent <IProps, IState> {
944981 */
945982 _onListItemsRendered ( { visibleStartIndex, visibleStopIndex } : {
946983 visibleStartIndex : number ; visibleStopIndex : number ; } ) {
947- const { dispatch } = this . props ;
948- const { startIndex, stopIndex } = this . _calculateIndices ( visibleStartIndex , visibleStopIndex ) ;
984+ const {
985+ dispatch,
986+ _currentLayout,
987+ _filmstripWidth,
988+ _filmstripHeight,
989+ _thumbnailWidth,
990+ _thumbnailHeight,
991+ _isVerticalFilmstrip
992+ } = this . props ;
993+
994+ // Exclude partially visible tiles
995+ const isHorizontal = _currentLayout === LAYOUTS . HORIZONTAL_FILMSTRIP_VIEW ;
996+ const itemSize = isHorizontal
997+ ? _thumbnailWidth + TILE_HORIZONTAL_MARGIN
998+ : _thumbnailHeight + TILE_VERTICAL_MARGIN ;
999+ const containerSize = isHorizontal ? _filmstripWidth : _filmstripHeight ;
1000+
1001+ const { startIndex : adjustedStartIndex , stopIndex : adjustedStopIndex } = this . _excludePartiallyVisibleTiles (
1002+ visibleStartIndex ,
1003+ visibleStopIndex ,
1004+ containerSize ,
1005+ itemSize
1006+ ) ;
1007+
1008+ const { startIndex, stopIndex } = this . _calculateIndices ( adjustedStartIndex , adjustedStopIndex ) ;
9491009
9501010 dispatch ( setVisibleRemoteParticipants ( startIndex , stopIndex ) ) ;
9511011 }
0 commit comments