Skip to content

Commit

Permalink
Tmp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dariober committed Nov 4, 2024
1 parent fa7d2a0 commit 07b31c9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/apollo-shared/src/Checks/CDSCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
AnnotationFeatureSnapshot,
CheckResultSnapshot,
} from '@apollo-annotation/mst'
import { OntologyManager } from '@apollo-annotation/jbrowse-plugin-apollo'
import { intersection2 } from '@jbrowse/core/util'
import ObjectID from 'bson-objectid'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function selectColor(number: number) {
return `hsl(${hue},100%,50%)`
}

async function ApolloRendering(props: ApolloRenderingProps) {
function ApolloRendering(props: ApolloRenderingProps) {
const [contextCoord, setContextCoord] = useState<Coord>()
const [contextMenuFeature, setContextMenuFeature] =
useState<AnnotationFeature>()
Expand Down Expand Up @@ -109,6 +109,25 @@ async function ApolloRendering(props: ApolloRenderingProps) {
[],
)

const [totalHeight, setTotalHeight] = useState<number>()
useEffect(() => {
async function getTotalHeight() {
const totalHeight = await displayModel.getFeaturesHeight()
setTotalHeight(totalHeight)
}
void getTotalHeight()
})

const [featureLayout, setFeatureLayout] =
useState<Map<number, [string, AnnotationFeature][]>>()
useEffect(() => {
async function getFeatureLayout() {
const featureLayout = await displayModel.getFeatureLayout()
setFeatureLayout(featureLayout)
}
void getFeatureLayout()
})

const [region] = regions
const totalWidth = (region.end - region.start) / bpPerPx
const {
Expand All @@ -127,8 +146,8 @@ async function ApolloRendering(props: ApolloRenderingProps) {
showStartCodons: showStarts,
showStopCodons: showStops,
} = displayModel
const featureLayout = await displayModel.getFeatureLayout()
const totalHeight = await displayModel.getFeaturesHeight()
// const featureLayout = await displayModel.getFeatureLayout()
// const totalHeight = await displayModel.getFeaturesHeight()

// use this to convince useEffect that the features really did change
const featureSnap = [...features.values()].map((a) =>
Expand Down Expand Up @@ -183,6 +202,13 @@ async function ApolloRendering(props: ApolloRenderingProps) {
if (!ctx) {
return
}

async function getFeatureLayout() {
const featureLayout = await displayModel.getFeatureLayout()
setFeatureLayout(featureLayout)
}
void getFeatureLayout()

const transcript: Record<string, [number, number][]> = {}
ctx.clearRect(0, 0, totalWidth, totalHeight)
for (const [row, featureInfos] of featureLayout) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,17 @@ export const LinearApolloDisplay = observer(function LinearApolloDisplay(
setSeqTrackOverlayCanvas,
setTheme,
} = model
const featuresHeight = await model.getFeaturesHeight()
const { classes } = useStyles()
const lgv = getContainingView(model) as unknown as LinearGenomeViewModel

// const [featuresHeight, setFeatureHeight] = useState<number>()
// useEffect()
const [featuresHeight, setFeatureHeight] = useState<number>()
useEffect(() => {
async function getFeaturesHeight() {
const featuresHeight = await model.getFeaturesHeight()
setFeatureHeight(featuresHeight)
}
void getFeaturesHeight()
})

useEffect(() => {
setTheme(theme)
Expand All @@ -85,6 +90,7 @@ export const LinearApolloDisplay = observer(function LinearApolloDisplay(
height: number
} | null)[]
>([])

useEffect(() => {
async function getCheckInfo() {
const info = await Promise.all(
Expand Down

0 comments on commit 07b31c9

Please sign in to comment.