@@ -878,6 +878,42 @@ 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+ const fullyVisibleCount = Math . floor ( containerSize / itemSize ) ;
898+
899+ // Calculate how many items are currently in the visible range (inclusive)
900+ const currentVisibleCount = stopIndex - startIndex + 1 ;
901+
902+ // If we have more items visible than can fit fully, we have a partially visible tile at the end
903+ if ( currentVisibleCount > fullyVisibleCount ) {
904+ // Reduce stopIndex to exclude the partially visible tile
905+ return {
906+ startIndex,
907+ stopIndex : startIndex + fullyVisibleCount - 1
908+ } ;
909+ }
910+
911+ return {
912+ startIndex,
913+ stopIndex
914+ } ;
915+ }
916+
881917 /**
882918 * Toggle the toolbar visibility when tabbing into it.
883919 *
@@ -944,8 +980,41 @@ class Filmstrip extends PureComponent <IProps, IState> {
944980 */
945981 _onListItemsRendered ( { visibleStartIndex, visibleStopIndex } : {
946982 visibleStartIndex : number ; visibleStopIndex : number ; } ) {
947- const { dispatch } = this . props ;
948- const { startIndex, stopIndex } = this . _calculateIndices ( visibleStartIndex , visibleStopIndex ) ;
983+ const {
984+ dispatch,
985+ _currentLayout,
986+ _filmstripWidth,
987+ _filmstripHeight,
988+ _thumbnailWidth,
989+ _thumbnailHeight,
990+ _isVerticalFilmstrip
991+ } = this . props ;
992+
993+ let adjustedStartIndex = visibleStartIndex ;
994+ let adjustedStopIndex = visibleStopIndex ;
995+
996+ // Exclude partially visible tiles
997+ if ( _currentLayout === LAYOUTS . HORIZONTAL_FILMSTRIP_VIEW ) {
998+ const itemSize = _thumbnailWidth + TILE_HORIZONTAL_MARGIN ;
999+
1000+ ( { startIndex : adjustedStartIndex , stopIndex : adjustedStopIndex } = this . _excludePartiallyVisibleTiles (
1001+ visibleStartIndex ,
1002+ visibleStopIndex ,
1003+ _filmstripWidth ,
1004+ itemSize
1005+ ) ) ;
1006+ } else if ( _isVerticalFilmstrip ) {
1007+ const itemSize = _thumbnailHeight + TILE_VERTICAL_MARGIN ;
1008+
1009+ ( { startIndex : adjustedStartIndex , stopIndex : adjustedStopIndex } = this . _excludePartiallyVisibleTiles (
1010+ visibleStartIndex ,
1011+ visibleStopIndex ,
1012+ _filmstripHeight ,
1013+ itemSize
1014+ ) ) ;
1015+ }
1016+
1017+ const { startIndex, stopIndex } = this . _calculateIndices ( adjustedStartIndex , adjustedStopIndex ) ;
9491018
9501019 dispatch ( setVisibleRemoteParticipants ( startIndex , stopIndex ) ) ;
9511020 }
0 commit comments