Skip to content

Commit 41cc492

Browse files
AmirMohammad CheraghaliAmirMohammad Cheraghali
authored andcommitted
fix: Studio Visuals panel — background, high-res render, show cursor
1 parent da9d6e9 commit 41cc492

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

src/App.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3007,7 +3007,7 @@ function App() {
30073007
smoothSheetEnabled={ctrl.smoothSheetEnabled}
30083008
palette={colorPalette}
30093009
backgroundColor={
3010-
(isStudioMode && recorder.session?.metadata?.settings?.backgroundColor)
3010+
(isStudioMode && recorder.session?.metadata?.settings?.backgroundColor !== undefined)
30113011
? recorder.session.metadata.settings.backgroundColor
30123012
: (ctrl.customBackgroundColor || (isLightMode ? 'white' : 'black'))
30133013
}
@@ -3057,6 +3057,16 @@ function App() {
30573057
? recorder.session.metadata.settings.ssao
30583058
: settings.ssao
30593059
}
3060+
pixelRatio={
3061+
(isStudioMode && recorder.session?.metadata?.settings?.resolutionScale !== undefined)
3062+
? recorder.session.metadata.settings.resolutionScale
3063+
: undefined
3064+
}
3065+
showCursor={
3066+
isStudioMode
3067+
? (recorder.session?.metadata?.settings?.showCursor ?? true)
3068+
: true
3069+
}
30603070
resetCamera={ctrl.resetKey}
30613071
disableScroll={!isScrollEnabled} // Scroll Protection
30623072

src/components/ProteinViewer.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export interface ProteinViewerProps {
5656
enableAmbientOcclusion?: boolean;
5757
smoothSheetEnabled?: boolean; // New toggle
5858
initialOrientation?: any; // New prop for setting start view
59+
pixelRatio?: number; // High-Res Render (e.g. 2 for 2x)
60+
showCursor?: boolean; // Show/hide cursor over viewer
5961

6062

6163

@@ -193,7 +195,9 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
193195
isInteractive = true,
194196
annotations,
195197
onAddAnnotation,
196-
remoteHoveredResidue
198+
remoteHoveredResidue,
199+
pixelRatio,
200+
showCursor = true,
197201
}: ProteinViewerProps, ref: React.Ref<ProteinViewerRef>) => {
198202

199203
const [isAlignmentOpen, setIsAlignmentOpen] = React.useState(false);
@@ -1670,6 +1674,20 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
16701674
}
16711675
}, [backgroundColor]);
16721676

1677+
// Apply device pixel ratio (High-Res Render)
1678+
useEffect(() => {
1679+
if (stageRef.current && pixelRatio !== undefined) {
1680+
stageRef.current.setParameters({ devicePixelRatio: pixelRatio });
1681+
}
1682+
}, [pixelRatio]);
1683+
1684+
// Apply cursor visibility
1685+
useEffect(() => {
1686+
if (containerRef.current) {
1687+
containerRef.current.style.cursor = showCursor ? '' : 'none';
1688+
}
1689+
}, [showCursor]);
1690+
16731691
useEffect(() => {
16741692
isMounted.current = true;
16751693
return () => { isMounted.current = false; };

0 commit comments

Comments
 (0)