Fixed scrollability not being obvious, added fade effect

This commit is contained in:
Henry Jameson 2019-09-15 01:16:54 +03:00
parent 3505e53756
commit f0cb6fe03f
3 changed files with 26 additions and 1 deletions

View File

@ -17,6 +17,7 @@ const EmojiPicker = {
keyword: '', keyword: '',
activeGroup: 'custom', activeGroup: 'custom',
showingStickers: false, showingStickers: false,
groupsScrolledClass: 'scrolled-top',
spamMode: false spamMode: false
} }
}, },
@ -40,6 +41,13 @@ const EmojiPicker = {
scrolledGroup (e) { scrolledGroup (e) {
const target = (e && e.target) || this.$refs['emoji-groups'] const target = (e && e.target) || this.$refs['emoji-groups']
const top = target.scrollTop + 5 const top = target.scrollTop + 5
if (target.scrollTop <= 5) {
this.groupsScrolledClass = 'scrolled-top'
} else if (target.scrollTop >= target.scrollTopMax - 5) {
this.groupsScrolledClass = 'scrolled-bottom'
} else {
this.groupsScrolledClass = 'scrolled-middle'
}
this.$nextTick(() => { this.$nextTick(() => {
this.emojisView.forEach(group => { this.emojisView.forEach(group => {
const ref = this.$refs['group-' + group.id] const ref = this.$refs['group-' + group.id]

View File

@ -6,7 +6,7 @@
position: absolute; position: absolute;
right: 0; right: 0;
left: 0; left: 0;
height: 300px; height: 320px;
margin: 0 !important; margin: 0 !important;
z-index: 1; z-index: 1;
@ -104,6 +104,22 @@
flex: 1 1 1px; flex: 1 1 1px;
position: relative; position: relative;
overflow: auto; overflow: auto;
mask: linear-gradient(to top, white 0, transparent 100%) bottom no-repeat,
linear-gradient(to bottom, white 0, transparent 100%) top no-repeat,
linear-gradient(to top, white, white);
transition: mask-size 150ms;
mask-size: 100% 20px, 100% 20px, auto;
// Autoprefixed seem to ignore this one, and also syntax is different
-webkit-mask-composite: xor;
mask-composite: exclude;
&.scrolled {
&-top {
mask-size: 100% 20px, 100% 0, auto;
}
&-bottom {
mask-size: 100% 0, 100% 20px, auto;
}
}
} }
&-group { &-group {

View File

@ -46,6 +46,7 @@
<div <div
ref="emoji-groups" ref="emoji-groups"
class="emoji-groups" class="emoji-groups"
:class="groupsScrolledClass"
@scroll="scrolledGroup" @scroll="scrolledGroup"
> >
<div <div