mirror of
https://github.com/Vendicated/Vencord
synced 2024-08-26 03:37:47 -04:00
fix occasional errors in Dearrow & ImageZoom
This commit is contained in:
parent
c2f8837602
commit
5b35d7c644
2 changed files with 9 additions and 5 deletions
|
@ -182,8 +182,8 @@ export default definePlugin({
|
|||
|
||||
// add dearrow button
|
||||
{
|
||||
match: /children:\[(?=null!=\i\?\i\.renderSuppressButton)/,
|
||||
replace: "children:[$self.renderButton(this),",
|
||||
match: /children:\[(?=null!=\i\?(\i)\.renderSuppressButton)/,
|
||||
replace: "children:[$self.renderButton($1),",
|
||||
predicate: () => !settings.store.hideButton
|
||||
}
|
||||
]
|
||||
|
|
|
@ -67,15 +67,18 @@ export const Magnifier = ErrorBoundary.wrap<MagnifierProps>(({ instance, size: i
|
|||
}
|
||||
};
|
||||
const syncVideos = () => {
|
||||
currentVideoElementRef.current!.currentTime = originalVideoElementRef.current!.currentTime;
|
||||
if (currentVideoElementRef.current && originalVideoElementRef.current)
|
||||
currentVideoElementRef.current.currentTime = originalVideoElementRef.current.currentTime;
|
||||
};
|
||||
|
||||
const updateMousePosition = (e: MouseEvent) => {
|
||||
if (!element.current) return;
|
||||
|
||||
if (instance.state.mouseOver && instance.state.mouseDown) {
|
||||
const offset = size.current / 2;
|
||||
const pos = { x: e.pageX, y: e.pageY };
|
||||
const x = -((pos.x - element.current!.getBoundingClientRect().left) * zoom.current - offset);
|
||||
const y = -((pos.y - element.current!.getBoundingClientRect().top) * zoom.current - offset);
|
||||
const x = -((pos.x - element.current.getBoundingClientRect().left) * zoom.current - offset);
|
||||
const y = -((pos.y - element.current.getBoundingClientRect().top) * zoom.current - offset);
|
||||
setLensPosition({ x: e.x - offset, y: e.y - offset });
|
||||
setImagePosition({ x, y });
|
||||
setOpacity(1);
|
||||
|
@ -184,6 +187,7 @@ export const Magnifier = ErrorBoundary.wrap<MagnifierProps>(({ instance, size: i
|
|||
src={originalVideoElementRef.current?.src ?? instance.props.src}
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
/>
|
||||
) : (
|
||||
<img
|
||||
|
|
Loading…
Reference in a new issue