From 3b19e78aae8db22aa7ed1ec44574db5d75b6bf3f Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Wed, 2 Oct 2024 21:30:36 +0800 Subject: style: reformat code --- src/dumbyUtils.mjs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/dumbyUtils.mjs b/src/dumbyUtils.mjs index 7bf26c8..b0845bd 100644 --- a/src/dumbyUtils.mjs +++ b/src/dumbyUtils.mjs @@ -3,11 +3,11 @@ import LeaderLine from 'leader-line' export function focusNextMap (reverse = false) { const renderedList = this.utils.renderedMaps() const index = renderedList.findIndex(e => e.classList.contains('focus')) - const nextIndex = - index === -1 ? 0 : (index + (reverse ? -1 : 1)) % renderedList.length + const nextIndex = (index + (reverse ? -1 : 1)) % renderedList.length const nextMap = renderedList.at(nextIndex) nextMap.classList.add('focus') + nextMap.scrollIntoView({ behavior: 'smooth' }) } export function focusNextBlock (reverse = false) { @@ -19,8 +19,7 @@ export function focusNextBlock (reverse = false) { }) ) const index = blocks.findIndex(e => e.classList.contains('focus')) - const nextIndex = - index === -1 ? 0 : (index + (reverse ? -1 : 1)) % blocks.length + const nextIndex = (index + (reverse ? -1 : 1)) % blocks.length blocks.forEach(b => b.classList.remove('focus')) const nextBlock = blocks.at(nextIndex) -- cgit v1.2.3-70-g09d2