-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol-designer, step-generation): x/Y tip positioning for asp…
…, disp, mix closes AUTH-5
- Loading branch information
Showing
36 changed files
with
1,405 additions
and
278 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
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
54 changes: 54 additions & 0 deletions
54
protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionAllViz.tsx
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,54 @@ | ||
import * as React from 'react' | ||
import round from 'lodash/round' | ||
|
||
import PIPETTE_TIP_IMAGE from '../../../../images/pipette_tip.svg' | ||
import WELL_CROSS_SECTION_IMAGE from '../../../../images/well_cross_section.svg' | ||
|
||
import styles from './TipPositionInput.module.css' | ||
|
||
const WELL_HEIGHT_PIXELS = 145 | ||
const WELL_WIDTH_PIXELS = 100 | ||
const PIXEL_DECIMALS = 2 | ||
|
||
interface TipPositionAllVizProps { | ||
mmFromBottom: number | ||
xPosition: number | ||
wellDepthMm: number | ||
xWidthMm: number | ||
} | ||
|
||
export const TipPositionAllViz = ( | ||
props: TipPositionAllVizProps | ||
): JSX.Element => { | ||
const { mmFromBottom, xPosition, wellDepthMm, xWidthMm } = props | ||
const fractionOfWellHeight = mmFromBottom / wellDepthMm | ||
const pixelsFromBottom = | ||
Number(fractionOfWellHeight) * WELL_HEIGHT_PIXELS - WELL_HEIGHT_PIXELS | ||
const roundedPixelsFromBottom = round(pixelsFromBottom, PIXEL_DECIMALS) | ||
const bottomPx = wellDepthMm | ||
? roundedPixelsFromBottom | ||
: mmFromBottom - WELL_HEIGHT_PIXELS | ||
|
||
const xPx = (WELL_WIDTH_PIXELS / xWidthMm) * xPosition | ||
const roundedXPx = round(xPx, PIXEL_DECIMALS) | ||
return ( | ||
<div className={styles.viz_wrapper}> | ||
<img | ||
src={PIPETTE_TIP_IMAGE} | ||
className={styles.pipette_tip_image} | ||
style={{ | ||
bottom: `${bottomPx}px`, | ||
left: `calc(${roundedXPx}px - 22px)`, | ||
}} | ||
/> | ||
|
||
{props.wellDepthMm !== null && ( | ||
<span className={styles.well_height_label}>{props.wellDepthMm}mm</span> | ||
)} | ||
<img | ||
src={WELL_CROSS_SECTION_IMAGE} | ||
className={styles.well_cross_section_image} | ||
/> | ||
</div> | ||
) | ||
} |
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
Oops, something went wrong.