diff --git a/packages/core/package.json b/packages/core/package.json index ea4fd5d13a..518fd37e0f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -53,6 +53,7 @@ "load-script2": "^2.0.5", "object.fromentries": "^2.0.0", "pako": "^1.0.10", + "rbush": "^3.0.1", "react-error-boundary": "^3.0.0", "react-intersection-observer": "^8.31.0", "react-measure": "^2.3.0", diff --git a/packages/core/util/layouts/GranularRectLayout.ts b/packages/core/util/layouts/GranularRectLayout.ts index f52dabe816..693507ace4 100644 --- a/packages/core/util/layouts/GranularRectLayout.ts +++ b/packages/core/util/layouts/GranularRectLayout.ts @@ -31,13 +31,13 @@ interface RowState { min: number max: number offset: number - bits: (Record | boolean | undefined)[] + bits: (Record | string | undefined)[] } // a single row in the layout class LayoutRow { private padding: number - private allFilled?: Record | boolean + private allFilled?: Record | string private widthLimit: number @@ -60,11 +60,11 @@ class LayoutRow { // console.log(`r${this.rowNumber}: ${msg}`) // } - setAllFilled(data: Record | boolean): void { + setAllFilled(data: Record | string): void { this.allFilled = data } - getItemAt(x: number): Record | boolean | undefined { + getItemAt(x: number): Record | string | undefined { if (this.allFilled) { return this.allFilled } @@ -128,7 +128,7 @@ class LayoutRow { // this.log(`initialize ${this.rowState.min} - ${this.rowState.max} (${this.rowState.bits.length})`) } - addRect(rect: Rectangle, data: Record | boolean): void { + addRect(rect: Rectangle, data: Record | string): void { const left = rect.l const right = rect.r + this.padding // only padding on the right if (!this.rowState) { @@ -466,7 +466,7 @@ export default class GranularRectLayout implements BaseLayout { return } - const data = rect.data || rect.id || true + const data = rect.data || rect.id const { bitmap } = this const yEnd = rect.top + rect.h if (rect.r - rect.l > maxFeaturePitchWidth) { @@ -507,7 +507,7 @@ export default class GranularRectLayout implements BaseLayout { return this.rectangles.has(id) } - getByCoord(x: number, y: number): Record | boolean | undefined { + getByCoord(x: number, y: number): Record | string | undefined { const pY = Math.floor(y / this.pitchY) const row = this.bitmap[pY] if (!row) { @@ -517,10 +517,10 @@ export default class GranularRectLayout implements BaseLayout { return row.getItemAt(pX) } - getByID(id: string): (Record | boolean) | undefined { + getByID(id: string): (Record | string) | undefined { const r = this.rectangles.get(id) if (r) { - return r.data || true + return r.data || r.id } return undefined } diff --git a/plugins/linear-genome-view/package.json b/plugins/linear-genome-view/package.json index fec6a21915..c6e5c8356a 100644 --- a/plugins/linear-genome-view/package.json +++ b/plugins/linear-genome-view/package.json @@ -43,7 +43,6 @@ "is-object": "^1.0.1", "json-stable-stringify": "^1.0.1", "normalize-wheel": "^1.0.1", - "rbush": "^3.0.1", "react-sizeme": "^2.6.7" }, "peerDependencies": { diff --git a/plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx b/plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx index fec69a6a40..9740b7954d 100644 --- a/plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +++ b/plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx @@ -18,7 +18,6 @@ import Typography from '@material-ui/core/Typography' import MenuOpenIcon from '@material-ui/icons/MenuOpen' import { autorun } from 'mobx' import { addDisposer, Instance, isAlive, types, getEnv } from 'mobx-state-tree' -import RBush from 'rbush' import React from 'react' import { Tooltip } from '../components/BaseLinearDisplay' import BlockState, { renderBlockData } from './serverSideRenderedBlock'