51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
|
|
* Module id: 487007
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(358379);
|
|
function n() {
|
|
let [e, n] = (0, t.useState)(!1);
|
|
(0, t.useEffect)(() => {
|
|
n(window.matchMedia("(pointer: coarse) and (hover: none)").matches);
|
|
}, []);
|
|
let i = (0, t.useMemo)(
|
|
() =>
|
|
e ? { panOnDrag: !0, nodesDraggable: !1, nodesConnectable: !1 } : {},
|
|
[e],
|
|
);
|
|
return { isTouchDevice: e, touchModeReactFlowProps: i };
|
|
}
|
|
function i(e, n) {
|
|
let i = (0, t.useRef)(0);
|
|
(0, t.useEffect)(() => {
|
|
if (!e) return;
|
|
let t = document.querySelector(".react-flow__pane");
|
|
if (!t) return;
|
|
let r = (e) => {
|
|
if (e.touches.length > 0) return;
|
|
let t = Date.now(),
|
|
r = t - i.current;
|
|
(i.current = t),
|
|
r > 0 &&
|
|
r < 300 &&
|
|
(e.preventDefault(),
|
|
n.current?.fitView({ padding: 0.15, duration: 300 }),
|
|
(i.current = 0));
|
|
};
|
|
return (
|
|
t.addEventListener("touchend", r, { passive: !1 }),
|
|
() => {
|
|
t.removeEventListener("touchend", r);
|
|
}
|
|
);
|
|
}, [e, n]);
|
|
}
|
|
e.s(["useDoubleTapFitView", () => i, "useTouchMode", () => n]);
|
|
};
|
|
|
|
export default moduleFactory;
|