make side drawer use gesture service and fix its animations
This commit is contained in:
parent
c50e64f8ee
commit
0eff4bd0ac
2 changed files with 22 additions and 7 deletions
|
@ -9,9 +9,7 @@ const SideDrawer = {
|
||||||
closeGesture: undefined
|
closeGesture: undefined
|
||||||
}),
|
}),
|
||||||
created () {
|
created () {
|
||||||
const cb = () => this.toggleDrawer()
|
this.closeGesture = GestureService.swipeGesture(GestureService.DIRECTION_LEFT, this.toggleDrawer)
|
||||||
this.closeGesture = GestureService.swipeGesture(GestureService.DIRECTION_LEFT, cb)
|
|
||||||
console.log(this.closeGesture)
|
|
||||||
},
|
},
|
||||||
components: { UserCard },
|
components: { UserCard },
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -47,7 +45,6 @@ const SideDrawer = {
|
||||||
this.toggleDrawer()
|
this.toggleDrawer()
|
||||||
},
|
},
|
||||||
touchStart (e) {
|
touchStart (e) {
|
||||||
console.log(this)
|
|
||||||
GestureService.beginSwipe(e, this.closeGesture)
|
GestureService.beginSwipe(e, this.closeGesture)
|
||||||
},
|
},
|
||||||
touchMove (e) {
|
touchMove (e) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<div class="side-drawer-container"
|
<div class="side-drawer-container"
|
||||||
:class="{ 'side-drawer-container-closed': closed, 'side-drawer-container-open': !closed }"
|
:class="{ 'side-drawer-container-closed': closed, 'side-drawer-container-open': !closed }"
|
||||||
>
|
>
|
||||||
|
<div class="side-drawer-darken" :class="{ 'side-drawer-darken-closed': closed}" />
|
||||||
<div class="side-drawer"
|
<div class="side-drawer"
|
||||||
:class="{'side-drawer-closed': closed}"
|
:class="{'side-drawer-closed': closed}"
|
||||||
@touchstart="touchStart"
|
@touchstart="touchStart"
|
||||||
|
@ -111,16 +112,32 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
|
transition-duration: 0s;
|
||||||
|
transition-property: transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-drawer-container-open {
|
.side-drawer-container-open {
|
||||||
|
transform: translate(0%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.side-drawer-container-closed {
|
||||||
|
transition-delay: 0.35s;
|
||||||
|
transform: translate(-100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.side-drawer-darken {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
z-index: -1;
|
||||||
transition: 0.35s;
|
transition: 0.35s;
|
||||||
transition-property: background-color;
|
transition-property: background-color;
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-drawer-container-closed {
|
.side-drawer-darken-closed {
|
||||||
left: -100%;
|
|
||||||
background-color: rgba(0, 0, 0, 0);
|
background-color: rgba(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +147,9 @@
|
||||||
|
|
||||||
.side-drawer {
|
.side-drawer {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
transition: 0.35s;
|
|
||||||
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
|
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
|
||||||
|
transition: 0.35s;
|
||||||
|
transition-property: transform;
|
||||||
margin: 0 0 0 -100px;
|
margin: 0 0 0 -100px;
|
||||||
padding: 0 0 1em 100px;
|
padding: 0 0 1em 100px;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
|
Loading…
Reference in a new issue