Skip to content

Commit

Permalink
[Devansh/Akshay] #236077 Fix position of tooltip to be relative to ac…
Browse files Browse the repository at this point in the history
…tive blip
  • Loading branch information
devansh-sharma-tw committed Apr 17, 2023
1 parent 9ee5492 commit 67cf571
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
14 changes: 14 additions & 0 deletions src/graphing/components/quadrantTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ function renderBlipDescription(blip, ring, quadrant, tip, groupBlipTooltipText)

if (displayToolTip) {
tip.show(toolTipText, selectedBlipOnGraph.node())

const selectedBlipCoords = selectedBlipOnGraph.node().getBoundingClientRect()

const tipElement = d3.select('div.d3-tip')
const tipElementCoords = tipElement.node().getBoundingClientRect()

tipElement
.style(
'left',
`${parseInt(
selectedBlipCoords.left + window.scrollX - tipElementCoords.width / 2 + selectedBlipCoords.width / 2,
)}px`,
)
.style('top', `${parseInt(selectedBlipCoords.top + window.scrollY - tipElementCoords.height)}px`)
}
}

Expand Down
8 changes: 0 additions & 8 deletions src/graphing/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ const Radar = function (size, radar) {
})

tip.direction(function () {
if (d3.select('.quadrant-table.selected').node()) {
var selectedQuadrant = d3.select('.quadrant-table.selected')
if (selectedQuadrant.classed('first') || selectedQuadrant.classed('fourth')) {
return 'ne'
} else {
return 'nw'
}
}
return 'n'
})

Expand Down

0 comments on commit 67cf571

Please sign in to comment.