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: shift sequence views such that centered markers are visible #713

Merged
merged 2 commits into from
Feb 10, 2022
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
4 changes: 3 additions & 1 deletion packages/web/src/components/SequenceView/PeptideView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import styled from 'styled-components'

import type { AnalysisResult, Gene, GeneWarning, Warnings } from 'src/algorithms/types'
import type { State } from 'src/state/reducer'
import { AA_MIN_WIDTH_PX } from 'src/constants'
import { selectGeneMap } from 'src/state/algorithm/algorithm.selectors'
import { useTranslationSafe } from 'src/helpers/useTranslationSafe'
import { getSafeId } from 'src/helpers/getSafeId'
Expand Down Expand Up @@ -135,7 +136,8 @@ export function PeptideViewUnsizedDisconnected({ width, sequence, warnings, gene

return (
<SequenceViewWrapper>
<SequenceViewSVG viewBox={`0 0 ${width} 10`}>
{/* Padding of 1/2 of an AA is added on both sides, such that the markers close to the edges are visible */}
<SequenceViewSVG viewBox={`${-AA_MIN_WIDTH_PX / 2} 0 ${width + AA_MIN_WIDTH_PX / 2} 10`}>
<rect fill="transparent" x={0} y={-10} width={gene.length} height="30" />

{unknownAaRangesForGene &&
Expand Down
4 changes: 3 additions & 1 deletion packages/web/src/components/SequenceView/SequenceView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import styled from 'styled-components'
import { selectGenomeSize } from 'src/state/algorithm/algorithm.selectors'
import type { State } from 'src/state/reducer'
import type { AnalysisResult } from 'src/algorithms/types'
import { BASE_MIN_WIDTH_PX } from 'src/constants'

import { SequenceMarkerGap } from './SequenceMarkerGap'
import { SequenceMarkerMissing } from './SequenceMarkerMissing'
Expand Down Expand Up @@ -98,7 +99,8 @@ export function SequenceViewUnsizedDisconnected({ sequence, width, genomeSize }:

return (
<SequenceViewWrapper>
<SequenceViewSVG viewBox={`0 0 ${width} 10`}>
{/* Padding of 1/2 of a nuc is added on both sides, such that the markers close to the edges are visible */}
<SequenceViewSVG viewBox={`${-BASE_MIN_WIDTH_PX / 2} 0 ${width + BASE_MIN_WIDTH_PX / 2} 10`}>
<rect fill="transparent" x={0} y={-10} width={genomeSize} height="30" />
<SequenceMarkerUnsequencedStart
seqName={seqName}
Expand Down