@osamash/floor-planner 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floor-planner.es.js +161 -114
- package/dist/floor-planner.umd.js +4 -4
- package/dist/types/react-planner/constants.d.ts +13 -0
- package/dist/types/react-planner/hooks/usePlanThumbnail.d.ts +12 -3
- package/dist/types/react-planner/plugins/keyboard.d.ts +1 -1
- package/dist/types/react-planner/utils/visual-change.d.ts +12 -0
- package/package.json +1 -1
package/dist/floor-planner.es.js
CHANGED
|
@@ -3666,6 +3666,37 @@ const immutable_es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
|
|
|
3666
3666
|
MODE_ROTATING_ITEM,
|
|
3667
3667
|
MODE_WAITING_DRAWING_ROOM,
|
|
3668
3668
|
MODE_DRAWING_ROOM
|
|
3669
|
+
], MODE_2D_VIEWER = [
|
|
3670
|
+
MODE_IDLE$1,
|
|
3671
|
+
MODE_2D_ZOOM_IN,
|
|
3672
|
+
MODE_2D_ZOOM_OUT,
|
|
3673
|
+
MODE_2D_PAN,
|
|
3674
|
+
MODE_WAITING_DRAWING_ROOM,
|
|
3675
|
+
MODE_WAITING_DRAWING_LINE,
|
|
3676
|
+
MODE_WAITING_DRAWING_SURFACE,
|
|
3677
|
+
MODE_DRAGGING_LINE,
|
|
3678
|
+
MODE_DRAGGING_VERTEX,
|
|
3679
|
+
MODE_DRAGGING_ITEM,
|
|
3680
|
+
MODE_DRAWING_SURFACE,
|
|
3681
|
+
MODE_DRAWING_LINE,
|
|
3682
|
+
MODE_DRAWING_ROOM,
|
|
3683
|
+
MODE_DRAWING_HOLE,
|
|
3684
|
+
MODE_DRAWING_ITEM,
|
|
3685
|
+
MODE_DRAGGING_HOLE,
|
|
3686
|
+
MODE_ROTATING_ITEM,
|
|
3687
|
+
MODE_RESIZING_ITEM
|
|
3688
|
+
], MODE_IN_PROGRESS = [
|
|
3689
|
+
MODE_DRAWING_LINE,
|
|
3690
|
+
MODE_DRAWING_SURFACE,
|
|
3691
|
+
MODE_DRAWING_ROOM,
|
|
3692
|
+
MODE_DRAWING_HOLE,
|
|
3693
|
+
MODE_DRAWING_ITEM,
|
|
3694
|
+
MODE_DRAGGING_LINE,
|
|
3695
|
+
MODE_DRAGGING_VERTEX,
|
|
3696
|
+
MODE_DRAGGING_ITEM,
|
|
3697
|
+
MODE_DRAGGING_HOLE,
|
|
3698
|
+
MODE_ROTATING_ITEM,
|
|
3699
|
+
MODE_RESIZING_ITEM
|
|
3669
3700
|
], UNIT_MILLIMETER = "mm", UNIT_CENTIMETER = "cm", UNIT_METER = "m", UNIT_INCH = "in", UNIT_FOOT = "ft", UNIT_MILE = "mi", UNITS_LENGTH = [
|
|
3670
3701
|
UNIT_MILLIMETER,
|
|
3671
3702
|
UNIT_CENTIMETER,
|
|
@@ -3678,10 +3709,8 @@ const immutable_es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
|
|
|
3678
3709
|
BACKSPACE: 8,
|
|
3679
3710
|
ESC: 27,
|
|
3680
3711
|
Z: 90,
|
|
3681
|
-
ALT: 18,
|
|
3682
3712
|
C: 67,
|
|
3683
3713
|
V: 86,
|
|
3684
|
-
CTRL: 17,
|
|
3685
3714
|
ENTER: 13,
|
|
3686
3715
|
TAB: 9
|
|
3687
3716
|
}, toFixedFloat = (i, e = 6) => i && e ? parseFloat(parseFloat(i.toString()).toFixed(e)) : 0, fAbs = (i) => {
|
|
@@ -18193,7 +18222,10 @@ function Layer({ layer: i, scene: e, catalog: t, mode: n, showDimensions: s }) {
|
|
|
18193
18222
|
},
|
|
18194
18223
|
v.get("id")
|
|
18195
18224
|
)),
|
|
18196
|
-
f &&
|
|
18225
|
+
f && // Selection chrome, not plan content: dimming everything but the
|
|
18226
|
+
// selected room is the right thing on screen and the wrong thing in a
|
|
18227
|
+
// saved thumbnail, so the screenshot pass drops this whole group.
|
|
18228
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("g", { "data-fp-screenshot": "omit", children: [
|
|
18197
18229
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18198
18230
|
"rect",
|
|
18199
18231
|
{
|
|
@@ -18220,7 +18252,7 @@ function Layer({ layer: i, scene: e, catalog: t, mode: n, showDimensions: s }) {
|
|
|
18220
18252
|
`sel-${v}`
|
|
18221
18253
|
)) })
|
|
18222
18254
|
] }),
|
|
18223
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(WallHoverHandles, { layer: i })
|
|
18255
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("g", { "data-fp-screenshot": "omit", children: /* @__PURE__ */ jsxRuntimeExports.jsx(WallHoverHandles, { layer: i }) })
|
|
18224
18256
|
] });
|
|
18225
18257
|
}
|
|
18226
18258
|
const Scene$1 = ({ scene: i, catalog: e, mode: t, showDimensions: n }) => {
|
|
@@ -53879,25 +53911,6 @@ const STYLE_BOX$1 = {
|
|
|
53879
53911
|
]
|
|
53880
53912
|
}
|
|
53881
53913
|
);
|
|
53882
|
-
}, V_2D_MODES = {
|
|
53883
|
-
MODE_IDLE: MODE_IDLE$1,
|
|
53884
|
-
MODE_2D_ZOOM_IN,
|
|
53885
|
-
MODE_2D_ZOOM_OUT,
|
|
53886
|
-
MODE_2D_PAN,
|
|
53887
|
-
MODE_WAITING_DRAWING_ROOM,
|
|
53888
|
-
MODE_WAITING_DRAWING_LINE,
|
|
53889
|
-
MODE_WAITING_DRAWING_SURFACE,
|
|
53890
|
-
MODE_DRAGGING_LINE,
|
|
53891
|
-
MODE_DRAGGING_VERTEX,
|
|
53892
|
-
MODE_DRAGGING_ITEM,
|
|
53893
|
-
MODE_DRAWING_SURFACE,
|
|
53894
|
-
MODE_DRAWING_LINE,
|
|
53895
|
-
MODE_DRAWING_ROOM,
|
|
53896
|
-
MODE_DRAWING_HOLE,
|
|
53897
|
-
MODE_DRAWING_ITEM,
|
|
53898
|
-
MODE_DRAGGING_HOLE,
|
|
53899
|
-
MODE_ROTATING_ITEM,
|
|
53900
|
-
MODE_RESIZING_ITEM
|
|
53901
53914
|
};
|
|
53902
53915
|
function Content({ width: i, height: e, catalog: t }) {
|
|
53903
53916
|
const n = useReactPlannerStore(), { planner: s } = n, { mode: o } = s;
|
|
@@ -53982,7 +53995,7 @@ function Content({ width: i, height: e, catalog: t }) {
|
|
|
53982
53995
|
}
|
|
53983
53996
|
}
|
|
53984
53997
|
}
|
|
53985
|
-
) : o === MODE_3D_FIRST_PERSON ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}) : o === MODE_VIEWING_CATALOG ? /* @__PURE__ */ jsxRuntimeExports.jsx(CatalogList, { width: i, height: e, catalog: t }) :
|
|
53998
|
+
) : o === MODE_3D_FIRST_PERSON ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}) : o === MODE_VIEWING_CATALOG ? /* @__PURE__ */ jsxRuntimeExports.jsx(CatalogList, { width: i, height: e, catalog: t }) : MODE_2D_VIEWER.includes(o) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Viewer2D, { width: i, height: e, catalog: t }) : o === MODE_CONFIGURING_PROJECT ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}) : null;
|
|
53986
53999
|
}
|
|
53987
54000
|
const Footerbar = () => null, Panel = ({ children: i, name: e, subtitle: t, ...n }) => {
|
|
53988
54001
|
const [s, o] = useState(n.opened || !0);
|
|
@@ -56491,7 +56504,7 @@ const SimilarElementsGrid = ({
|
|
|
56491
56504
|
`Largest SVG is ${l}x${c}, too small to be the plan viewer`
|
|
56492
56505
|
);
|
|
56493
56506
|
const u = a.cloneNode(!0);
|
|
56494
|
-
await Promise.all(
|
|
56507
|
+
u.querySelectorAll('[data-fp-screenshot="omit"]').forEach((p) => p.remove()), await Promise.all(
|
|
56495
56508
|
Array.from(u.querySelectorAll("image")).map(async (p) => {
|
|
56496
56509
|
const f = p.getAttribute("href") || p.getAttribute("xlink:href");
|
|
56497
56510
|
if (!(!f || f.startsWith("data:")))
|
|
@@ -57875,14 +57888,43 @@ function autosave(i, e) {
|
|
|
57875
57888
|
};
|
|
57876
57889
|
};
|
|
57877
57890
|
}
|
|
57891
|
+
const SNAPPING_OFF = {
|
|
57892
|
+
[SNAP_POINT]: !1,
|
|
57893
|
+
[SNAP_LINE]: !1,
|
|
57894
|
+
[SNAP_SEGMENT]: !1,
|
|
57895
|
+
[SNAP_GRID]: !1,
|
|
57896
|
+
[SNAP_GUIDE]: !1
|
|
57897
|
+
};
|
|
57878
57898
|
function keyboard() {
|
|
57879
57899
|
return (i) => {
|
|
57880
|
-
const e = (
|
|
57881
|
-
|
|
57882
|
-
|
|
57900
|
+
const e = () => useReactPlannerStore.getState().planner;
|
|
57901
|
+
let t = null;
|
|
57902
|
+
const n = () => {
|
|
57903
|
+
if (t) return;
|
|
57904
|
+
const d = e();
|
|
57905
|
+
MODE_SNAPPING.includes(d.get("mode")) && (t = d.snapMask, i.toggleSnap(d.snapMask.merge(SNAPPING_OFF)));
|
|
57906
|
+
}, s = () => {
|
|
57907
|
+
if (!t) return;
|
|
57908
|
+
const d = t;
|
|
57909
|
+
t = null, i.toggleSnap(e().snapMask.merge(d));
|
|
57910
|
+
}, o = () => {
|
|
57911
|
+
e().alterate || i.setAlterateState();
|
|
57912
|
+
}, a = () => {
|
|
57913
|
+
e().alterate && i.setAlterateState();
|
|
57914
|
+
}, l = (d) => {
|
|
57915
|
+
d.getModifierState("Alt") ? n() : s(), d.getModifierState("Control") ? o() : a();
|
|
57916
|
+
}, c = () => {
|
|
57917
|
+
s(), a();
|
|
57918
|
+
}, u = (d) => {
|
|
57919
|
+
const p = d;
|
|
57920
|
+
return p != null && p.tagName ? ["INPUT", "TEXTAREA", "SELECT"].includes(p.tagName) || p.isContentEditable : !1;
|
|
57921
|
+
}, h = (d) => {
|
|
57922
|
+
if (l(d), u(d.target)) return;
|
|
57923
|
+
const p = e(), f = p.get("mode");
|
|
57924
|
+
switch (d.keyCode) {
|
|
57883
57925
|
case KEYBOARD_BUTTON_CODE.BACKSPACE:
|
|
57884
57926
|
case KEYBOARD_BUTTON_CODE.DELETE: {
|
|
57885
|
-
[MODE_IDLE$1, MODE_3D_FIRST_PERSON, MODE_3D_VIEW].includes(
|
|
57927
|
+
[MODE_IDLE$1, MODE_3D_FIRST_PERSON, MODE_3D_VIEW].includes(f) && i.remove();
|
|
57886
57928
|
break;
|
|
57887
57929
|
}
|
|
57888
57930
|
case KEYBOARD_BUTTON_CODE.ESC: {
|
|
@@ -57890,66 +57932,53 @@ function keyboard() {
|
|
|
57890
57932
|
break;
|
|
57891
57933
|
}
|
|
57892
57934
|
case KEYBOARD_BUTTON_CODE.Z: {
|
|
57893
|
-
(
|
|
57894
|
-
break;
|
|
57895
|
-
}
|
|
57896
|
-
case KEYBOARD_BUTTON_CODE.ALT: {
|
|
57897
|
-
MODE_SNAPPING.includes(o) && i.toggleSnap(
|
|
57898
|
-
s.snapMask.merge({
|
|
57899
|
-
SNAP_POINT: !1,
|
|
57900
|
-
SNAP_LINE: !1,
|
|
57901
|
-
SNAP_SEGMENT: !1,
|
|
57902
|
-
SNAP_GRID: !1,
|
|
57903
|
-
SNAP_GUIDE: !1,
|
|
57904
|
-
tempSnapConfiguartion: s.snapMask.toJS()
|
|
57905
|
-
})
|
|
57906
|
-
);
|
|
57935
|
+
(d.getModifierState("Control") || d.getModifierState("Meta")) && (d.getModifierState("Shift") ? i.redo() : i.undo());
|
|
57907
57936
|
break;
|
|
57908
57937
|
}
|
|
57909
57938
|
case KEYBOARD_BUTTON_CODE.C: {
|
|
57910
|
-
let
|
|
57939
|
+
let g = p.getIn(["scene", "selectedLayer"]), _ = p.getIn([
|
|
57911
57940
|
"scene",
|
|
57912
57941
|
"layers",
|
|
57913
|
-
|
|
57942
|
+
g,
|
|
57914
57943
|
"selected"
|
|
57915
57944
|
]);
|
|
57916
|
-
if ((
|
|
57917
|
-
if (
|
|
57918
|
-
let
|
|
57945
|
+
if ((f === MODE_IDLE$1 || f === MODE_3D_VIEW) && (_.holes.size || _.areas.size || _.items.size || _.lines.size)) {
|
|
57946
|
+
if (_.holes.size) {
|
|
57947
|
+
let x = p.getIn([
|
|
57919
57948
|
"scene",
|
|
57920
57949
|
"layers",
|
|
57921
|
-
|
|
57950
|
+
g,
|
|
57922
57951
|
"holes",
|
|
57923
|
-
|
|
57952
|
+
_.holes.get(0)
|
|
57924
57953
|
]);
|
|
57925
|
-
i.copyProperties(
|
|
57926
|
-
} else if (
|
|
57927
|
-
const
|
|
57954
|
+
i.copyProperties(x.get("properties"));
|
|
57955
|
+
} else if (_.areas.size) {
|
|
57956
|
+
const x = p.getIn([
|
|
57928
57957
|
"scene",
|
|
57929
57958
|
"layers",
|
|
57930
|
-
|
|
57959
|
+
g,
|
|
57931
57960
|
"areas",
|
|
57932
|
-
|
|
57961
|
+
_.areas.get(0)
|
|
57933
57962
|
]);
|
|
57934
|
-
i.copyProperties(
|
|
57935
|
-
} else if (
|
|
57936
|
-
const
|
|
57963
|
+
i.copyProperties(x.properties);
|
|
57964
|
+
} else if (_.items.size) {
|
|
57965
|
+
const x = p.getIn([
|
|
57937
57966
|
"scene",
|
|
57938
57967
|
"layers",
|
|
57939
|
-
|
|
57968
|
+
g,
|
|
57940
57969
|
"items",
|
|
57941
|
-
|
|
57970
|
+
_.items.get(0)
|
|
57942
57971
|
]);
|
|
57943
|
-
i.copyProperties(
|
|
57944
|
-
} else if (
|
|
57945
|
-
const
|
|
57972
|
+
i.copyProperties(x.properties);
|
|
57973
|
+
} else if (_.lines.size) {
|
|
57974
|
+
const x = p.getIn([
|
|
57946
57975
|
"scene",
|
|
57947
57976
|
"layers",
|
|
57948
|
-
|
|
57977
|
+
g,
|
|
57949
57978
|
"lines",
|
|
57950
|
-
|
|
57979
|
+
_.lines.get(0)
|
|
57951
57980
|
]);
|
|
57952
|
-
i.copyProperties(
|
|
57981
|
+
i.copyProperties(x.properties);
|
|
57953
57982
|
}
|
|
57954
57983
|
}
|
|
57955
57984
|
break;
|
|
@@ -57958,30 +57987,10 @@ function keyboard() {
|
|
|
57958
57987
|
i.pasteProperties();
|
|
57959
57988
|
break;
|
|
57960
57989
|
}
|
|
57961
|
-
case KEYBOARD_BUTTON_CODE.CTRL: {
|
|
57962
|
-
i.setAlterateState();
|
|
57963
|
-
break;
|
|
57964
|
-
}
|
|
57965
|
-
}
|
|
57966
|
-
}, t = (n) => {
|
|
57967
|
-
const s = i.planner, o = s.get("mode");
|
|
57968
|
-
switch (n.keyCode) {
|
|
57969
|
-
case KEYBOARD_BUTTON_CODE.ALT: {
|
|
57970
|
-
MODE_SNAPPING.includes(o) && i.toggleSnap(
|
|
57971
|
-
s.snapMask.merge(
|
|
57972
|
-
s.snapMask.get("tempSnapConfiguartion")
|
|
57973
|
-
)
|
|
57974
|
-
);
|
|
57975
|
-
break;
|
|
57976
|
-
}
|
|
57977
|
-
case KEYBOARD_BUTTON_CODE.CTRL: {
|
|
57978
|
-
i.setAlterateState();
|
|
57979
|
-
break;
|
|
57980
|
-
}
|
|
57981
57990
|
}
|
|
57982
57991
|
};
|
|
57983
|
-
return window.addEventListener("keydown",
|
|
57984
|
-
window.removeEventListener("keydown",
|
|
57992
|
+
return window.addEventListener("keydown", h), window.addEventListener("keyup", l), window.addEventListener("mousemove", l, { passive: !0 }), window.addEventListener("mousedown", l, { passive: !0 }), window.addEventListener("blur", c), document.addEventListener("visibilitychange", c), () => {
|
|
57993
|
+
s(), window.removeEventListener("keydown", h), window.removeEventListener("keyup", l), window.removeEventListener("mousemove", l), window.removeEventListener("mousedown", l), window.removeEventListener("blur", c), document.removeEventListener("visibilitychange", c);
|
|
57985
57994
|
};
|
|
57986
57995
|
};
|
|
57987
57996
|
}
|
|
@@ -59036,38 +59045,76 @@ const ContainerDimensions = ({
|
|
|
59036
59045
|
s.current && o && s.current.uninstall(o);
|
|
59037
59046
|
};
|
|
59038
59047
|
}, []), e ? typeof i == "function" ? i(e) : React.cloneElement(i, e) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: n });
|
|
59039
|
-
},
|
|
59048
|
+
}, DRAWABLE = ["vertices", "lines", "holes", "areas", "items"], sameIgnoringSelection = (i, e) => i.size !== e.size ? !1 : i.every((t, n) => {
|
|
59049
|
+
const s = e.get(n);
|
|
59050
|
+
return s === void 0 ? !1 : t === s ? !0 : t.set("selected", !1).equals(s.set("selected", !1));
|
|
59051
|
+
}), layerChanged = (i, e) => {
|
|
59052
|
+
if (!e) return !0;
|
|
59053
|
+
if (i === e) return !1;
|
|
59054
|
+
if (i.visible !== e.visible || i.opacity !== e.opacity || i.altitude !== e.altitude || i.order !== e.order)
|
|
59055
|
+
return !0;
|
|
59056
|
+
const t = i.selected !== e.selected;
|
|
59057
|
+
return DRAWABLE.some((n) => {
|
|
59058
|
+
const s = i[n], o = e[n];
|
|
59059
|
+
return s === o ? !1 : t ? !sameIgnoringSelection(s, o) : !0;
|
|
59060
|
+
});
|
|
59061
|
+
};
|
|
59062
|
+
function hasVisualChange(i, e) {
|
|
59063
|
+
if (i.showDimensions !== e.showDimensions || i.showGrid !== e.showGrid || i.theme !== e.theme)
|
|
59064
|
+
return !0;
|
|
59065
|
+
const t = i.planner.scene, n = e.planner.scene;
|
|
59066
|
+
if (t === n) return !1;
|
|
59067
|
+
if (t.width !== n.width || t.height !== n.height || t.unit !== n.unit || t.grids !== n.grids || t.guides !== n.guides)
|
|
59068
|
+
return !0;
|
|
59069
|
+
if (t.layers === n.layers) return !1;
|
|
59070
|
+
if (t.layers.size !== n.layers.size) return !0;
|
|
59071
|
+
const s = n.layers;
|
|
59072
|
+
return t.layers.some(
|
|
59073
|
+
(o, a) => layerChanged(o, s.get(a))
|
|
59074
|
+
);
|
|
59075
|
+
}
|
|
59076
|
+
const SETTLE_DELAY = 800, MAX_WAIT = 6e3, RETRY_DELAY = 2e3, MAX_RETRIES = 3, MAX_WIDTH = 1200, isCapturable = (i) => MODE_2D_VIEWER.includes(i) && !MODE_IN_PROGRESS.includes(i);
|
|
59040
59077
|
function usePlanThumbnail(i) {
|
|
59041
59078
|
const e = useRef(i);
|
|
59042
59079
|
e.current = i;
|
|
59043
|
-
const t = useRef(!1), n = useRef(null), s = useRef(null), o = useCallback((a = !1) => {
|
|
59044
|
-
|
|
59045
|
-
|
|
59046
|
-
|
|
59047
|
-
|
|
59048
|
-
|
|
59049
|
-
|
|
59050
|
-
|
|
59051
|
-
|
|
59052
|
-
|
|
59053
|
-
|
|
59054
|
-
|
|
59055
|
-
} finally {
|
|
59056
|
-
n.current = null;
|
|
59057
|
-
}
|
|
59058
|
-
})(), n.current);
|
|
59059
|
-
}, []);
|
|
59080
|
+
const t = useRef(!1), n = useRef(null), s = useRef(null), o = useCallback((a = !1) => !a && !t.current ? n.current ?? Promise.resolve() : n.current ? n.current : isCapturable(useReactPlannerStore.getState().planner.get("mode")) ? (t.current = !1, n.current = (async () => {
|
|
59081
|
+
var l;
|
|
59082
|
+
try {
|
|
59083
|
+
const c = await getSVGScreenshot({ maxWidth: MAX_WIDTH });
|
|
59084
|
+
if (c === s.current) return;
|
|
59085
|
+
s.current = c, (l = e.current) == null || l.call(e, c);
|
|
59086
|
+
} catch (c) {
|
|
59087
|
+
console.warn("Plan screenshot failed:", c), t.current = !0;
|
|
59088
|
+
} finally {
|
|
59089
|
+
n.current = null;
|
|
59090
|
+
}
|
|
59091
|
+
})(), n.current) : Promise.resolve(), []);
|
|
59060
59092
|
return useEffect(() => {
|
|
59061
|
-
let a = null, l =
|
|
59062
|
-
const
|
|
59063
|
-
|
|
59064
|
-
|
|
59065
|
-
|
|
59093
|
+
let a = null, l = null, c = 0;
|
|
59094
|
+
const u = () => {
|
|
59095
|
+
a = null, l = null, isCapturable(useReactPlannerStore.getState().planner.get("mode")) && o().then(() => {
|
|
59096
|
+
a || !t.current || c >= MAX_RETRIES || (c += 1, a = setTimeout(u, RETRY_DELAY * c));
|
|
59097
|
+
});
|
|
59066
59098
|
}, h = () => {
|
|
59067
|
-
|
|
59099
|
+
const g = Date.now();
|
|
59100
|
+
l === null && (l = g), a && clearTimeout(a), a = setTimeout(
|
|
59101
|
+
u,
|
|
59102
|
+
Math.max(0, Math.min(SETTLE_DELAY, l + MAX_WAIT - g))
|
|
59103
|
+
);
|
|
59104
|
+
}, d = useReactPlannerStore.subscribe((g, _) => {
|
|
59105
|
+
if (hasVisualChange(g, _)) {
|
|
59106
|
+
t.current = !0, c = 0, h();
|
|
59107
|
+
return;
|
|
59108
|
+
}
|
|
59109
|
+
const x = g.planner.get("mode");
|
|
59110
|
+
t.current && isCapturable(x) && !isCapturable(_.planner.get("mode")) && h();
|
|
59111
|
+
}), p = () => {
|
|
59112
|
+
a && clearTimeout(a), a = null, l = null, o();
|
|
59113
|
+
}, f = () => {
|
|
59114
|
+
document.visibilityState === "hidden" && p();
|
|
59068
59115
|
};
|
|
59069
|
-
return document.addEventListener("visibilitychange",
|
|
59070
|
-
a && clearTimeout(a),
|
|
59116
|
+
return document.addEventListener("visibilitychange", f), window.addEventListener("pagehide", p), () => {
|
|
59117
|
+
a && clearTimeout(a), d(), document.removeEventListener("visibilitychange", f), window.removeEventListener("pagehide", p), o();
|
|
59071
59118
|
};
|
|
59072
59119
|
}, [o]), { ensureScreenshot: o };
|
|
59073
59120
|
}
|