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

Fix state file backwards compatibility and Keyboard shortcut config docs #453

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 14 additions & 1 deletion documentation/content/doc/loading_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ By loading a JSON file, you can set VolView's:
- Starting view layout (Axial Only, 3D Primary, etc).
- Labels for tools
- Visibility of Sample Data section
- Keyboard shortcuts

#### Starting view layout

Expand All @@ -71,12 +72,20 @@ The `activeLayout` key has options (Axial Only, 3D Primary, etc.) defined in `co
#### Labels for tools

Each tool type (Rectangle, Polygon, etc.) can have tool specific labels. To share labels
across tools, define the `defaultLabels` key and don't provide the tool's specific label key.
across tools, define the `defaultLabels` key and don't provide labels for a tool that
should use the default labels.

#### Visibility of Sample Data section

Simplify the data browser by hiding the Sample Data expandable section.

#### Keyboard Shortcuts

Configure the keys to activate tools, change selected labels, and more.
All [shortcut actions](https://github.com/Kitware/VolView/blob/main/src/constants.ts#L53) are under the `ACTIONS` variable.

To configure a key for an action, add its action name and the key(s) under the `shortcuts` section. For key combinations, use `+` like `Ctrl+f`.

#### Example JSON:

```json
Expand Down Expand Up @@ -126,6 +135,10 @@ Simplify the data browser by hiding the Sample Data expandable section.
"dataBrowser": {
"hideSampleData": false
}
"shortcuts": {
"polygon": "Ctrl+p",
"showKeyboardShortcuts": "t"
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion src/io/state-file/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const annotationTool = z.object({
id: z.string() as unknown as z.ZodType<ToolID>,
name: z.string(),
color: z.string(),
strokeWidth: z.number(),
strokeWidth: z.number().optional(),
label: z.string().optional(),
labelName: z.string().optional(),
}) satisfies z.ZodType<AnnotationTool>;
Expand Down
2 changes: 1 addition & 1 deletion src/types/annotation-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type AnnotationTool = {
labelName?: string;

color: string;
strokeWidth: number;
strokeWidth?: number;

name: string;

Expand Down
Loading