@bwp-web/canvas 0.9.0 → 0.9.1
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/index.js
CHANGED
|
@@ -2826,6 +2826,9 @@ function useViewCanvas(options) {
|
|
|
2826
2826
|
const [zoom, setZoom] = useState2(1);
|
|
2827
2827
|
const [objects, setObjects] = useState2([]);
|
|
2828
2828
|
const [isLoading, setIsLoading] = useState2(false);
|
|
2829
|
+
const [lockLightMode, setLockLightMode] = useState2(
|
|
2830
|
+
void 0
|
|
2831
|
+
);
|
|
2829
2832
|
const onReady = useCallback2(
|
|
2830
2833
|
(canvas) => {
|
|
2831
2834
|
canvasRef.current = canvas;
|
|
@@ -2873,6 +2876,9 @@ function useViewCanvas(options) {
|
|
|
2873
2876
|
if (opts?.invertBackground !== void 0) {
|
|
2874
2877
|
setBackgroundInverted(canvas, opts.invertBackground);
|
|
2875
2878
|
}
|
|
2879
|
+
if (canvas.lockLightMode !== void 0) {
|
|
2880
|
+
setLockLightMode(canvas.lockLightMode);
|
|
2881
|
+
}
|
|
2876
2882
|
if (opts?.autoFitToBackground !== false && canvas.backgroundImage) {
|
|
2877
2883
|
fitViewportToBackground(canvas);
|
|
2878
2884
|
syncZoom(canvasRef, setZoom);
|
|
@@ -2969,11 +2975,13 @@ function useViewCanvas(options) {
|
|
|
2969
2975
|
/** Batch-update multiple objects' visual styles in one render. Keyed by `data.id`. */
|
|
2970
2976
|
setObjectStyles,
|
|
2971
2977
|
/** Apply a visual style to all objects whose `data.type` matches. */
|
|
2972
|
-
setObjectStyleByType
|
|
2978
|
+
setObjectStyleByType,
|
|
2979
|
+
/** Whether the canvas is locked to light mode. Read from loaded canvas data. */
|
|
2980
|
+
lockLightMode
|
|
2973
2981
|
}),
|
|
2974
2982
|
// Only reactive state in deps — refs and stable callbacks are omitted
|
|
2975
2983
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2976
|
-
[zoom, objects, isLoading, viewport]
|
|
2984
|
+
[zoom, objects, isLoading, viewport, lockLightMode]
|
|
2977
2985
|
);
|
|
2978
2986
|
}
|
|
2979
2987
|
|
|
@@ -3246,11 +3254,12 @@ function ViewCanvasProvider({
|
|
|
3246
3254
|
isLoading: canvas.isLoading,
|
|
3247
3255
|
setObjectStyle: canvas.setObjectStyle,
|
|
3248
3256
|
setObjectStyles: canvas.setObjectStyles,
|
|
3249
|
-
setObjectStyleByType: canvas.setObjectStyleByType
|
|
3257
|
+
setObjectStyleByType: canvas.setObjectStyleByType,
|
|
3258
|
+
lockLightMode: canvas.lockLightMode
|
|
3250
3259
|
}),
|
|
3251
3260
|
// Only reactive state — stable callbacks omitted
|
|
3252
3261
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3253
|
-
[canvas.objects, canvas.isLoading]
|
|
3262
|
+
[canvas.objects, canvas.isLoading, canvas.lockLightMode]
|
|
3254
3263
|
);
|
|
3255
3264
|
return /* @__PURE__ */ jsx3(CanvasRefContext.Provider, { value: canvas.canvasRef, children: /* @__PURE__ */ jsx3(ViewViewportContext.Provider, { value: viewportValue, children: /* @__PURE__ */ jsx3(ViewStateContext.Provider, { value: stateValue, children }) }) });
|
|
3256
3265
|
}
|