Browse Source

Fix following by bubble beside button on mobiles

master
Eduard Kuzmenko 4 years ago
parent
commit
c7a21360ee
  1. 2
      src/components/chat/contextMenu.ts
  2. 3
      src/components/misc.ts

2
src/components/chat/contextMenu.ts

@ -80,7 +80,7 @@ export default class ChatContextMenu {
const className = (e.target as HTMLElement).className; const className = (e.target as HTMLElement).className;
if(!className || !className.includes) return; if(!className || !className.includes) return;
const good = ['bubble', 'bubble__container', 'message', 'time', 'inner'].find(c => className.includes(c)); const good = ['bubble', 'bubble__container', 'message', 'time', 'inner'].find(c => className.match(new RegExp(c + '($|\\s)')));
if(good) { if(good) {
onContextMenu(e); onContextMenu(e);
} }

3
src/components/misc.ts

@ -228,6 +228,7 @@ export function positionMenu({clientX, clientY}: {clientX: number, clientY: numb
} }
// ! don't need reverse for this, this will be the side WHERE ANIMATION WILL END ! // ! don't need reverse for this, this will be the side WHERE ANIMATION WILL END !
// ! NO LOGIC HERE !
let verticalSide: 'top' | 'bottom'; let verticalSide: 'top' | 'bottom';
if(side !== undefined) { if(side !== undefined) {
@ -251,7 +252,7 @@ export function positionMenu({clientX, clientY}: {clientX: number, clientY: numb
} }
if((clientY + scrollHeight + PADDING_TOP) > innerHeight) { if((clientY + scrollHeight + PADDING_TOP) > innerHeight) {
elem.style.top = Math.max(PADDING_TOP, clientY - scrollHeight) + 'px'; elem.style.top = clamp(clientY - scrollHeight, PADDING_TOP, innerHeight - scrollHeight - PADDING_TOP) + 'px';
// elem.style.top = (innerHeight - scrollHeight - PADDING_TOP) + 'px'; // elem.style.top = (innerHeight - scrollHeight - PADDING_TOP) + 'px';
verticalSide = 'top'; verticalSide = 'top';
} else { } else {

Loading…
Cancel
Save