|
|
|
@ -123,14 +123,13 @@ export const Magnifier: React.FC<MagnifierProps> = ({ instance, size: initialSiz
|
|
|
|
|
waitFor(() => instance.state.readyState === "READY", () => {
|
|
|
|
|
const elem = document.getElementById(ELEMENT_ID) as HTMLDivElement;
|
|
|
|
|
element.current = elem;
|
|
|
|
|
elem.firstElementChild!.setAttribute("draggable", "false");
|
|
|
|
|
elem.querySelector("img,video")?.setAttribute("draggable", "false");
|
|
|
|
|
if (instance.props.animated) {
|
|
|
|
|
originalVideoElementRef.current = elem!.querySelector("video")!;
|
|
|
|
|
originalVideoElementRef.current.addEventListener("timeupdate", syncVideos);
|
|
|
|
|
setReady(true);
|
|
|
|
|
} else {
|
|
|
|
|
setReady(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setReady(true);
|
|
|
|
|
});
|
|
|
|
|
document.addEventListener("keydown", onKeyDown);
|
|
|
|
|
document.addEventListener("keyup", onKeyUp);
|
|
|
|
@ -155,7 +154,9 @@ export const Magnifier: React.FC<MagnifierProps> = ({ instance, size: initialSiz
|
|
|
|
|
|
|
|
|
|
if (!ready) return null;
|
|
|
|
|
|
|
|
|
|
const box = element.current!.getBoundingClientRect();
|
|
|
|
|
const box = element.current?.getBoundingClientRect();
|
|
|
|
|
|
|
|
|
|
if (!box) return null;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|