Merge pull request #3622 from mempool/mononaut/shift-click
Key modifiers to open transaction in new tab from visualization
This commit is contained in:
		
						commit
						6b6dc9fb24
					
				| @ -23,7 +23,7 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On | ||||
|   @Input() unavailable: boolean = false; | ||||
|   @Input() auditHighlighting: boolean = false; | ||||
|   @Input() blockConversion: Price; | ||||
|   @Output() txClickEvent = new EventEmitter<TransactionStripped>(); | ||||
|   @Output() txClickEvent = new EventEmitter<{ tx: TransactionStripped, keyModifier: boolean}>(); | ||||
|   @Output() txHoverEvent = new EventEmitter<string>(); | ||||
|   @Output() readyEvent = new EventEmitter(); | ||||
| 
 | ||||
| @ -326,7 +326,9 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On | ||||
|     if (event.target === this.canvas.nativeElement && event.pointerType === 'touch') { | ||||
|       this.setPreviewTx(event.offsetX, event.offsetY, true); | ||||
|     } else if (event.target === this.canvas.nativeElement) { | ||||
|       this.onTxClick(event.offsetX, event.offsetY); | ||||
|       const keyMod = event.shiftKey || event.ctrlKey || event.metaKey; | ||||
|       const middleClick = event.which === 2 || event.button === 1; | ||||
|       this.onTxClick(event.offsetX, event.offsetY, keyMod || middleClick); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
| @ -409,12 +411,12 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   onTxClick(cssX: number, cssY: number) { | ||||
|   onTxClick(cssX: number, cssY: number, keyModifier: boolean = false) { | ||||
|     const x = cssX * window.devicePixelRatio; | ||||
|     const y = cssY * window.devicePixelRatio; | ||||
|     const selected = this.scene.getTxAt({ x, y }); | ||||
|     if (selected && selected.txid) { | ||||
|       this.txClickEvent.emit(selected); | ||||
|       this.txClickEvent.emit({ tx: selected, keyModifier }); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -612,9 +612,13 @@ export class BlockComponent implements OnInit, OnDestroy { | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   onTxClick(event: TransactionStripped): void { | ||||
|     const url = new RelativeUrlPipe(this.stateService).transform(`/tx/${event.txid}`); | ||||
|   onTxClick(event: { tx: TransactionStripped, keyModifier: boolean }): void { | ||||
|     const url = new RelativeUrlPipe(this.stateService).transform(`/tx/${event.tx.txid}`); | ||||
|     if (!event.keyModifier) { | ||||
|       this.router.navigate([url]); | ||||
|     } else { | ||||
|       window.open(url, '_blank'); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   onTxHover(txid: string): void { | ||||
|  | ||||
| @ -107,8 +107,12 @@ export class MempoolBlockOverviewComponent implements OnInit, OnDestroy, OnChang | ||||
|     this.isLoading$.next(false); | ||||
|   } | ||||
| 
 | ||||
|   onTxClick(event: TransactionStripped): void { | ||||
|     const url = new RelativeUrlPipe(this.stateService).transform(`/tx/${event.txid}`); | ||||
|   onTxClick(event: { tx: TransactionStripped, keyModifier: boolean }): void { | ||||
|     const url = new RelativeUrlPipe(this.stateService).transform(`/tx/${event.tx.txid}`); | ||||
|     if (!event.keyModifier) { | ||||
|       this.router.navigate([url]); | ||||
|     } else { | ||||
|       window.open(url, '_blank'); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user