Fix viewing reaction in sticker viewer
This commit is contained in:
parent
ed8ce86442
commit
07c1917b7c
@ -668,7 +668,7 @@ export default class ChatBubbles {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
attachStickerViewerListeners({listenTo: this.scrollable.container, listenerSetter: this.listenerSetter});
|
attachStickerViewerListeners({listenTo: this.scrollable.container, listenerSetter: this.listenerSetter, selector: '.attachment.media-sticker-wrapper'});
|
||||||
attachClickEvent(this.scrollable.container, this.onBubblesClick, {listenerSetter: this.listenerSetter});
|
attachClickEvent(this.scrollable.container, this.onBubblesClick, {listenerSetter: this.listenerSetter});
|
||||||
// this.listenerSetter.add(this.bubblesContainer)('click', this.onBubblesClick/* , {capture: true, passive: false} */);
|
// this.listenerSetter.add(this.bubblesContainer)('click', this.onBubblesClick/* , {capture: true, passive: false} */);
|
||||||
|
|
||||||
|
@ -28,20 +28,26 @@ import {wrapSticker} from './wrappers';
|
|||||||
import {STICKER_EFFECT_MULTIPLIER} from './wrappers/sticker';
|
import {STICKER_EFFECT_MULTIPLIER} from './wrappers/sticker';
|
||||||
|
|
||||||
let hasViewer = false;
|
let hasViewer = false;
|
||||||
export default function attachStickerViewerListeners({listenTo, listenerSetter}: {
|
export default function attachStickerViewerListeners({listenTo, listenerSetter, selector}: {
|
||||||
listenerSetter: ListenerSetter,
|
listenerSetter: ListenerSetter,
|
||||||
listenTo: HTMLElement
|
listenTo: HTMLElement,
|
||||||
|
selector?: string
|
||||||
}) {
|
}) {
|
||||||
if(IS_TOUCH_SUPPORTED) {
|
if(IS_TOUCH_SUPPORTED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const findTarget = (e: MouseEvent, checkForParent?: boolean) => {
|
||||||
|
const s = selector || `.media-sticker-wrapper`;
|
||||||
|
const el = (e.target as HTMLElement).closest(s) as HTMLElement;
|
||||||
|
return el && (!checkForParent || findUpAsChild(el, listenTo)) ? el : undefined;
|
||||||
|
};
|
||||||
|
|
||||||
const managers = rootScope.managers;
|
const managers = rootScope.managers;
|
||||||
const findClassName = 'media-sticker-wrapper';
|
|
||||||
|
|
||||||
listenerSetter.add(listenTo)('mousedown', (e) => {
|
listenerSetter.add(listenTo)('mousedown', (e) => {
|
||||||
if(hasViewer || e.buttons > 1 || e.button !== 0) return;
|
if(hasViewer || e.buttons > 1 || e.button !== 0) return;
|
||||||
let mediaContainer = findUpClassName(e.target, findClassName);
|
let mediaContainer = findTarget(e);
|
||||||
if(!mediaContainer) {
|
if(!mediaContainer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -228,7 +234,7 @@ export default function attachStickerViewerListeners({listenTo, listenerSetter}:
|
|||||||
}, 125);
|
}, 125);
|
||||||
|
|
||||||
const onMouseMove = async(e: MouseEvent) => {
|
const onMouseMove = async(e: MouseEvent) => {
|
||||||
const newMediaContainer = findUpClassName(e.target, 'media-sticker-wrapper');
|
const newMediaContainer = findTarget(e, true);
|
||||||
if(!newMediaContainer || mediaContainer === newMediaContainer) {
|
if(!newMediaContainer || mediaContainer === newMediaContainer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user