Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fixed and responsive tracks #99

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/fixed-responsive.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Fixed and Responsive Layouts
etowahadams marked this conversation as resolved.
Show resolved Hide resolved
description: Make your visualization responsive to the screen size
---

Gosling visualizations can be fixed or responsive to the screen size.

## Fixed size

A Gosling visualization can have a fixed size by setting the `width` and `height` properties. The tracks will have a fixed size regardless of the screen size.

When the `width` and `height` properties are set in the root of the spec, all tracks will have this height and width unless they are overridden in the track specification.

```javascript
{
// highlight-start
width: 800,
height: 200,
// highlight-end
// ... rest of the Gosling spec
}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move this section down and bring the "Responsive size" up? I think it will better reflect the general interest of users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


## Responsive size
A Gosling visualization can be made responsive to the screen size by setting the `responsiveSize` property in the root of the Gosling specification. When the screen size changes, the visualization will automatically adjust its size to fit the screen.

Here is an example of a Gosling specification with responsive size enabled:

```javascript
{
// highlight-start
responsiveSize: { width: true },
// highlight-end
// ... rest of the Gosling spec
}
```
1 change: 1 addition & 0 deletions sidebarDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
'genome-builds',
'user-interaction',
'semantic-zoom',
'fixed-responsive',
],
},
{
Expand Down
Loading