-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow flipping RGB visualizations on X and Y
- Loading branch information
Showing
6 changed files
with
184 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import { ImageType, mockValues, RgbVis } from '@h5web/lib'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import FillHeight from './decorators/FillHeight'; | ||
|
||
const dataArray = mockValues.threeD_rgb(); | ||
|
||
const meta = { | ||
title: 'Visualizations/RgbVis', | ||
component: RgbVis, | ||
decorators: [FillHeight], | ||
parameters: { | ||
layout: 'fullscreen', | ||
controls: { sort: 'requiredFirst' }, | ||
}, | ||
args: { | ||
dataArray, | ||
aspect: 'equal', | ||
showGrid: true, | ||
}, | ||
argTypes: { | ||
dataArray: { control: false }, | ||
aspect: { | ||
control: { type: 'inline-radio' }, | ||
options: ['auto', 'equal', 0.25], | ||
}, | ||
}, | ||
} satisfies Meta<typeof RgbVis>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default = {} satisfies Story; | ||
|
||
export const BGR = { | ||
args: { | ||
imageType: ImageType.BGR, | ||
}, | ||
} satisfies Story; | ||
|
||
export const AxisValues = { | ||
args: { | ||
abscissaParams: { | ||
value: Array.from( | ||
{ length: dataArray.shape[1] }, // works even when right edge of last pixel is not provided | ||
(_, i) => 100 + 10 * i, | ||
), | ||
}, | ||
ordinateParams: { | ||
value: Array.from( | ||
{ length: dataArray.shape[0] + 1 }, | ||
(_, i) => -100 + 10 * i, | ||
), | ||
}, | ||
}, | ||
} satisfies Story; | ||
|
||
export const DescendingAxisValues = { | ||
args: { | ||
abscissaParams: { | ||
value: Array.from( | ||
{ length: dataArray.shape[1] }, // works even when right edge of last pixel is not provided | ||
(_, i) => -100 - 10 * i, | ||
), | ||
}, | ||
ordinateParams: { | ||
value: Array.from( | ||
{ length: dataArray.shape[0] + 1 }, | ||
(_, i) => -100 - 10 * i, | ||
), | ||
}, | ||
}, | ||
} satisfies Story; | ||
|
||
export const TypedArray = { | ||
args: { | ||
dataArray: mockValues.int8_rgb(), | ||
}, | ||
} satisfies Story; | ||
|
||
export const ChangeInteractionKeys = { | ||
args: { | ||
interactions: { | ||
pan: { modifierKey: 'Shift' }, | ||
selectToZoom: { modifierKey: 'Control' }, | ||
}, | ||
}, | ||
} satisfies Story; | ||
|
||
export const AutoAspectRatio = { | ||
args: { | ||
aspect: 'auto', | ||
}, | ||
} satisfies Story; | ||
|
||
export const CustomAspectRatio = { | ||
args: { | ||
aspect: 0.25, | ||
}, | ||
} satisfies Story; | ||
|
||
export const FlipXAxis = { | ||
args: { | ||
dataArray, | ||
flipXAxis: true, | ||
}, | ||
} satisfies Story; | ||
|
||
export const FlipYAxis = { | ||
args: { | ||
dataArray, | ||
flipYAxis: true, | ||
}, | ||
} satisfies Story; | ||
|
||
export const NoGrid = { | ||
args: { | ||
showGrid: false, | ||
}, | ||
} satisfies Story; | ||
|
||
export const WithTitle = { | ||
args: { | ||
title: 'RGB image', | ||
}, | ||
} satisfies Story; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters