< Summary

Class:CarouselComponentView
Assembly:UIComponents
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/UIComponents/Scripts/Components/Carousel/CarouselComponentView.cs
Covered lines:189
Uncovered lines:53
Coverable lines:242
Total lines:646
Line coverage:78% (189 of 242)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CarouselComponentView()0%110100%
Awake()0%110100%
Start()0%220100%
Configure(...)0%110100%
RefreshControl()0%22090.91%
OnScreenSizeChanged()0%110100%
Dispose()0%110100%
SetSpaceBetweenItems(...)0%2.032080%
SetTimeBetweenItems(...)0%2100%
SetAnimationTransitionTime(...)0%2100%
SetAnimationCurve(...)0%2100%
SetBackgroundColor(...)0%2.262060%
SetManualControlsActive(...)0%6.076087.5%
SetItems(...)0%6200%
SetItems(...)0%220100%
AddItem(...)0%110100%
RemoveItem(...)0%220100%
GetItems()0%2100%
ExtractItems()0%220100%
RemoveItems()0%110100%
StartCarousel(...)0%220100%
StopCarousel()0%220100%
GoToPreviousItem()0%2.062075%
ResetCarousel()0%2100%
GoToNextItem()0%2.062075%
MakeJumpFromDotsSelector(...)0%2.062075%
ConfigureManualButtonsEvents()0%330100%
CreateItem(...)0%2.012088.89%
ResizeItem(...)0%110100%
ResizeAllItems()0%5.935066.67%
DestroyInstantiatedItems()0%220100%
RunCarouselCoroutine()0%37.6518060.71%
RunRightAnimation()0%9.665042.86%
RunLeftAnimation()0%9.665042.86%
RunAnimationCoroutine()0%5.735069.23%
GenerateDotsSelector()0%660100%
SetSelectedDot(...)0%550100%
RegisterCurrentInstantiatedItems()0%6.026092.31%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/UIComponents/Scripts/Components/Carousel/CarouselComponentView.cs

#LineLine coverage
 1using DCL.Helpers;
 2using System.Collections;
 3using System.Collections.Generic;
 4using System.Linq;
 5using UnityEngine;
 6using UnityEngine.UI;
 7
 8public interface ICarouselComponentView
 9{
 10    /// <summary>
 11    /// Set the distance between carousel items.
 12    /// </summary>
 13    /// <param name="newSpace">Distance between items.</param>
 14    void SetSpaceBetweenItems(float newSpace);
 15
 16    /// <summary>
 17    /// Set the time that will be pass between carousel items.
 18    /// </summary>
 19    /// <param name="newTime">Time between items.</param>
 20    void SetTimeBetweenItems(float newTime);
 21
 22    /// <summary>
 23    /// Set the time that will be pass during the transition between items.
 24    /// </summary>
 25    /// <param name="newTime">Transition time between items.</param>
 26    void SetAnimationTransitionTime(float newTime);
 27
 28    /// <summary>
 29    /// Set the animation curve that will be used for the animation between items.
 30    /// </summary>
 31    /// <param name="newCurve">Animation curve between items.</param>
 32    void SetAnimationCurve(AnimationCurve newCurve);
 33
 34    /// <summary>
 35    /// Set the color of the carousel background.
 36    /// </summary>
 37    /// <param name="newColor">Background color.</param>
 38    void SetBackgroundColor(Color newColor);
 39
 40    /// <summary>
 41    /// Activates/Deactivates the controls to go to the next/previous item manually.
 42    /// </summary>
 43    /// <param name="isActived">True for activating the manual controls.</param>
 44    void SetManualControlsActive(bool isActived);
 45
 46    /// <summary>
 47    /// Set the items of the carousel.
 48    /// </summary>
 49    /// <param name="items">List of UI components.</param>
 50    void SetItems(List<BaseComponentView> items);
 51
 52    /// <summary>
 53    /// Creates the items of the carousel from the prefab. All previously existing items will be removed.
 54    /// </summary>
 55    /// <param name="prefab">Prefab to create items</param>
 56    /// <param name="amountOfItems">Amounts of items to be created</param>
 57    void SetItems(BaseComponentView prefab, int amountOfItems);
 58
 59    /// <summary>
 60    /// Adds a new item in the carousel.
 61    /// </summary>
 62    /// <param name="item">An UI component.</param>
 63    void AddItem(BaseComponentView item);
 64
 65    /// <summary>
 66    /// Remove an item from the carousel.
 67    /// </summary>
 68    /// <param name="item">An UI component</param>
 69    void RemoveItem(BaseComponentView item);
 70
 71    /// <summary>
 72    /// Get all the items of the carousel.
 73    /// </summary>
 74    /// <returns>The list of items.</returns>
 75    List<BaseComponentView> GetItems();
 76
 77    /// <summary>
 78    /// Extract all items out of the carousel.
 79    /// </summary>
 80    /// <returns>The list of extracted items.</returns>
 81    List<BaseComponentView> ExtractItems();
 82
 83    /// <summary>
 84    /// Remove all existing items from the carousel.
 85    /// </summary>
 86    void RemoveItems();
 87
 88    /// <summary>
 89    /// Start carousel animation.
 90    /// </summary>
 91    /// <param name="fromIndex">It specifies from where item the carousel will start.</param>
 92    /// <param name="startInmediately">True to directly execute the first transition.</param>
 93    /// <param name="direction">Set the direction of the carousel animations: right or left.</param>
 94    /// <param name="changeDirectionAfterFirstTransition">True to change the carousel direction just after the first tra
 95    /// <param name="numberOfInitialJumps">Number of jumps that will be executed in the first transition.</param>
 96    void StartCarousel(int fromIndex, bool startInmediately, CarouselDirection direction, bool changeDirectionAfterFirst
 97
 98    /// <summary>
 99    /// Stop carousel animation.
 100    /// </summary>
 101    void StopCarousel();
 102
 103    /// <summary>
 104    /// Force the carousel to show the previous item.
 105    /// </summary>
 106    void GoToPreviousItem();
 107
 108    /// <summary>
 109    /// Force the carousel to show the next item.
 110    /// </summary>
 111    void GoToNextItem();
 112
 113    /// <summary>
 114    /// Force the carousel to jump to a specific item.
 115    /// </summary>
 116    /// <param name="numberOfJumps">Number of jumps that will be executed during the transition.</param>
 117    /// <param name="direction">Direction in which to make the jumps.</param>
 118    void MakeJumpFromDotsSelector(int numberOfJumps, CarouselDirection direction);
 119}
 120
 121public enum CarouselDirection
 122{
 123    Right,
 124    Left
 125}
 126
 127public class CarouselComponentView : BaseComponentView, ICarouselComponentView, IComponentModelConfig
 128{
 129    [Header("Prefab References")]
 130    [SerializeField] internal RectTransform itemsContainer;
 131    [SerializeField] internal HorizontalLayoutGroup horizontalLayout;
 132    [SerializeField] internal ScrollRect itemsScroll;
 133    [SerializeField] internal RectTransform viewport;
 134    [SerializeField] internal Image background;
 135    [SerializeField] internal Button previousButton;
 136    [SerializeField] internal Button nextButton;
 137    [SerializeField] internal HorizontalLayoutGroup dotsSelector;
 138    [SerializeField] internal Button dotButtonTemplate;
 139    [SerializeField] internal Color dotSelectedColor;
 140    [SerializeField] internal Color dotUnselectedColor;
 141
 142    [Header("Configuration")]
 143    [SerializeField] internal CarouselComponentModel model;
 144
 173145    internal List<BaseComponentView> instantiatedItems = new List<BaseComponentView>();
 146    internal Coroutine itemsCoroutine;
 147    internal int currentItemIndex = 0;
 148    internal int currentDotIndex = 0;
 149    internal float currentFinalNormalizedPos;
 150    internal bool isInTransition = false;
 151
 152    public override void Awake()
 153    {
 73154        base.Awake();
 155
 73156        StartCoroutine(RegisterCurrentInstantiatedItems());
 73157        ConfigureManualButtonsEvents();
 73158    }
 159
 160    public override void Start()
 161    {
 3162        if (model.automaticTransition)
 3163            StartCarousel();
 3164    }
 165
 166    public void Configure(BaseComponentModel newModel)
 167    {
 1168        model = (CarouselComponentModel)newModel;
 1169        RefreshControl();
 1170    }
 171
 172    public override void RefreshControl()
 173    {
 1174        if (model == null)
 0175            return;
 176
 1177        SetSpaceBetweenItems(model.spaceBetweenItems);
 1178        SetTimeBetweenItems(model.timeBetweenItems);
 1179        SetAnimationTransitionTime(model.animationTransitionTime);
 1180        SetAnimationCurve(model.animationCurve);
 1181        SetBackgroundColor(model.backgroundColor);
 1182        SetManualControlsActive(model.showManualControls);
 1183        ResizeAllItems();
 1184        GenerateDotsSelector();
 1185    }
 186
 187    public override void OnScreenSizeChanged()
 188    {
 3189        base.OnScreenSizeChanged();
 190
 3191        ResizeAllItems();
 3192    }
 193
 194    public override void Dispose()
 195    {
 227196        base.Dispose();
 197
 227198        StopCarousel();
 227199        DestroyInstantiatedItems();
 227200    }
 201
 202    public void SetSpaceBetweenItems(float newSpace)
 203    {
 2204        model.spaceBetweenItems = newSpace;
 205
 2206        if (horizontalLayout == null)
 0207            return;
 208
 2209        horizontalLayout.spacing = newSpace;
 2210    }
 211
 0212    public void SetTimeBetweenItems(float newTime) { model.timeBetweenItems = newTime; }
 213
 0214    public void SetAnimationTransitionTime(float newTime) { model.animationTransitionTime = newTime; }
 215
 0216    public void SetAnimationCurve(AnimationCurve newCurve) { model.animationCurve = newCurve; }
 217
 218    public void SetBackgroundColor(Color newColor)
 219    {
 2220        model.backgroundColor = newColor;
 221
 2222        if (background == null)
 2223            return;
 224
 0225        background.color = newColor;
 0226    }
 227
 228    public void SetManualControlsActive(bool isActived)
 229    {
 380230        model.showManualControls = isActived;
 231
 380232        if (previousButton == null || nextButton == null)
 0233            return;
 234
 380235        int currentNumberOfItems = itemsContainer.childCount;
 380236        previousButton.gameObject.SetActive(isActived && currentNumberOfItems > 1);
 380237        nextButton.gameObject.SetActive(isActived && currentNumberOfItems > 1);
 380238        dotsSelector.gameObject.SetActive(isActived && currentNumberOfItems > 1);
 380239    }
 240
 241    public void SetItems(BaseComponentView prefab, int amountOfItems)
 242    {
 0243        DestroyInstantiatedItems();
 244
 0245        for (int i = 0; i < amountOfItems; i++)
 246        {
 0247            BaseComponentView instanciatedItem = Instantiate(prefab);
 0248            CreateItem(instanciatedItem, $"Item{i}");
 249        }
 250
 0251        SetManualControlsActive(model.showManualControls);
 0252        GenerateDotsSelector();
 0253    }
 254
 255    public void SetItems(List<BaseComponentView> items)
 256    {
 17257        DestroyInstantiatedItems();
 258
 108259        for (int i = 0; i < items.Count; i++)
 260        {
 37261            CreateItem(items[i], $"Item{i}");
 262        }
 263
 17264        SetManualControlsActive(model.showManualControls);
 17265        GenerateDotsSelector();
 17266    }
 267
 268    public void AddItem(BaseComponentView item)
 269    {
 2270        CreateItem(item, $"Item{instantiatedItems.Count}");
 2271        SetManualControlsActive(model.showManualControls);
 2272        GenerateDotsSelector();
 2273    }
 274
 275    public void RemoveItem(BaseComponentView item)
 276    {
 2277        BaseComponentView itemToRemove = instantiatedItems.FirstOrDefault(x => x == item);
 1278        if (itemToRemove != null)
 279        {
 1280            Destroy(itemToRemove.gameObject);
 1281            instantiatedItems.Remove(item);
 282        }
 283
 1284        SetManualControlsActive(model.showManualControls);
 1285        GenerateDotsSelector();
 1286    }
 287
 0288    public List<BaseComponentView> GetItems() { return instantiatedItems; }
 289
 290    public List<BaseComponentView> ExtractItems()
 291    {
 318292        List<BaseComponentView> extractedItems = new List<BaseComponentView>();
 912293        foreach (BaseComponentView item in instantiatedItems)
 294        {
 138295            item.transform.SetParent(null);
 138296            extractedItems.Add(item);
 297        }
 298
 318299        instantiatedItems.Clear();
 318300        SetManualControlsActive(model.showManualControls);
 301
 318302        return extractedItems;
 303    }
 304
 305    public void RemoveItems()
 306    {
 36307        DestroyInstantiatedItems();
 36308        SetManualControlsActive(model.showManualControls);
 36309    }
 310
 311    public void StartCarousel(
 312        int fromIndex = 0,
 313        bool startInmediately = false,
 314        CarouselDirection direction = CarouselDirection.Right,
 315        bool changeDirectionAfterFirstTransition = false,
 316        int numberOfInitialJumps = 1)
 317    {
 20318        StopCarousel();
 319
 20320        if (isActiveAndEnabled)
 16321            itemsCoroutine = StartCoroutine(RunCarouselCoroutine(fromIndex, startInmediately, direction, changeDirection
 20322    }
 323
 324    public void StopCarousel()
 325    {
 248326        if (itemsCoroutine == null)
 242327            return;
 328
 6329        StopCoroutine(itemsCoroutine);
 330
 6331        itemsCoroutine = null;
 6332        isInTransition = false;
 6333    }
 334
 335    public void GoToPreviousItem()
 336    {
 3337        if (isInTransition)
 0338            return;
 339
 3340        StartCarousel(
 341            fromIndex: currentItemIndex,
 342            startInmediately: true,
 343            direction: CarouselDirection.Left,
 344            changeDirectionAfterFirstTransition: true,
 345            numberOfInitialJumps: 1);
 3346    }
 347
 348    public void ResetCarousel()
 349    {
 0350        int index = 0;
 0351        SetSelectedDot(index);
 352
 0353    }
 354
 355    public void GoToNextItem()
 356    {
 5357        if (isInTransition)
 0358            return;
 359
 5360        StartCarousel(
 361            fromIndex: currentItemIndex,
 362            startInmediately: true,
 363            direction: CarouselDirection.Right,
 364            changeDirectionAfterFirstTransition: false,
 365            numberOfInitialJumps: 1);
 5366    }
 367
 368    public void MakeJumpFromDotsSelector(int numberOfJumps, CarouselDirection direction)
 369    {
 1370        if (isInTransition)
 0371            return;
 372
 1373        StartCarousel(
 374            fromIndex: currentItemIndex,
 375            startInmediately: true,
 376            direction: direction,
 377            changeDirectionAfterFirstTransition: direction == CarouselDirection.Left,
 378            numberOfInitialJumps: numberOfJumps);
 1379    }
 380
 381    internal void ConfigureManualButtonsEvents()
 382    {
 75383        if (previousButton != null)
 384        {
 75385            previousButton.onClick.RemoveAllListeners();
 75386            previousButton.onClick.AddListener(GoToPreviousItem);
 387        }
 388
 75389        if (nextButton != null)
 390        {
 75391            nextButton.onClick.RemoveAllListeners();
 75392            nextButton.onClick.AddListener(GoToNextItem);
 393        }
 75394    }
 395
 396    internal void CreateItem(BaseComponentView newItem, string name)
 397    {
 40398        if (newItem == null)
 0399            return;
 400
 40401        newItem.transform.SetParent(itemsContainer);
 40402        newItem.transform.localPosition = Vector3.zero;
 40403        newItem.transform.localScale = Vector3.one;
 40404        newItem.name = name;
 405
 40406        instantiatedItems.Add(newItem);
 407
 40408        ResizeItem((RectTransform)newItem.transform);
 40409    }
 410
 411    internal void ResizeItem(RectTransform item)
 412    {
 40413        ((RectTransform)item.transform).sizeDelta = new Vector2(viewport.rect.width, viewport.rect.height);
 414
 40415        int currentNumberOfItems = itemsContainer.childCount;
 40416        itemsContainer.offsetMin = Vector2.zero;
 40417        float extraSpace = (currentNumberOfItems - 1) * model.spaceBetweenItems;
 40418        itemsContainer.offsetMax = new Vector2(viewport.rect.width * (currentNumberOfItems - 1) + extraSpace, 0);
 40419    }
 420
 421    internal void ResizeAllItems()
 422    {
 7423        if (itemsScroll.horizontalNormalizedPosition != 0f)
 0424            itemsScroll.horizontalNormalizedPosition = 0f;
 425
 7426        if (model.automaticTransition)
 7427            StartCarousel();
 428
 14429        foreach (Transform child in itemsContainer)
 430        {
 0431            ResizeItem((RectTransform)child);
 432        }
 7433    }
 434
 435    internal void DestroyInstantiatedItems()
 436    {
 280437        List<BaseComponentView> itemsToDestroy = ExtractItems();
 820438        foreach (BaseComponentView itemToDestroy in itemsToDestroy)
 439        {
 130440            DestroyImmediate(itemToDestroy.gameObject);
 441        }
 280442        itemsToDestroy.Clear();
 443
 280444        instantiatedItems.Clear();
 445
 280446        itemsContainer.offsetMin = Vector2.zero;
 280447        itemsContainer.offsetMax = Vector2.zero;
 280448    }
 449
 450    internal IEnumerator RunCarouselCoroutine(
 451        int fromIndex = 0,
 452        bool startInmediately = false,
 453        CarouselDirection direction = CarouselDirection.Right,
 454        bool changeDirectionAfterFirstTransition = false,
 455        int numberOfInitialJumps = 1)
 456    {
 16457        currentItemIndex = fromIndex;
 16458        SetSelectedDot(currentItemIndex);
 459
 16460        bool continueCarrousel = true;
 16461        while (gameObject.activeInHierarchy && itemsContainer.childCount > 1 && continueCarrousel)
 462        {
 6463            float elapsedTime = 0f;
 464
 6465            if (!startInmediately)
 466            {
 1467                while (elapsedTime < model.timeBetweenItems)
 468                {
 1469                    if (!model.pauseOnFocus || (model.pauseOnFocus && !isFocused))
 1470                        elapsedTime += Time.deltaTime;
 471
 1472                    yield return null;
 473                }
 474
 475            }
 476
 5477            if (instantiatedItems.Count > 0)
 478            {
 5479                if (direction == CarouselDirection.Right)
 480                {
 3481                    SetSelectedDot(currentItemIndex == (instantiatedItems.Count - 1) ? 0 : currentItemIndex + numberOfIn
 3482                    yield return RunRightAnimation(numberOfInitialJumps);
 483
 0484                    if (changeDirectionAfterFirstTransition)
 485                    {
 0486                        direction = CarouselDirection.Left;
 0487                        changeDirectionAfterFirstTransition = false;
 488                    }
 0489                    continueCarrousel = model.automaticTransition;
 0490                }
 491                else
 492                {
 2493                    SetSelectedDot(currentItemIndex == 0 ? (instantiatedItems.Count - 1) : currentItemIndex - numberOfIn
 2494                    yield return RunLeftAnimation(numberOfInitialJumps);
 495
 0496                    if (changeDirectionAfterFirstTransition)
 497                    {
 0498                        direction = CarouselDirection.Right;
 0499                        changeDirectionAfterFirstTransition = false;
 500                    }
 0501                    continueCarrousel = model.automaticTransition;
 502                }
 503            }
 504
 0505            startInmediately = false;
 0506            numberOfInitialJumps = 1;
 507        }
 10508    }
 509
 510    internal IEnumerator RunRightAnimation(int numberOfJumps = 1)
 511    {
 3512        if (currentItemIndex == instantiatedItems.Count - 1)
 513        {
 0514            currentItemIndex = 0;
 0515            yield return RunAnimationCoroutine(CarouselDirection.Left, instantiatedItems.Count - 1);
 0516        }
 517        else
 518        {
 3519            currentItemIndex += numberOfJumps;
 3520            yield return RunAnimationCoroutine(CarouselDirection.Right, numberOfJumps);
 521        }
 0522    }
 523
 524    internal IEnumerator RunLeftAnimation(int numberOfJumps = 1)
 525    {
 2526        if (currentItemIndex == 0)
 527        {
 2528            currentItemIndex = instantiatedItems.Count - 1;
 2529            yield return RunAnimationCoroutine(CarouselDirection.Right, instantiatedItems.Count - 1);
 0530        }
 531        else
 532        {
 0533            currentItemIndex -= numberOfJumps;
 0534            yield return RunAnimationCoroutine(CarouselDirection.Left, numberOfJumps);
 535        }
 0536    }
 537
 538    internal IEnumerator RunAnimationCoroutine(CarouselDirection direction, int numberOfJumps = 1)
 539    {
 5540        isInTransition = true;
 5541        float currentAnimationTime = 0f;
 5542        float initialNormalizedPos = itemsScroll.horizontalNormalizedPosition;
 543
 5544        if (direction == CarouselDirection.Right)
 5545            currentFinalNormalizedPos = initialNormalizedPos + ((float)numberOfJumps / (instantiatedItems.Count - 1));
 546        else
 0547            currentFinalNormalizedPos = initialNormalizedPos - ((float)numberOfJumps / (instantiatedItems.Count - 1));
 548
 5549        while (currentAnimationTime <= model.animationTransitionTime)
 550        {
 5551            itemsScroll.horizontalNormalizedPosition = Mathf.Clamp01(Mathf.Lerp(
 552                initialNormalizedPos,
 553                currentFinalNormalizedPos,
 554                model.animationCurve.Evaluate(currentAnimationTime / model.animationTransitionTime)));
 555
 5556            currentAnimationTime += Time.deltaTime;
 557
 5558            yield return null;
 559        }
 560
 0561        itemsScroll.horizontalNormalizedPosition = currentFinalNormalizedPos;
 0562        isInTransition = false;
 0563    }
 564
 565    internal void GenerateDotsSelector()
 566    {
 26567        List<GameObject> dotsToRemove = new List<GameObject>();
 122568        foreach (Transform child in dotsSelector.transform)
 569        {
 35570            if (child.gameObject == dotButtonTemplate.gameObject)
 571                continue;
 572
 9573            dotsToRemove.Add(child.gameObject);
 574        }
 575
 70576        foreach (GameObject dotToRemove in dotsToRemove)
 577        {
 9578            Utils.SafeDestroy(dotToRemove);
 579        }
 580
 140581        for (int i = 0; i < itemsContainer.childCount; i++)
 582        {
 44583            Button newDotButton = Instantiate(dotButtonTemplate, dotsSelector.transform);
 44584            newDotButton.gameObject.SetActive(true);
 44585            newDotButton.onClick.AddListener(() =>
 586            {
 0587                int dotButtonIndex = newDotButton.transform.GetSiblingIndex() - 1;
 0588                if (dotButtonIndex != currentDotIndex)
 589                {
 0590                    MakeJumpFromDotsSelector(
 591                        Mathf.Abs(dotButtonIndex - currentDotIndex),
 592                        dotButtonIndex > currentDotIndex ? CarouselDirection.Right : CarouselDirection.Left);
 593                }
 0594            });
 595        }
 596
 26597        SetSelectedDot(0);
 26598    }
 599
 600    internal void SetSelectedDot(int index)
 601    {
 48602        int currentIndex = 0;
 48603        currentDotIndex = -1;
 346604        foreach (Transform child in dotsSelector.transform)
 605        {
 125606            if (child.gameObject == dotButtonTemplate.gameObject)
 607                continue;
 608
 77609            if (currentIndex == index)
 610            {
 34611                child.GetComponent<Image>().color = dotSelectedColor;
 34612                child.transform.localScale = Vector3.one * 1.5f;
 34613                currentDotIndex = index;
 34614            }
 615            else
 616            {
 43617                child.GetComponent<Image>().color = dotUnselectedColor;
 43618                child.transform.localScale = Vector3.one;
 619            }
 620
 77621            currentIndex++;
 622        }
 48623    }
 624
 625    internal IEnumerator RegisterCurrentInstantiatedItems()
 626    {
 73627        instantiatedItems.Clear();
 628
 344629        foreach (Transform child in itemsContainer)
 630        {
 99631            BaseComponentView existingItem = child.GetComponent<BaseComponentView>();
 99632            if (existingItem != null)
 99633                instantiatedItems.Add(existingItem);
 634            else
 0635                Destroy(child.gameObject);
 636        }
 637
 638        // In the first loading, before calculating the size of the current items, it is needed to wait for a frame in o
 639        // allow time for the carousel viewport to get its final size to be able to execute the 'ResizeAllItems' functio
 73640        yield return null;
 641
 3642        ResizeAllItems();
 3643        SetManualControlsActive(model.showManualControls);
 3644        GenerateDotsSelector();
 3645    }
 646}