Skip to content

Commit

Permalink
Fixup breakpoint split view
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jul 1, 2021
1 parent 6a7c087 commit b03d68c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/core/util/layouts/PrecomputedLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export default class PrecomputedLayout<T> implements BaseLayout<T> {
return this.rbush.collides(rect) ? this.rbush.search(rect)[0].name : []
}

getByID(id: string) {
return this.rectangles.get(id)
}

addRectToBitmap(_rect: Rectangle<T>, _data: Record<string, T>): void {
throw new Error('Method not implemented.')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ const stateModelFactory = (
}
},

get layoutFeatures() {
return self.PileupDisplay.layoutFeatures
getFeatureByID(id: string) {
return self.PileupDisplay.getFeatureByID(id)
},

get features() {
Expand Down
2 changes: 1 addition & 1 deletion plugins/breakpoint-split-view/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ({
Expand Down

0 comments on commit b03d68c

Please sign in to comment.