Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Commit

Permalink
🎨 ui(mobile): Improve scrolling for large vertical fretboards
Browse files Browse the repository at this point in the history
  • Loading branch information
cheap-glitch committed Oct 15, 2020
1 parent 230a3f6 commit fa59b09
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
24 changes: 19 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ div.App#app(:style="colorscheme")
FretboardSettings(v-if="isMobileDevice && subpage == 'settings'")

//- Fretboard
div.fretboard-wrapper#fretboard-wrapper(v-show="!isMobileDevice || subpage == 'fretboard'")
FretboardViewer(:is-vertical="isMobileDevice && !isLayoutLandscape")
div.fretboard-wrapper#fretboard-wrapper(
v-show="!isMobileDevice || subpage == 'fretboard'"
v-mods="{ isLargeInstrument }"
)
FretboardViewer(
:is-vertical="isMobileDevice && !isLayoutLandscape"
v-mods="{ isLargeInstrument }"
)

//- Scales & arpeggios
div: FretboardSequences(v-show="!isMobileDevice || subpage == 'sequences'")
Expand Down Expand Up @@ -100,6 +106,7 @@ import { get } from 'vuex-pathify'
import { colorscheme } from '@/modules/colorscheme'
import { mapObjectToObject } from '@/modules/object'
import { instruments } from '@/modules/music'
import { mediaQueries } from '@/stores/main'
Expand Down Expand Up @@ -136,6 +143,9 @@ export default {
default: return 'guitar';
}
},
isLargeInstrument() {
return instruments[this.instrument].nbStrings > 7;
},
...get('fretboard', [
'instrument'
Expand Down Expand Up @@ -200,10 +210,14 @@ export default {
.fretboard-wrapper {
@include mq($until: desktop) {
@media (orientation: portrait) {
display: flex;
justify-content: center;
margin: 20px 0;
&.is-large-instrument {
overflow-x: scroll;
margin: 0;
padding: 20px;
}
}
@media (orientation: landscape) {
Expand Down
14 changes: 12 additions & 2 deletions src/components/FretboardViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,19 @@ export default {
}
@include mq($until: desktop) {
// Shift the fretboard to keep it horizontally centered when fret numbers are displayed
@media (orientation: portrait) {
.FretboardViewer.is-showing-fret-nbs { transform: translateX(layout.$fret-number-wrapper-size / -2); }
.FretboardViewer {
margin: auto;
&.is-large-instrument {
margin-bottom: 20px;
}
&:not(.is-large-instrument).is-showing-fret-nbs {
// Shift the fretboard to keep it horizontally centered when fret numbers are displayed
transform: translateX(layout.$fret-number-wrapper-size / -2);
}
}
}
// Add a margin on the right side
Expand Down

0 comments on commit fa59b09

Please sign in to comment.