UNPKG

phaser4-rex-plugins

Version:
41 lines (32 loc) 950 B
export default { focusNextButton() { if (!this.isOpened) { return this; } var currentIndex = this.currentOverIndex; var nextIndex; if (currentIndex === undefined) { nextIndex = 0; } else { var total = this.listPanel.getButtons().length; nextIndex = (currentIndex + 1) % total; } this.emitButtonOver(nextIndex); return this; }, focusPrevButton() { if (!this.isOpened) { return this; } var currentIndex = this.currentOverIndex; var nextIndex; if (currentIndex === undefined) { nextIndex = 0; } else { var total = this.listPanel.getButtons().length; nextIndex = (currentIndex - 1 + total) % total; } this.emitButtonOver(nextIndex); return this; } }