Skip to content

Commit

Permalink
update after holidays
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelcartier committed Aug 20, 2024
1 parent 16c6369 commit 6277528
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 42 deletions.
9 changes: 0 additions & 9 deletions src/components/SVGMassFragmentation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ export function SVGMassFragmentation({ sequence, analysisInfo, options }) {
viewBox={`0 0 ${options.width} ${data.height}`}
key={`SVG-${generateReactKey('')}`}
>
<style>
{`.sequenceElementStyle{
font: bold 12
}
.labelStyle{
font: ${labelSize}
}
`}
</style>
{data.lines.map((line, LineIndex) => (
<React.Fragment key={`SVGLine-${LineIndex}`}>

Check warning on line 49 in src/components/SVGMassFragmentation.jsx

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Do not use Array index in keys
<g
Expand Down
71 changes: 40 additions & 31 deletions src/components/SVGSequenceBreak.jsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,47 @@
import { SVGSequenceBreakFromBegin } from './SVGSequenceBreakFromBegin';
import { SVGSequenceBreakFromEnd } from './SVGSequenceBreakFromEnd';
import { SVGSequenceLabel } from './SVGSequenceLabel';

export function SVGSequenceBreak({ breaks, options }) {
const { spaceBetweenResidues = 30, strokeWidth = 2 } = options;
const {
spaceBetweenResidues = 30,
spaceBetweenInternalLines = 12,
strokeWidth = 2,
} = options;
return (
<>
{breaks
.filter((b) => b.fromBegin)
.map((b, index) => (
<g
transform={`translate(${-strokeWidth + b.position * spaceBetweenResidues} 0)`}
key={`group-SequenceBreakFromBegin-${index}`}
>
<SVGSequenceBreakFromBegin
sequenceBreak={b}
options={options}
key={`breakFromBegin-${index}`}
/>
</g>
))}
{breaks
.filter((b) => b.fromEnd)
.map((b, index) => (
<g
transform={`translate(${strokeWidth + b.position * spaceBetweenResidues} 0)`}
key={`group-SequenceBreakFromEnd-${index}`}
>
<SVGSequenceBreakFromEnd
sequenceBreak={b}
options={options}
key={`breakFromEnd-${index}`}
/>
</g>
))}
{breaks.map((sequenceBreak, index) => (
<g
transform={`translate(${(sequenceBreak.fromBegin ? -1 : 1) * strokeWidth + sequenceBreak.position * spaceBetweenResidues} 0)`}
key={`group-SequenceBreak-${index}`}
>
<line
y2={-8}
stroke={sequenceBreak.color}
strokeWidth={strokeWidth}
/>
<line
x2={sequenceBreak.fromBegin ? -5 : 5}
y1={sequenceBreak.fromBegin ? 0 : -8}
y2={sequenceBreak.fromBegin ? 5 : -8 - 5}
stroke={sequenceBreak.color}
strokeWidth={strokeWidth}
/>
{sequenceBreak.members.map((m, index) => (
<g
transform={`translate(0 ${sequenceBreak.fromBegin ? 2 + (index + 1) * spaceBetweenInternalLines : -15 - index * spaceBetweenInternalLines})`}
key={`group-breakLabel-${m.type}${index}`}
>
<SVGSequenceLabel
label={m.type}
charge={m.charge}
similarity={Math.trunc(m.similarity * 100)}
textColor={m.textColor}
options={options}
key={`breakLabel-${m.type}-${index}`}
/>
</g>
))}
</g>
))}
</>
);
}
29 changes: 27 additions & 2 deletions src/components/SVGSequenceBreakFromBegin.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { SVGSequenceLabel } from './SVGSequenceLabel';

export function SVGSequenceBreakFromBegin({ sequenceBreak, options }) {
const { spaceBetweenInternalLines = 12 } = options;
const { spaceBetweenInternalLines = 12, strokeWidth = 2 } = options;
return (
<>
<line y2={-8} stroke={sequenceBreak.color} />
<line y2={-8} stroke={sequenceBreak.color} strokeWidth={strokeWidth} />
<line x2={-5} y2={5} stroke={sequenceBreak.color} />
{sequenceBreak.members.map((m, index) => (
<g
Expand All @@ -24,3 +24,28 @@ export function SVGSequenceBreakFromBegin({ sequenceBreak, options }) {
</>
);
}

// export function SVGSequenceBreakFromEnd({ sequenceBreak, options }) {
// const { spaceBetweenInternalLines = 12 } = options;
// return (
// <>
// <line y2={-8} stroke={sequenceBreak.color} />
// <line y1={-8} x2={5} y2={-8 - 5} stroke={sequenceBreak.color} />
// {sequenceBreak.members.map((m, index) => (
// <g
// transform={`translate(5 ${-15 - index * spaceBetweenInternalLines})`}
// key={`group-breakLabel${m.type}${index}`}
// >
// <SVGSequenceLabel
// label={m.type}
// charge={m.charge}
// similarity={Math.trunc(m.similarity * 100)}
// textColor={m.textColor}
// options={options}
// key={`breakLabelFromEnd${m.type}${index}`}
// />
// </g>
// ))}
// </>
// );
// }

0 comments on commit 6277528

Please sign in to comment.