@cuemath/leap 3.1.5-aa0 → 3.1.5-aa1
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.
@@ -1,19 +1,19 @@
|
|
1
|
-
import { useEffect as
|
2
|
-
import { TOOLBAR_HEIGHT as r, WHITEBOARD_DEFAULT_HEIGHT as
|
3
|
-
import { useCueCanvasActions as
|
4
|
-
const
|
5
|
-
const { activeInstance: t } =
|
6
|
-
|
7
|
-
if (!(!t || h === "canvas") && (e != null && e.gridName && t.changeGrid(e == null ? void 0 : e.gridName), e != null && e.dimesion && t.setViewPort(e == null ? void 0 : e.dimesion), e != null && e.tool &&
|
8
|
-
const
|
9
|
-
|
1
|
+
import { useEffect as u } from "react";
|
2
|
+
import { TOOLBAR_HEIGHT as r, WHITEBOARD_DEFAULT_HEIGHT as l } from "../constants/constants.js";
|
3
|
+
import { useCueCanvasActions as p } from "./use-cue-canvas-actions.js";
|
4
|
+
const E = (e, h) => {
|
5
|
+
const { activeInstance: t, setActiveColor: d, setActiveTool: m } = p();
|
6
|
+
u(() => {
|
7
|
+
if (!(!t || h === "canvas") && (e != null && e.gridName && t.changeGrid(e == null ? void 0 : e.gridName), e != null && e.dimesion && t.setViewPort(e == null ? void 0 : e.dimesion), e != null && e.tool && m(e == null ? void 0 : e.tool), e != null && e.color && d(e == null ? void 0 : e.color), (e != null && e.height || (e == null ? void 0 : e.height) === void 0) && ((e == null ? void 0 : e.height) === void 0 || (e == null ? void 0 : e.height) > window.innerHeight - r))) {
|
8
|
+
const H = Math.min(
|
9
|
+
l - r,
|
10
10
|
window.innerHeight - r
|
11
11
|
);
|
12
|
-
t.updateHeight(
|
12
|
+
t.updateHeight(H);
|
13
13
|
}
|
14
|
-
}, [e, t, h]);
|
14
|
+
}, [e, t, h, d, m]);
|
15
15
|
};
|
16
16
|
export {
|
17
|
-
|
17
|
+
E as default
|
18
18
|
};
|
19
19
|
//# sourceMappingURL=use-config-updater.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-config-updater.js","sources":["../../../../src/features/cue-canvas/hooks/use-config-updater.ts"],"sourcesContent":["import type { ICanvasUpdateConfig, TRenderAs } from '../types/cue-canvas';\n\nimport { useEffect } from 'react';\n\nimport { TOOLBAR_HEIGHT, WHITEBOARD_DEFAULT_HEIGHT } from '../constants/constants';\nimport { useCueCanvasActions } from './use-cue-canvas-actions';\n\nconst useConfigUpdater = (\n canvasConfig: ICanvasUpdateConfig | null | undefined,\n renderAs: TRenderAs,\n) => {\n const { activeInstance: cueCanvas } = useCueCanvasActions();\n\n useEffect(() => {\n if (!cueCanvas || renderAs === 'canvas') {\n return;\n }\n\n if (canvasConfig?.gridName) {\n cueCanvas.changeGrid(canvasConfig?.gridName);\n }\n\n if (canvasConfig?.dimesion) {\n cueCanvas.setViewPort(canvasConfig?.dimesion);\n }\n\n if (canvasConfig?.tool) {\n
|
1
|
+
{"version":3,"file":"use-config-updater.js","sources":["../../../../src/features/cue-canvas/hooks/use-config-updater.ts"],"sourcesContent":["import type { ICanvasUpdateConfig, TRenderAs } from '../types/cue-canvas';\n\nimport { useEffect } from 'react';\n\nimport { TOOLBAR_HEIGHT, WHITEBOARD_DEFAULT_HEIGHT } from '../constants/constants';\nimport { useCueCanvasActions } from './use-cue-canvas-actions';\n\nconst useConfigUpdater = (\n canvasConfig: ICanvasUpdateConfig | null | undefined,\n renderAs: TRenderAs,\n) => {\n const { activeInstance: cueCanvas, setActiveColor, setActiveTool } = useCueCanvasActions();\n\n useEffect(() => {\n if (!cueCanvas || renderAs === 'canvas') {\n return;\n }\n\n if (canvasConfig?.gridName) {\n cueCanvas.changeGrid(canvasConfig?.gridName);\n }\n\n if (canvasConfig?.dimesion) {\n cueCanvas.setViewPort(canvasConfig?.dimesion);\n }\n\n if (canvasConfig?.tool) {\n setActiveTool(canvasConfig?.tool);\n }\n\n if (canvasConfig?.color) {\n setActiveColor(canvasConfig?.color);\n }\n\n if (canvasConfig?.height || canvasConfig?.height === undefined) {\n if (\n canvasConfig?.height === undefined ||\n canvasConfig?.height > window.innerHeight - TOOLBAR_HEIGHT\n ) {\n const canvasHeight = Math.min(\n WHITEBOARD_DEFAULT_HEIGHT - TOOLBAR_HEIGHT,\n window.innerHeight - TOOLBAR_HEIGHT,\n );\n\n cueCanvas.updateHeight(canvasHeight);\n }\n }\n }, [canvasConfig, cueCanvas, renderAs, setActiveColor, setActiveTool]);\n};\n\nexport default useConfigUpdater;\n"],"names":["useConfigUpdater","canvasConfig","renderAs","cueCanvas","setActiveColor","setActiveTool","useCueCanvasActions","useEffect","TOOLBAR_HEIGHT","canvasHeight","WHITEBOARD_DEFAULT_HEIGHT"],"mappings":";;;AAOM,MAAAA,IAAmB,CACvBC,GACAC,MACG;AACH,QAAM,EAAE,gBAAgBC,GAAW,gBAAAC,GAAgB,eAAAC,EAAA,IAAkBC;AAErE,EAAAC,EAAU,MAAM;AACV,QAAA,GAACJ,KAAaD,MAAa,cAI3BD,KAAA,QAAAA,EAAc,YACNE,EAAA,WAAWF,KAAA,gBAAAA,EAAc,QAAQ,GAGzCA,KAAA,QAAAA,EAAc,YACNE,EAAA,YAAYF,KAAA,gBAAAA,EAAc,QAAQ,GAG1CA,KAAA,QAAAA,EAAc,QAChBI,EAAcJ,KAAA,gBAAAA,EAAc,IAAI,GAG9BA,KAAA,QAAAA,EAAc,SAChBG,EAAeH,KAAA,gBAAAA,EAAc,KAAK,IAGhCA,KAAA,QAAAA,EAAc,WAAUA,KAAA,gBAAAA,EAAc,YAAW,aAEjDA,KAAA,gBAAAA,EAAc,YAAW,WACzBA,KAAA,gBAAAA,EAAc,UAAS,OAAO,cAAcO,KAC5C;AACA,YAAMC,IAAe,KAAK;AAAA,QACxBC,IAA4BF;AAAA,QAC5B,OAAO,cAAcA;AAAA,MAAA;AAGvB,MAAAL,EAAU,aAAaM,CAAY;AAAA,IACrC;AAAA,EACF,GACC,CAACR,GAAcE,GAAWD,GAAUE,GAAgBC,CAAa,CAAC;AACvE;"}
|