<!DOCTYPE html><htmlclass="default"lang="en"><head><metacharset="utf-8"/><metahttp-equiv="x-ua-compatible"content="IE=edge"/><title>default | pokemon-rogue-battle</title><metaname="description"content="Documentation for pokemon-rogue-battle"/><metaname="viewport"content="width=device-width, initial-scale=1"/><linkrel="stylesheet"href="../assets/style.css"/><linkrel="stylesheet"href="../assets/highlight.css"/><scriptdefersrc="../assets/main.js"></script><scriptasyncsrc="../assets/icons.js"id="tsd-icons-script"></script><scriptasyncsrc="../assets/search.js"id="tsd-search-script"></script><scriptasyncsrc="../assets/navigation.js"id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme=localStorage.getItem("tsd-theme")||"os";document.body.style.display="none";setTimeout(()=>app?app.showPage():document.body.style.removeProperty("display"),500)</script><headerclass="tsd-page-toolbar"><divclass="tsd-toolbar-contents container"><divclass="table-cell"id="tsd-search"data-base=".."><divclass="field"><labelfor="tsd-search-field"class="tsd-widget tsd-toolbar-icon search no-caption"><svgwidth="16"height="16"viewBox="0 0 16 16"fill="none"><usehref="../assets/icons.svg#icon-search"></use></svg></label><inputtype="text"id="tsd-search-field"aria-label="Search"/></div><divclass="field"><divid="tsd-toolbar-links"></div></div><ulclass="results"><liclass="state loading">Preparing search index...</li><liclass="state failure">The search index is not available</li></ul><ahref="../index.html"class="title">pokemon-rogue-battle</a></div><divclass="table-cell"id="tsd-widgets"><ahref="#"class="tsd-widget tsd-toolbar-icon menu no-caption"data-toggle="menu"aria-label="Menu"><svgwidth="16"height="16"viewBox="0 0 16 16"fill="none"><usehref="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><divclass="container container-main"><divclass="col-content"><divclass="tsd-page-title"><ulclass="tsd-breadcrumb"><li><ahref="../index.html">pokemon-rogue-battle</a></li><li><ahref="../modules/ui_scrollable_grid_handler.html">ui/scrollable-grid-handler</a></li><li><ahref="ui_scrollable_grid_handler.default.html">default</a></li></ul><h1>Class default</h1></div><sectionclass="tsd-panel tsd-comment"><divclass="tsd-comment tsd-typography"><p>A helper class to handle navigation through a grid of elements that can scroll vertically
Needs to be used by a <ahref="ui_ui_handler.default.html"class="tsd-kind-class"><code>UiHandler</code></a>
How to use:</p>
<ul>
<li>in <code>UiHandler.setup</code>: Initialize with the <ahref="ui_ui_handler.default.html"class="tsd-kind-class"><code>UiHandler</code></a> that handles the grid,
the number of rows and columns that can be shown at once,
an optional <ahref="ui_scroll_bar.ScrollBar.html"class="tsd-kind-class"><code>ScrollBar</code></a>, and optional callbacks that will get called after scrolling</li>
<li>in <code>UiHandler.show</code>: Set <code>setTotalElements</code> to the total number of elements in the list to display</li>
<li>in <code>UiHandler.processInput</code>: call <code>processNavigationInput</code> to have it handle the cursor updates while calling the defined callbacks</li>
</div></section></div></details></section></section><detailsclass="tsd-panel-group tsd-member-group tsd-accordion"open><summaryclass="tsd-accordion-summary"data-key="section-Constructors"><h2><svgwidth="20"height="20"viewBox="0 0 24 24"fill="none"><usehref="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><sectionclass="tsd-panel tsd-member"><aid="constructor"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>constructor</span><ahref="#constructor"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="constructor.new_default"class="tsd-anchor"></a><spanclass="tsd-kind-constructor-signature">new default</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">handler</span>, <spanclass="tsd-kind-parameter">rows</span>, <spanclass="tsd-kind-parameter">columns</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="ui_scrollable_grid_handler.default.html"class="tsd-signature-type tsd-kind-class">default</a><ahref="#constructor.new_default"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">handler</span>: <ahref="ui_ui_handler.default.html"class="tsd-signature-type tsd-kind-class">default</a></span></li><li><span><spanclass="tsd-kind-parameter">rows</span>: <spanclass="tsd-signature-type">number</span></span><divclass="tsd-comment tsd-typography"><p>the maximum number of rows shown at once</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><spanclass="tsd-kind-parameter">columns</span>: <spanclass="tsd-signature-type">number</span></span><divclass="tsd-comment tsd-typography"><p>the maximum number of columns shown at once</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <ahref="ui_scrollable_grid_handler.default.html"class="tsd-signature-type tsd-kind-class">default</a></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/b4cc9d7892a7d8b548c857f3acca40d5cf5defba/src/ui/scrollable-grid-handler.ts#L37">src/ui/scrollable-grid-handler.ts:37</a></li></ul></aside></li></ul></section></section></details><detailsclass="tsd-panel-group tsd-member-group tsd-accordion"open><summaryclass="tsd-accordion-summary"data-key="section-Methods"><h2><svgwidth="20"height="20"viewBox="0 0 24 24"fill="none"><usehref="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><sectionclass="tsd-panel tsd-member"><aid="getItemOffset"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>get<wbr/>Item<wbr/>Offset</span><ahref="#getItemOffset"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="getItemOffset.getItemOffset-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">get<wbr/>Item<wbr/>Offset</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">number</span><ahref="#getItemOffset.getItemOffset-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">number</span></h4><p>how many elements are hidden due to scrolling</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/b4cc9d7892a7d8b548c857f3acca40d5cf5defba/src/ui/scrollable-grid-handler.ts#L91">src/ui/scrollable-grid-handler.ts:91</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="processInput"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>process<wbr/>Input</span><ahref="#processInput"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="processInput.processInput-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">process<wbr/>Input</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">button</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">boolean</span><ahref="#processInput.processInput-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Update the cursor and scrollCursor based on user input</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">button</span>: <ahref="../enums/enums_buttons.Button.html"class="tsd-signature-type tsd-kind-enum">Button</a></span><divclass="tsd-comment tsd-typography"><p>the button that was pressed</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">boolean</span></h4><p><code>true</code> if either the cursor or scrollCursor was updated</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/b4cc9d7892a7d8b548c857f3acca40d5cf5defba/src/ui/scrollable-grid-handler.ts#L100">src/ui/scrollable-grid-handler.ts:100</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="reset"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>reset</span><ahref="#reset"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="reset.reset-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">reset</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#reset.reset-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Reset the scrolling</p>
</div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/b4cc9d7892a7d8b548c857f3acca40d5cf5defba/src/ui/scrollable-grid-handler.ts#L158">src/ui/scrollable-grid-handler.ts:158</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="setTotalElements"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>set<wbr/>Total<wbr/>Elements</span><ahref="#setTotalElements"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="setTotalElements.setTotalElements-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">set<wbr/>Total<wbr/>Elements</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">totalElements</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#setTotalElements.setTotalElements-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">totalElements</span>: <spanclass="tsd-signature-type">number</span></span><divclass="tsd-comment tsd-typography"><p>the total number of elements that the grid needs to display</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/b4cc9d7892a7d8b548c857f3acca40d5cf5defba/src/ui/scrollable-grid-handler.ts#L80">src/ui/scrollable-grid-handler.ts:80</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="withScrollBar"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>with<wbr/>Scroll<wbr/>Bar</span><ahref="#withScrollBar"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="withScrollBar.withScrollBar-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">with<wbr/>Scroll<wbr/>Bar</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">scrollBar</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="ui_scrollable_grid_handler.default.html"class="tsd-signature-type tsd-kind-class">default</a><ahref="#withScrollBar.withScrollBar-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Set a scrollBar to get updated with the scrolling</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/b4cc9d7892a7d8b548c857f3acca40d5cf5defba/src/ui/scrollable-grid-handler.ts#L51">src/ui/scrollable-grid-handler.ts:51</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="withUpdateGridCallBack"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>with<wbr/>Update<wbr/>Grid<wbr/>Call<wbr/>Back</span><ahref="#withUpdateGridCallBack"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="withUpdateGridCallBack.withUpdateGridCallBack-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">with<wbr/>Update<wbr/>Grid<wbr/>Call<wbr/>Back</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">callback</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="ui_scrollable_grid_handler.default.html"class="tsd-signature-type tsd-kind-class">default</a><ahref="#withUpdateGridCallBack.withUpdateGridCallBack-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Set function that will get called if the whole grid needs to get updated</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/b4cc9d7892a7d8b548c857f3acca40d5cf5defba/src/ui/scrollable-grid-handler.ts#L62">src/ui/scrollable-grid-handler.ts:62</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="withUpdateSingleElementCallback"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>with<wbr/>Update<wbr/>Single<wbr/>Element<wbr/>Callback</span><ahref="#withUpdateSingleElementCallback"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="withUpdateSingleElementCallback.withUpdateSingleElementCallback-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">with<wbr/>Update<wbr/>Single<wbr/>Element<wbr/>Callback</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">callback</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="ui_scrollable_grid_handler.default.html"class="tsd-signature-type tsd-kind-class">default</a><ahref="#withUpdateSingleElementCallback.withUpdateSingleElementCallback-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Set function that will get called if a single element in the grid needs to get updated</p>