diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-09-24 15:28:35 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-09-24 15:28:35 +0800 |
| commit | a3a5ab51aa4ee8f6c771e3dd1f9a51b579b06e3d (patch) | |
| tree | 5eea713972f3b0fcbdf9cd9f74cf829cf6d76925 /src | |
| parent | 8730a7ea5192177e217ccf2f76e1336305ae5d7d (diff) | |
chore: reformat code
Diffstat (limited to 'src')
| -rw-r--r-- | src/dumbymap.mjs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs index 1e8c38d..59c656c 100644 --- a/src/dumbymap.mjs +++ b/src/dumbymap.mjs | |||
| @@ -179,23 +179,23 @@ function switchToNextLayout(reverse = false) { | |||
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | function focusNextBlock(reverse = false) { | 181 | function focusNextBlock(reverse = false) { |
| 182 | const blocks = this.blocks.filter(b=>b.checkVisibility({ | 182 | const blocks = this.blocks.filter(b => b.checkVisibility({ |
| 183 | contentVisibilityAuto: true, | 183 | contentVisibilityAuto: true, |
| 184 | opacityProperty: true, | 184 | opacityProperty: true, |
| 185 | visibilityProperty: true, | 185 | visibilityProperty: true, |
| 186 | })) | 186 | })) |
| 187 | const currentBlock = blocks.find(b=>b.classList.contains('focus')) | 187 | const currentBlock = blocks.find(b => b.classList.contains('focus')) |
| 188 | const currentIndex = blocks.indexOf(currentBlock) | 188 | const currentIndex = blocks.indexOf(currentBlock) |
| 189 | const padding = reverse ? -1 : 1 | 189 | const padding = reverse ? -1 : 1 |
| 190 | const nextIndex = currentIndex === -1 ? 0 : (currentIndex + padding + blocks.length) % blocks.length | 190 | const nextIndex = currentIndex === -1 ? 0 : (currentIndex + padding + blocks.length) % blocks.length |
| 191 | const nextBlock = blocks[nextIndex] | 191 | const nextBlock = blocks[nextIndex] |
| 192 | blocks.forEach(b=>b.classList.remove('focus')) | 192 | blocks.forEach(b => b.classList.remove('focus')) |
| 193 | nextBlock?.classList?.add('focus') | 193 | nextBlock?.classList?.add('focus') |
| 194 | nextBlock.scrollIntoView({behavior: 'smooth', block: "nearest"}) | 194 | nextBlock.scrollIntoView({ behavior: 'smooth', block: "nearest" }) |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | function removeBlockFocus() { | 197 | function removeBlockFocus() { |
| 198 | this.blocks.forEach(b=>b.classList.remove('focus')) | 198 | this.blocks.forEach(b => b.classList.remove('focus')) |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | export const generateMaps = (container, callback) => { | 201 | export const generateMaps = (container, callback) => { |