@@ -200,13 +200,13 @@ class GenomeAlignTrackWithoutOptions extends React.Component<PropsFromTrackConta
200200 }
201201
202202 // Add arrow to query region, arrow direction is determined by plotReverse.
203- renderRoughStrand ( strand : string , viewWindow : OpenInterval , roughHeight : number ) {
203+ renderRoughStrand ( strand : string , topY : number , viewWindow : OpenInterval , isPrimary : boolean ) {
204204 const plotReverse = strand === '-' ? true : false ;
205205 return < AnnotationArrows
206- key = { "roughArrow" + viewWindow . start }
206+ key = { "roughArrow" + viewWindow . start + isPrimary }
207207 startX = { viewWindow . start }
208208 endX = { viewWindow . end }
209- y = { roughHeight - RECT_HEIGHT }
209+ y = { topY }
210210 height = { RECT_HEIGHT }
211211 opacity = { 0.75 }
212212 isToRight = { ! plotReverse }
@@ -215,15 +215,24 @@ class GenomeAlignTrackWithoutOptions extends React.Component<PropsFromTrackConta
215215 }
216216
217217 renderRoughAlignment ( placement : PlacedMergedAlignment ,
218- plotReverse : boolean , roughHeight : number , fillColor : string ) {
219- const { queryFeature, queryXSpan, segments } = placement ;
218+ plotReverse : boolean , roughHeight : number ) {
219+ const { queryFeature, queryXSpan, segments, targetXSpan } = placement ;
220220 const queryRectTopY = roughHeight - RECT_HEIGHT ;
221+ const targetGenomeRect = < rect
222+ x = { targetXSpan . start }
223+ y = { 0 }
224+ width = { targetXSpan . getLength ( ) }
225+ height = { RECT_HEIGHT }
226+ fill = { this . props . options . primaryColor }
227+ // tslint:disable-next-line:jsx-no-lambda
228+ onClick = { ( ) => alert ( "You clicked on " + queryFeature . getLocus ( ) . toString ( ) ) }
229+ /> ;
221230 const queryGenomeRect = < rect
222231 x = { queryXSpan . start }
223232 y = { queryRectTopY }
224233 width = { queryXSpan . getLength ( ) }
225234 height = { RECT_HEIGHT }
226- fill = { fillColor }
235+ fill = { this . props . options . queryColor }
227236 // tslint:disable-next-line:jsx-no-lambda
228237 onClick = { ( ) => alert ( "You clicked on " + queryFeature . getLocus ( ) . toString ( ) ) }
229238 /> ;
@@ -245,10 +254,10 @@ class GenomeAlignTrackWithoutOptions extends React.Component<PropsFromTrackConta
245254
246255 const segmentPolygons = segments . map ( ( segment , i ) => {
247256 const points = [
248- [ Math . floor ( segment . targetXSpan . start ) , 0 ] ,
257+ [ Math . floor ( segment . targetXSpan . start ) , RECT_HEIGHT ] ,
249258 [ Math . floor ( segment . queryXSpan . start ) , queryRectTopY ] ,
250259 [ Math . ceil ( segment . queryXSpan . end ) , queryRectTopY ] ,
251- [ Math . ceil ( segment . targetXSpan . end ) , 0 ] ,
260+ [ Math . ceil ( segment . targetXSpan . end ) , RECT_HEIGHT ] ,
252261 ] ;
253262 if ( ( ! plotReverse && segment . record . queryStrand === '-' ) ||
254263 ( plotReverse && segment . record . queryStrand === '+' ) ) {
@@ -258,14 +267,15 @@ class GenomeAlignTrackWithoutOptions extends React.Component<PropsFromTrackConta
258267 return < polygon
259268 key = { i }
260269 points = { points as any } // Contrary to what Typescript thinks, you CAN pass a number[][].
261- fill = { fillColor }
270+ fill = { this . props . options . queryColor }
262271 fillOpacity = { 0.5 }
263272 // tslint:disable-next-line:jsx-no-lambda
264273 onClick = { ( ) => alert ( "You clicked on " + segment . record . getLocus ( ) ) }
265274 /> ;
266275 } ) ;
267276
268277 return < React . Fragment key = { queryFeature . getLocus ( ) . toString ( ) } >
278+ { targetGenomeRect }
269279 { queryGenomeRect }
270280 { label }
271281 { ensureMaxListLength ( segmentPolygons , MAX_POLYGONS ) }
@@ -297,7 +307,7 @@ class GenomeAlignTrackWithoutOptions extends React.Component<PropsFromTrackConta
297307 * @inheritdoc
298308 */
299309 render ( ) {
300- const { width, trackModel, alignment, options } = this . props ;
310+ const { width, trackModel, alignment, options, viewWindow } = this . props ;
301311 const { height, queryColor, primaryColor } = options ;
302312 let drawheight , svgElements = [ ] ;
303313 const hoverHeight = height - ALIGN_TRACK_MARGIN ;
@@ -331,12 +341,15 @@ class GenomeAlignTrackWithoutOptions extends React.Component<PropsFromTrackConta
331341 const queryXSpanArray = [ ] . concat . apply ( [ ] , queryXSpanArrayArray ) ;
332342 const strand = alignment . plotStrand ;
333343 svgElements = drawData . map ( placement =>
334- this . renderRoughAlignment ( placement , strand === '-' , height , queryColor ) ) ;
335- const viewWindow = alignment . primaryVisData . viewWindow ;
336- const arrow = this . renderRoughStrand ( strand , viewWindow , height ) ;
337- svgElements . push ( arrow ) ;
344+ this . renderRoughAlignment ( placement , strand === '-' , height ) ) ;
345+ const arrows = this . renderRoughStrand ( "+" , 0 , viewWindow , false ) ;
346+ svgElements . push ( arrows ) ;
347+ const primaryViewWindow = alignment . primaryVisData . viewWindow ;
348+ const primaryArrows = this . renderRoughStrand ( strand , height - RECT_HEIGHT , primaryViewWindow , true ) ;
349+ svgElements . push ( primaryArrows ) ;
338350 visualizer = < HorizontalFragment
339- height = { height - RECT_HEIGHT }
351+ height = { height }
352+ rectHeight = { RECT_HEIGHT }
340353 primaryColor = { primaryColor }
341354 queryColor = { queryColor }
342355 targetXSpanList = { targetXSpanArray }
0 commit comments