Add render control based on layout mode and active panel
This commit is contained in:
@@ -88,6 +88,7 @@ export function ViewportCanvas({
|
|||||||
}: ViewportCanvasProps) {
|
}: ViewportCanvasProps) {
|
||||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||||
const hostRef = useRef<ViewportHost | null>(null);
|
const hostRef = useRef<ViewportHost | null>(null);
|
||||||
|
const shouldRenderPanel = layoutMode === "quad" || isActivePanel;
|
||||||
const [viewportMessage, setViewportMessage] = useState<string | null>(null);
|
const [viewportMessage, setViewportMessage] = useState<string | null>(null);
|
||||||
const [hoveredWhiteboxLabel, setHoveredWhiteboxLabel] = useState<string | null>(null);
|
const [hoveredWhiteboxLabel, setHoveredWhiteboxLabel] = useState<string | null>(null);
|
||||||
|
|
||||||
@@ -102,6 +103,7 @@ export function ViewportCanvas({
|
|||||||
const viewportHost = new ViewportHost();
|
const viewportHost = new ViewportHost();
|
||||||
hostRef.current = viewportHost;
|
hostRef.current = viewportHost;
|
||||||
viewportHost.setPanelId(panelId);
|
viewportHost.setPanelId(panelId);
|
||||||
|
viewportHost.setRenderEnabled(shouldRenderPanel);
|
||||||
viewportHost.mount(container);
|
viewportHost.mount(container);
|
||||||
setViewportMessage(null);
|
setViewportMessage(null);
|
||||||
|
|
||||||
@@ -116,6 +118,10 @@ export function ViewportCanvas({
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
hostRef.current?.setRenderEnabled(shouldRenderPanel);
|
||||||
|
}, [shouldRenderPanel]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
hostRef.current?.setPanelId(panelId);
|
hostRef.current?.setPanelId(panelId);
|
||||||
}, [panelId]);
|
}, [panelId]);
|
||||||
|
|||||||
Reference in New Issue
Block a user