diff --git a/packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/util.ts b/packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/util.ts index 143df1831..dffed2e64 100644 --- a/packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/util.ts +++ b/packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/util.ts @@ -104,8 +104,16 @@ export function isMouseOnFeatureEdge( const { refName, regionNumber, x } = mousePosition const { lgv } = stateModel const { offsetPx } = lgv - const minPxInfo = lgv.bpToPx({ refName, coord: feature.min, regionNumber }) - const maxPxInfo = lgv.bpToPx({ refName, coord: feature.max, regionNumber }) + const minPxInfo = lgv.bpToPx({ + refName, + coord: feature.min, + displayedRegionIndex: regionNumber, + }) + const maxPxInfo = lgv.bpToPx({ + refName, + coord: feature.max, + displayedRegionIndex: regionNumber, + }) if (minPxInfo !== undefined && maxPxInfo !== undefined) { const minPx = minPxInfo.offsetPx - offsetPx const maxPx = maxPxInfo.offsetPx - offsetPx diff --git a/packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/stateModel/rendering.ts b/packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/stateModel/rendering.ts index 12d38c281..6ce2472c6 100644 --- a/packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/stateModel/rendering.ts +++ b/packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/stateModel/rendering.ts @@ -138,7 +138,7 @@ export function renderingModelFactory( const locationStartPxInfo = self.lgv.bpToPx({ refName: refSeq, coord: start, - regionNumber: idx, + displayedRegionIndex: idx, }) if (!locationStartPxInfo) { continue diff --git a/packages/jbrowse-plugin-apollo/src/LinearApolloReferenceSequenceDisplay/stateModel/base.ts b/packages/jbrowse-plugin-apollo/src/LinearApolloReferenceSequenceDisplay/stateModel/base.ts index 6b5d90d11..f8f019d87 100644 --- a/packages/jbrowse-plugin-apollo/src/LinearApolloReferenceSequenceDisplay/stateModel/base.ts +++ b/packages/jbrowse-plugin-apollo/src/LinearApolloReferenceSequenceDisplay/stateModel/base.ts @@ -14,7 +14,6 @@ import { import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes' import { type AbstractSessionModel, - type Region, getContainingView, getSession, } from '@jbrowse/core/util' @@ -95,8 +94,9 @@ export function baseModelFactory( .views((self) => ({ get expandedRegions() { const regions = self.lgv.dynamicBlocks.contentBlocks.map((block) => { - const { assemblyName, end, refName, start } = block - const { parentRegion } = block as unknown as { parentRegion: Region } + const { assemblyName, displayedRegionIndex, end, refName, start } = + block + const parentRegion = self.lgv.displayedRegions[displayedRegionIndex] const expandedStart = Math.round( Math.max(start - 5, parentRegion.start), ) diff --git a/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/components/LinearApolloSixFrameDisplay.tsx b/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/components/LinearApolloSixFrameDisplay.tsx index 4c58e1168..25f9e119b 100644 --- a/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/components/LinearApolloSixFrameDisplay.tsx +++ b/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/components/LinearApolloSixFrameDisplay.tsx @@ -186,7 +186,7 @@ export const LinearApolloSixFrameDisplay = observer( (lgv.bpToPx({ refName: region.refName, coord: checkResult.start, - regionNumber: idx, + displayedRegionIndex: idx, })?.offsetPx ?? 0) - lgv.offsetPx const [feature] = checkResult.featureIds if ( diff --git a/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/glyphs/GeneGlyph.ts b/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/glyphs/GeneGlyph.ts index 75db4bcfc..c93cb6cd5 100644 --- a/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/glyphs/GeneGlyph.ts +++ b/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/glyphs/GeneGlyph.ts @@ -174,7 +174,7 @@ function draw( (lgv.bpToPx({ refName, coord: min, - regionNumber: displayedRegionIndex, + displayedRegionIndex, })?.offsetPx ?? 0) - offsetPx const topLevelFeatureWidthPx = topLevelFeature.length / bpPerPx const topLevelFeatureStartPx = reversed @@ -275,7 +275,7 @@ function draw( (lgv.bpToPx({ refName, coord: exon.min, - regionNumber: displayedRegionIndex, + displayedRegionIndex, })?.offsetPx ?? 0) - offsetPx const widthPx = exon.length / bpPerPx const startPx = reversed ? minX - widthPx : minX @@ -341,7 +341,7 @@ function draw( (lgv.bpToPx({ refName, coord: cds.min, - regionNumber: displayedRegionIndex, + displayedRegionIndex, })?.offsetPx ?? 0) - offsetPx cdsStartPx = reversed ? minX - cdsWidthPx : minX ctx.fillStyle = theme.palette.text.primary @@ -525,7 +525,7 @@ function drawOverlay( (lgv.bpToPx({ refName, coord: cds.min, - regionNumber: layoutIndex, + displayedRegionIndex: layoutIndex, })?.offsetPx ?? 0) - offsetPx const cdsStartPx = reversed ? minX - cdsWidthPx : minX const frame = getFrame(cds.min, cds.max, strand ?? 1, cds.phase) @@ -788,7 +788,7 @@ function drawTooltip( (lgv.bpToPx({ refName, coord: reversed ? max : min, - regionNumber: layoutIndex, + displayedRegionIndex: layoutIndex, })?.offsetPx ?? 0) - offsetPx const frame = getFrame(min, max, strand ?? 1, phase) const frameOffsets = showFeatureLabels diff --git a/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/stateModel/rendering.ts b/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/stateModel/rendering.ts index 7337068a0..fa4226a09 100644 --- a/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/stateModel/rendering.ts +++ b/packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/stateModel/rendering.ts @@ -151,7 +151,7 @@ export function renderingModelFactory( const locationStartPxInfo = self.lgv.bpToPx({ refName: refSeq, coord: start, - regionNumber: idx, + displayedRegionIndex: idx, }) if (!locationStartPxInfo) { continue diff --git a/packages/jbrowse-plugin-apollo/src/util/glyphUtils.ts b/packages/jbrowse-plugin-apollo/src/util/glyphUtils.ts index 3fc6f7563..c4aac67fa 100644 --- a/packages/jbrowse-plugin-apollo/src/util/glyphUtils.ts +++ b/packages/jbrowse-plugin-apollo/src/util/glyphUtils.ts @@ -236,12 +236,12 @@ export function getMinAndMaxPx( const minPxInfo = lgv.bpToPx({ refName, coord: feature.min, - regionNumber, + displayedRegionIndex: regionNumber, }) const maxPxInfo = lgv.bpToPx({ refName, coord: feature.max, - regionNumber, + displayedRegionIndex: regionNumber, }) if (minPxInfo === undefined || maxPxInfo === undefined) { return