Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
Make batch viewer tooltip persistent on mobile (#116)
Browse files Browse the repository at this point in the history
* make tooltip persistent on mobile

* reuse removeListener call
  • Loading branch information
ramirotw authored Jun 14, 2022
1 parent 8255566 commit 01f2159
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/apps/explorer/components/TransanctionBatchGraph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,25 @@ function bindPopper(
const popperUpdate = (): void => popperRef.current?.scheduleUpdate()

target.on('position', () => popperUpdate)
target.cy().removeListener('pan zoom')
target.cy().removeListener('pan zoom tapstart')
target.cy().on('pan zoom resize', () => popperUpdate)
target.removeListener('click tapstart mouseout')
const newTarget = document.getElementById(tooltipId)
const removePopper = (): void => {
if (newTarget) {
newTarget.remove()
}
popperRef.current?.destroy()
}
target
.on('click tapstart', () => {
.on('click tapstart', (evt: Event) => {
evt.stopPropagation()
if (newTarget) {
newTarget.classList.add('active')
}
})
.on('mouseout tapend', () => {
if (newTarget) {
newTarget.remove()
}
popperRef.current?.destroy()
})
.on('mouseout', removePopper)
target.cy().on('tapstart', removePopper)
}

interface GraphBatchTxParams {
Expand Down

0 comments on commit 01f2159

Please sign in to comment.