Skip to content

Commit 731839c

Browse files
committed
(fix) emoji picker position
1 parent a4da252 commit 731839c

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

src/components/EmojiPickerContainer/EmojiPickerContainer.vue

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -113,34 +113,33 @@ export default {
113113
)
114114
},
115115
setEmojiPickerPosition(clientY, innerWidth, innerHeight) {
116-
setTimeout(() => {
117-
const mobileSize = innerWidth < 500 || innerHeight < 700
118-
const roomFooterRef = document.getElementById('room-footer')
119-
120-
if (!roomFooterRef) {
121-
if (mobileSize) this.emojiPickerRight = '-50px'
122-
return
123-
}
124-
125-
if (mobileSize) {
126-
this.emojiPickerRight = innerWidth / 2 - 150 + 'px'
127-
this.emojiPickerTop = 100
128-
this.emojiPickerHeight = innerHeight - 200
129-
} else {
130-
const roomFooterTop = roomFooterRef.getBoundingClientRect().top
131-
const pickerTopPosition =
132-
roomFooterTop - clientY > this.emojiPickerHeight - 50
133-
134-
if (pickerTopPosition) this.emojiPickerTop = clientY + 10
135-
else this.emojiPickerTop = clientY - this.emojiPickerHeight - 10
136-
137-
this.emojiPickerRight = this.positionTop
138-
? '-50px'
139-
: this.positionRight
140-
? '60px'
141-
: ''
142-
}
143-
})
116+
const mobileSize = innerWidth < 500 || innerHeight < 700
117+
const roomFooterRef = document.getElementById('room-footer')
118+
119+
if (!roomFooterRef) {
120+
if (mobileSize) this.emojiPickerRight = '-50px'
121+
return
122+
}
123+
124+
if (mobileSize) {
125+
this.emojiPickerRight =
126+
innerWidth / 2 - (this.positionTop ? 200 : 150) + 'px'
127+
this.emojiPickerTop = 100
128+
this.emojiPickerHeight = innerHeight - 200
129+
} else {
130+
const roomFooterTop = roomFooterRef.getBoundingClientRect().top
131+
const pickerTopPosition =
132+
roomFooterTop - clientY > this.emojiPickerHeight - 50
133+
134+
if (pickerTopPosition) this.emojiPickerTop = clientY + 10
135+
else this.emojiPickerTop = clientY - this.emojiPickerHeight - 10
136+
137+
this.emojiPickerRight = this.positionTop
138+
? '0px'
139+
: this.positionRight
140+
? '60px'
141+
: ''
142+
}
144143
}
145144
}
146145
}

0 commit comments

Comments
 (0)