scroll selected rbf node into view

This commit is contained in:
Mononaut
2023-03-05 20:53:59 -06:00
parent f2749c67f3
commit 8d57aa1f06
2 changed files with 12 additions and 1 deletions

View File

@@ -42,8 +42,11 @@ export class RbfTimelineComponent implements OnInit, OnChanges {
this.rows = this.buildTimelines(this.replacements);
}
ngOnChanges(): void {
ngOnChanges(changes): void {
this.rows = this.buildTimelines(this.replacements);
if (changes.txid) {
setTimeout(() => { this.scrollToSelected(); });
}
}
// converts a tree of RBF events into a format that can be more easily rendered in HTML
@@ -166,6 +169,13 @@ export class RbfTimelineComponent implements OnInit, OnChanges {
return rows;
}
scrollToSelected() {
const node = document.getElementById('node-' + this.txid);
if (node) {
node.scrollIntoView({ block: 'nearest', inline: 'center' });
}
}
@HostListener('pointermove', ['$event'])
onPointerMove(event) {
this.tooltipPosition = { x: event.clientX, y: event.clientY };