diff --git a/packages/core/util/layouts/PrecomputedLayout.ts b/packages/core/util/layouts/PrecomputedLayout.ts index 390412c0d4..9b87fa889f 100644 --- a/packages/core/util/layouts/PrecomputedLayout.ts +++ b/packages/core/util/layouts/PrecomputedLayout.ts @@ -70,6 +70,10 @@ export default class PrecomputedLayout implements BaseLayout { return this.rbush.collides(rect) ? this.rbush.search(rect)[0].name : [] } + getByID(id: string) { + return this.rectangles.get(id) + } + addRectToBitmap(_rect: Rectangle, _data: Record): void { throw new Error('Method not implemented.') } diff --git a/plugins/alignments/src/LinearAlignmentsDisplay/models/model.tsx b/plugins/alignments/src/LinearAlignmentsDisplay/models/model.tsx index 0314415366..72fd60d2e8 100644 --- a/plugins/alignments/src/LinearAlignmentsDisplay/models/model.tsx +++ b/plugins/alignments/src/LinearAlignmentsDisplay/models/model.tsx @@ -65,8 +65,8 @@ const stateModelFactory = ( } }, - get layoutFeatures() { - return self.PileupDisplay.layoutFeatures + getFeatureByID(id: string) { + return self.PileupDisplay.getFeatureByID(id) }, get features() { diff --git a/plugins/breakpoint-split-view/src/model.ts b/plugins/breakpoint-split-view/src/model.ts index 4c99694365..39872bdef9 100644 --- a/plugins/breakpoint-split-view/src/model.ts +++ b/plugins/breakpoint-split-view/src/model.ts @@ -230,7 +230,7 @@ export default function stateModelFactory(pluginManager: any) { const tracks = this.getMatchedTracks(trackConfigId) const calc = (track: any, feat: Feature) => - track.displays[0].layoutFeatures.get(feat.id()) + track.displays[0].getFeatureByID(feat.id()) return features.map(c => c.map(feature => { diff --git a/plugins/linear-comparative-view/src/BreakpointSplitRenderer/BreakpointSplitRenderer.ts b/plugins/linear-comparative-view/src/BreakpointSplitRenderer/BreakpointSplitRenderer.ts index fdc1e4980a..17d6ac483e 100644 --- a/plugins/linear-comparative-view/src/BreakpointSplitRenderer/BreakpointSplitRenderer.ts +++ b/plugins/linear-comparative-view/src/BreakpointSplitRenderer/BreakpointSplitRenderer.ts @@ -64,7 +64,7 @@ function* generateLayoutMatches( track && !middle ? // prettier-ignore // @ts-ignore - track.layoutFeatures.get(String(feature.id())) + track.features.get(String(feature.id())) : ([feature.get('start'), 0, feature.get('end'), 0] as LayoutRecord) return { feature, diff --git a/plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx b/plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx index ddc517ca1a..fec69a6a40 100644 --- a/plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +++ b/plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx @@ -168,6 +168,17 @@ export const BaseLinearDisplay = types getFeatureOverlapping(blockKey: string, x: number, y: number) { return self.blockState.get(blockKey)?.layout?.getByCoord(x, y) }, + + getFeatureByID(id: string) { + let ret + self.blockState.forEach(block => { + const val = block?.layout?.getByID(id) + if (val) { + ret = val + } + }) + return ret + }, } }) .actions(self => ({