Skip to content

Commit 5a0ecd9

Browse files
committed
Updates
1 parent 82a50e6 commit 5a0ecd9

3 files changed

Lines changed: 9 additions & 23 deletions

File tree

src/LinearMafDisplay/util.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@ export function generateTooltipContent(
4444
contentLines.push(`Ref: ${p2.refName}:${toLocale(p2.coord)}`)
4545

4646
if (hoveredInfo) {
47-
const { base, sampleId, pos, chr } = hoveredInfo
47+
const { base, sampleId, pos, chr, isInsertion } = hoveredInfo
4848
const thresh = 20
4949
const len = base.length
5050
const lengthSuffix = len > 1 ? ` ${len}bp` : ''
5151
const baseDisplay =
5252
base.length > thresh ? base.slice(0, thresh) + '...' : base
53+
const insertionLabel = isInsertion ? ' Insertion' : ''
5354

5455
contentLines.push(
55-
`Alt ${sampleId}: ${chr}:${pos.toLocaleString('en-US')} (${baseDisplay}${lengthSuffix})`,
56+
`Alt ${sampleId}: ${chr}:${pos.toLocaleString('en-US')} (${baseDisplay}${lengthSuffix}${insertionLabel})`,
5657
)
5758
}
5859
}

src/LinearMafRenderer/rendering/insertions.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,17 @@ export function renderInsertions(
102102
actualXPos = xPos
103103
actualWidth = INSERTION_LINE_WIDTH
104104
fillRect(ctx, actualXPos, rowTop, actualWidth, h, canvasWidth, 'purple')
105+
106+
// Always use a wider hit box for spatial index, even if visual is 1px
107+
const hitBoxPadding = 2
108+
actualXPos = xPos - hitBoxPadding
109+
actualWidth = INSERTION_LINE_WIDTH + 2 * hitBoxPadding
110+
105111
if (
106112
bpPerPx < HIGH_ZOOM_THRESHOLD &&
107113
rowHeight > MIN_ROW_HEIGHT_FOR_BORDERS
108114
) {
109115
// Add horizontal borders for visibility at high zoom
110-
// Note: borders extend the effective clickable area
111-
actualXPos = xPos - INSERTION_BORDER_WIDTH
112-
actualWidth = INSERTION_BORDER_HEIGHT
113116
fillRect(
114117
ctx,
115118
xPos - INSERTION_BORDER_WIDTH,

src/LinearMafRenderer/rendering/matches.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { fillRect } from '../util'
2-
import { addToSpatialIndex, shouldAddToSpatialIndex } from './spatialIndex'
32
import { GAP_STROKE_OFFSET } from './types'
43

54
import type { RenderingContext } from './types'
@@ -37,23 +36,6 @@ export function renderMatches(
3736
currentChar !== ' '
3837
) {
3938
fillRect(ctx, xPos, rowTop, scale + GAP_STROKE_OFFSET, h, canvasWidth)
40-
41-
// Add to spatial index if distance filter allows
42-
if (shouldAddToSpatialIndex(xPos, context)) {
43-
addToSpatialIndex(
44-
context,
45-
xPos,
46-
rowTop,
47-
xPos + context.scale + GAP_STROKE_OFFSET,
48-
rowTop + context.h,
49-
{
50-
pos: genomicOffset + alignmentStart,
51-
chr,
52-
base: currentChar || '',
53-
sampleId,
54-
},
55-
)
56-
}
5739
}
5840
genomicOffset++
5941
}

0 commit comments

Comments
 (0)