# default | pokemon-rogue-battle
Documentation for pokemon-rogue-battle

# Class default

A helper class to handle navigation through a grid of elements that can scroll vertically Needs to be used by a `UiHandler` How to use:

- in `UiHandler.setup`: Initialize with the `UiHandler` that handles the grid, the number of rows and columns that can be shown at once, an optional `ScrollBar`, and optional callbacks that will get called after scrolling
- in `UiHandler.show`: Set `setTotalElements` to the total number of elements in the list to display
- in `UiHandler.processInput`: call `processNavigationInput` to have it handle the cursor updates while calling the defined callbacks
- in `UiHandler.clear`: call `reset`

- Defined in src/ui/scrollable-grid-handler.ts:19

##### Index

### Constructors

constructor

### Methods

getItemOffset
processInput
reset
setTotalElements
withScrollBar
withUpdateGridCallBack
withUpdateSingleElementCallback

## Constructors

### constructor

- new default(handler: default , rows: number, columns: number): default

  #### Parameters

  - handler: default
  - rows: number

    the maximum number of rows shown at once

  - columns: number

    the maximum number of columns shown at once

  #### Returns default

  - Defined in src/ui/scrollable-grid-handler.ts:36

## Methods

### getItemOffset

- getItemOffset(): number

  #### Returns number

  how many elements are hidden due to scrolling

  - Defined in src/ui/scrollable-grid-handler.ts:90

### processInput

- processInput(button: Button ): boolean

  Update the cursor and scrollCursor based on user input

  #### Parameters

  - button: Button

    the button that was pressed

  #### Returns boolean

  `true` if either the cursor or scrollCursor was updated

  - Defined in src/ui/scrollable-grid-handler.ts:99

### reset

- reset(): void

  Reset the scrolling

  #### Returns void

  - Defined in src/ui/scrollable-grid-handler.ts:157

### setTotalElements

- setTotalElements(totalElements: number): void

  #### Parameters

  - totalElements: number

    the total number of elements that the grid needs to display

  #### Returns void

  - Defined in src/ui/scrollable-grid-handler.ts:79

### withScrollBar

- withScrollBar(scrollBar: ScrollBar ): default

  Set a scrollBar to get updated with the scrolling

  #### Parameters

  - scrollBar: ScrollBar

    `ScrollBar`

  #### Returns default

  this

  - Defined in src/ui/scrollable-grid-handler.ts:50

### withUpdateGridCallBack

- withUpdateGridCallBack(callback: UpdateGridCallbackFunction): default

  Set function that will get called if the whole grid needs to get updated

  #### Parameters

  - callback: UpdateGridCallbackFunction

    UpdateGridCallbackFunction

  #### Returns default

  this

  - Defined in src/ui/scrollable-grid-handler.ts:61

### withUpdateSingleElementCallback

- withUpdateSingleElementCallback(
  callback: UpdateDetailsCallbackFunction,
  ): default

  Set function that will get called if a single element in the grid needs to get updated

  #### Parameters

  - callback: UpdateDetailsCallbackFunction

    UpdateDetailsCallbackFunction

  #### Returns default

  this

  - Defined in src/ui/scrollable-grid-handler.ts:71