Skip to content

Commit

Permalink
Make dimensions optional
Browse files Browse the repository at this point in the history
  • Loading branch information
samirelanduk committed Jan 28, 2022
1 parent e650ca0 commit 2ac1e97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Molstar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ const Molstar = props => {
await plugin.builders.structure.hierarchy.applyPreset(traj, "default");
}

if (!dimensions) return <div ref={pluginElement} />
const width = dimensions ? dimensions[0] : "100%";
const height = dimensions ? dimensions[1] : "100%";

return (
<div ref={parentRef} style={{position: "relative", width: dimensions[0], height: dimensions[1]}}>
<div ref={parentRef} style={{position: "relative", width, height}}>
<canvas
ref={canvasRef}
style={{position: "absolute", top: 0, left: 0, right: 0, bottom: 0}}
Expand Down

0 comments on commit 2ac1e97

Please sign in to comment.