Skip to content

Commit

Permalink
Fix strand on arrows in horizontally flipped mode (#2877)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Apr 5, 2022
1 parent a867882 commit 5f654a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
14 changes: 11 additions & 3 deletions plugins/svg/src/SvgFeatureRenderer/components/Arrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,32 @@ import {
AnyConfigurationModel,
readConfObject,
} from '@jbrowse/core/configuration'
import { Feature } from '@jbrowse/core/util/simpleFeature'
import { SceneGraph } from '@jbrowse/core/util/layouts'
import { Region, Feature } from '@jbrowse/core/util'

const Arrow = ({
feature,
featureLayout,
config,
region,
}: {
region: Region
feature: Feature
featureLayout: SceneGraph
config: AnyConfigurationModel
}) => {
const strand = feature.get('strand')
const size = 5
const offset = 7 * strand
const reverseFlip = region.reversed ? -1 : 1
const offset = 7 * strand * reverseFlip
const { left = 0, top = 0, width = 0, height = 0 } = featureLayout.absolute
const color2 = readConfObject(config, 'color2', { feature })
const p = strand === -1 ? left : strand === 1 ? left + width : null
const p =
strand * reverseFlip === -1
? left
: strand * reverseFlip === 1
? left + width
: null
const y = top + height / 2

return p ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import { observer } from 'mobx-react'
import SimpleFeature, { Feature } from '@jbrowse/core/util/simpleFeature'
import {
AnyConfigurationModel,
readConfObject,
Expand All @@ -9,9 +8,11 @@ import {
import Segments from './Segments'
import { ExtraGlyphValidator, layOutFeature, layOutSubfeatures } from './util'
import { SceneGraph } from '@jbrowse/core/util/layouts'
import { Region, Feature, SimpleFeature } from '@jbrowse/core/util'

function ProcessedTranscript(props: {
feature: Feature
region: Region
config: AnyConfigurationModel
featureLayout: SceneGraph
selected?: boolean
Expand Down
3 changes: 2 additions & 1 deletion plugins/svg/src/SvgFeatureRenderer/components/Segments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import {
readConfObject,
} from '@jbrowse/core/configuration'
import { observer } from 'mobx-react'
import { Feature } from '@jbrowse/core/util/simpleFeature'
import Arrow from './Arrow'
import { SceneGraph } from '@jbrowse/core/util/layouts'
import { Region, Feature } from '@jbrowse/core/util'

function Segments(props: {
region: Region
feature: Feature
featureLayout: SceneGraph
config: AnyConfigurationModel
Expand Down

0 comments on commit 5f654a8

Please sign in to comment.