Add viewportGridVisible prop and effect to ViewportCanvas

This commit is contained in:
2026-04-11 02:40:59 +02:00
parent 3211bd2f7a
commit 8786e4c12b

View File

@@ -37,6 +37,7 @@ interface ViewportCanvasProps {
whiteboxSelectionMode: WhiteboxSelectionMode;
whiteboxSnapEnabled: boolean;
whiteboxSnapStep: number;
viewportGridVisible: boolean;
selection: EditorSelection;
toolMode: ToolMode;
toolPreview: ViewportToolPreview;
@@ -67,6 +68,7 @@ export function ViewportCanvas({
whiteboxSelectionMode,
whiteboxSnapEnabled,
whiteboxSnapStep,
viewportGridVisible,
selection,
toolMode,
toolPreview,
@@ -138,6 +140,10 @@ export function ViewportCanvas({
hostRef.current?.setWhiteboxSnapSettings(whiteboxSnapEnabled, whiteboxSnapStep);
}, [whiteboxSnapEnabled, whiteboxSnapStep]);
useEffect(() => {
hostRef.current?.setGridVisible(viewportGridVisible);
}, [viewportGridVisible]);
useEffect(() => {
hostRef.current?.setWhiteboxSelectionMode(whiteboxSelectionMode);
}, [whiteboxSelectionMode]);
@@ -156,7 +162,7 @@ export function ViewportCanvas({
useEffect(() => {
hostRef.current?.setCameraState(cameraState);
}, [cameraState]);
}, [cameraState, sceneDocument, transformSession.kind]);
useEffect(() => {
hostRef.current?.setBrushSelectionChangeHandler(onSelectionChange);