Skip to content

Commit

Permalink
More accurate row height
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jan 29, 2025
1 parent bf7dfec commit f314acb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
13 changes: 11 additions & 2 deletions plugins/variants/src/MultiLinearVariantMatrixDisplay/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ export default function stateModelFactory(
}),
)

.volatile(() => ({
/**
* #volatile
*/
lineZoneHeight: 20,
}))
.views(self => ({
get nrow() {
return self.sources?.length || 1
},
/**
* #getter
*/
Expand All @@ -45,15 +54,15 @@ export default function stateModelFactory(
get totalHeight() {
return self.autoHeight
? self.height - self.lineZoneHeight
: (self.sources?.length || 1) * self.rowHeightSetting
: this.nrow * self.rowHeightSetting
},

/**
* #getter
*/
get rowHeight() {
return self.autoHeight
? self.height / (self.sources?.length || 1)
? self.totalHeight / this.nrow
: self.rowHeightSetting
},
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ export async function renderSvg(
) {
await when(() => !!model.regionCannotBeRenderedText)
const { offsetPx } = getContainingView(model) as LinearGenomeViewModel
const { lineZoneHeight } = model
return (
<>
<g transform={`translate(${Math.max(-offsetPx, 0)})`}>
<LinesConnectingMatrixToGenomicPosition exportSVG model={model} />
<g transform={`translate(0,${model.lineZoneHeight})`}>
<g transform={`translate(0,${lineZoneHeight})`}>
<g>{await superRenderSvg(opts)}</g>
<LegendBar model={model} orientation="left" exportSVG />
</g>
Expand Down
4 changes: 0 additions & 4 deletions plugins/variants/src/shared/MultiVariantBaseModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ export default function MultiVariantBaseModelF(
* #volatile
*/
featuresVolatile: undefined as Feature[] | undefined,
/**
* #volatile
*/
lineZoneHeight: 20,
/**
* #volatile
*/
Expand Down

0 comments on commit f314acb

Please sign in to comment.