Browse Source

Fix emoji animation container position

master
Eduard Kuzmenko 3 years ago
parent
commit
bd06984e5e
  1. 15
      src/lib/appManagers/appImManager.ts

15
src/lib/appManagers/appImManager.ts

@ -183,7 +183,7 @@ export class AppImManager {
this.emojiAnimationContainer = document.createElement('div'); this.emojiAnimationContainer = document.createElement('div');
this.emojiAnimationContainer.classList.add('emoji-animation-container'); this.emojiAnimationContainer.classList.add('emoji-animation-container');
document.body.append(this.emojiAnimationContainer); this.appendEmojiAnimationContainer(mediaSizes.activeScreen);
this.columnEl.append(this.chatsContainer); this.columnEl.append(this.chatsContainer);
@ -213,11 +213,7 @@ export class AppImManager {
appSidebarRight.toggleSidebar(false); appSidebarRight.toggleSidebar(false);
} }
if(from === ScreenSize.mobile) { this.appendEmojiAnimationContainer(to);
document.body.append(this.emojiAnimationContainer);
} else if(to === ScreenSize.mobile) {
this.columnEl.append(this.emojiAnimationContainer);
}
}); });
rootScope.addEventListener('history_focus', (e) => { rootScope.addEventListener('history_focus', (e) => {
@ -554,6 +550,13 @@ export class AppImManager {
this.attachKeydownListener(); this.attachKeydownListener();
} }
private appendEmojiAnimationContainer(screen: ScreenSize) {
const appendTo = screen === ScreenSize.mobile ? this.columnEl : document.body;
if(this.emojiAnimationContainer.parentElement !== appendTo) {
appendTo.append(this.emojiAnimationContainer)
}
}
private attachKeydownListener() { private attachKeydownListener() {
const IGNORE_KEYS = new Set(['PageUp', 'PageDown', 'Meta', 'Control']); const IGNORE_KEYS = new Set(['PageUp', 'PageDown', 'Meta', 'Control']);
const onKeyDown = (e: KeyboardEvent) => { const onKeyDown = (e: KeyboardEvent) => {

Loading…
Cancel
Save