@bwp-web/canvas 0.9.1 → 0.9.2
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/hooks/useViewCanvas.d.ts +1 -0
- package/dist/hooks/useViewCanvas.d.ts.map +1 -1
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2873,12 +2873,15 @@ function useViewCanvas(options) {
|
|
|
2873
2873
|
initPromise.then(async () => {
|
|
2874
2874
|
const onReadyResult = opts?.onReady?.(canvas);
|
|
2875
2875
|
await Promise.resolve(onReadyResult);
|
|
2876
|
-
if (opts?.invertBackground !== void 0) {
|
|
2877
|
-
setBackgroundInverted(canvas, opts.invertBackground);
|
|
2878
|
-
}
|
|
2879
2876
|
if (canvas.lockLightMode !== void 0) {
|
|
2880
2877
|
setLockLightMode(canvas.lockLightMode);
|
|
2881
2878
|
}
|
|
2879
|
+
if (opts?.invertBackground !== void 0) {
|
|
2880
|
+
setBackgroundInverted(
|
|
2881
|
+
canvas,
|
|
2882
|
+
opts.invertBackground && !canvas.lockLightMode
|
|
2883
|
+
);
|
|
2884
|
+
}
|
|
2882
2885
|
if (opts?.autoFitToBackground !== false && canvas.backgroundImage) {
|
|
2883
2886
|
fitViewportToBackground(canvas);
|
|
2884
2887
|
syncZoom(canvasRef, setZoom);
|
|
@@ -2891,8 +2894,8 @@ function useViewCanvas(options) {
|
|
|
2891
2894
|
useEffect3(() => {
|
|
2892
2895
|
const canvas = canvasRef.current;
|
|
2893
2896
|
if (!canvas || options?.invertBackground === void 0) return;
|
|
2894
|
-
setBackgroundInverted(canvas, options.invertBackground);
|
|
2895
|
-
}, [options?.invertBackground]);
|
|
2897
|
+
setBackgroundInverted(canvas, options.invertBackground && !lockLightMode);
|
|
2898
|
+
}, [options?.invertBackground, lockLightMode]);
|
|
2896
2899
|
const { resetViewport: resetViewport2, zoomIn, zoomOut, panToObject, zoomToFit } = useViewportActions(canvasRef, viewportRef, setZoom);
|
|
2897
2900
|
const viewport = useMemo3(
|
|
2898
2901
|
() => ({
|