Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/css/mobile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@

/* APP SIDEBAR TOGGLE and SWIPE ----------------------------------------------*/
#app-navigation:not(.vue) {
transform: translateX(-#{variables.$navigation-width});
position: fixed;
height: var(--body-height);
transform: translateX(-#{variables.$navigation-width});
}
.snapjs-left {
.snapjs-left,
.snapjs-right {
#app-navigation {
transform: translateX(0);
}
Expand Down
17 changes: 11 additions & 6 deletions core/src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import $ from 'jquery'
import moment from 'moment'

import OC from './OC/index.js'
import { isRTL } from '@nextcloud/l10n'
import { initSessionHeartBeat } from './session-heartbeat.ts'
import { setUp as setUpContactsMenu } from './components/ContactsMenu.js'
import { setUp as setUpMainMenu } from './components/MainMenu.js'
Expand Down Expand Up @@ -58,6 +59,9 @@ moment.locale(locale)
* Initializes core
*/
export const initCore = () => {
const SNAPPER_OPEN = isRTL() ? 'right' : 'left'
const SNAPPER_CLOSE = isRTL() ? 'left' : 'right'

interceptRequests()
initFallbackClipboardAPI()

Expand Down Expand Up @@ -116,7 +120,7 @@ export const initCore = () => {
// App sidebar on mobile
const snapper = new Snap({
element: document.getElementById('app-content'),
disable: 'right',
disable: SNAPPER_CLOSE,
maxPosition: 300, // $navigation-width
minDragDistance: 100,
})
Expand Down Expand Up @@ -162,7 +166,7 @@ export const initCore = () => {
if (animating || snapper.state().state !== 'closed') {
return
}
oldSnapperOpen('left')
oldSnapperOpen(SNAPPER_OPEN)
}

const _snapperClose = () => {
Expand All @@ -187,16 +191,17 @@ export const initCore = () => {
}

$('#app-navigation-toggle').click((e) => {
console.error('snapper', SNAPPER_OPEN, isRTL(), snapper.state().state, snapper)
// close is implicit in the button by snap.js
if (snapper.state().state !== 'left') {
snapper.open()
if (snapper.state().state !== SNAPPER_OPEN) {
snapper.open(SNAPPER_OPEN)
}
})
$('#app-navigation-toggle').keypress(e => {
if (snapper.state().state === 'left') {
if (snapper.state().state === SNAPPER_OPEN) {
snapper.close()
} else {
snapper.open()
snapper.open(SNAPPER_OPEN)
}
})

Expand Down
Loading