Disable mined block animations
This commit is contained in:
		
							parent
							
								
									816263bd54
								
							
						
					
					
						commit
						f2780e65cd
					
				@ -26,6 +26,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
.loader-wrapper {
 | 
					.loader-wrapper {
 | 
				
			||||||
  position: absolute;
 | 
					  position: absolute;
 | 
				
			||||||
 | 
					  background: #181b2d7f;
 | 
				
			||||||
  left: 0;
 | 
					  left: 0;
 | 
				
			||||||
  right: 0;
 | 
					  right: 0;
 | 
				
			||||||
  top: 0;
 | 
					  top: 0;
 | 
				
			||||||
 | 
				
			|||||||
@ -68,6 +68,21 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy {
 | 
				
			|||||||
    this.start();
 | 
					    this.start();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  destroy(): void {
 | 
				
			||||||
 | 
					    if (this.scene) {
 | 
				
			||||||
 | 
					      this.scene.destroy();
 | 
				
			||||||
 | 
					      this.start();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // initialize the scene without any entry transition
 | 
				
			||||||
 | 
					  setup(transactions: TransactionStripped[]): void {
 | 
				
			||||||
 | 
					    if (this.scene) {
 | 
				
			||||||
 | 
					      this.scene.setup(transactions);
 | 
				
			||||||
 | 
					      this.start();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  enter(transactions: TransactionStripped[], direction: string): void {
 | 
					  enter(transactions: TransactionStripped[], direction: string): void {
 | 
				
			||||||
    if (this.scene) {
 | 
					    if (this.scene) {
 | 
				
			||||||
      this.scene.enter(transactions, direction);
 | 
					      this.scene.enter(transactions, direction);
 | 
				
			||||||
 | 
				
			|||||||
@ -29,10 +29,6 @@ export default class BlockScene {
 | 
				
			|||||||
    this.init({ width, height, resolution, blockLimit, orientation, flip, vertexArray });
 | 
					    this.init({ width, height, resolution, blockLimit, orientation, flip, vertexArray });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  destroy(): void {
 | 
					 | 
				
			||||||
    Object.values(this.txs).forEach(tx => tx.destroy());
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  resize({ width = this.width, height = this.height }: { width?: number, height?: number}): void {
 | 
					  resize({ width = this.width, height = this.height }: { width?: number, height?: number}): void {
 | 
				
			||||||
    this.width = width;
 | 
					    this.width = width;
 | 
				
			||||||
    this.height = height;
 | 
					    this.height = height;
 | 
				
			||||||
@ -46,6 +42,36 @@ export default class BlockScene {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Destroy the current layout and clean up graphics sprites without any exit animation
 | 
				
			||||||
 | 
					  destroy(): void {
 | 
				
			||||||
 | 
					    Object.values(this.txs).forEach(tx => tx.destroy());
 | 
				
			||||||
 | 
					    this.txs = {};
 | 
				
			||||||
 | 
					    this.layout = null;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // set up the scene with an initial set of transactions, without any transition animation
 | 
				
			||||||
 | 
					  setup(txs: TransactionStripped[]) {
 | 
				
			||||||
 | 
					    // clean up any old transactions
 | 
				
			||||||
 | 
					    Object.values(this.txs).forEach(tx => {
 | 
				
			||||||
 | 
					      tx.destroy();
 | 
				
			||||||
 | 
					      delete this.txs[tx.txid];
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    this.layout = new BlockLayout({ width: this.gridWidth, height: this.gridHeight });
 | 
				
			||||||
 | 
					    txs.forEach(tx => {
 | 
				
			||||||
 | 
					      const txView = new TxView(tx, this.vertexArray);
 | 
				
			||||||
 | 
					      this.txs[tx.txid] = txView;
 | 
				
			||||||
 | 
					      this.place(txView);
 | 
				
			||||||
 | 
					      this.saveGridToScreenPosition(txView);
 | 
				
			||||||
 | 
					      this.applyTxUpdate(txView, {
 | 
				
			||||||
 | 
					        display: {
 | 
				
			||||||
 | 
					          position: txView.screenPosition,
 | 
				
			||||||
 | 
					          color: txView.getColor()
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        duration: 0
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Animate new block entering scene
 | 
					  // Animate new block entering scene
 | 
				
			||||||
  enter(txs: TransactionStripped[], direction) {
 | 
					  enter(txs: TransactionStripped[], direction) {
 | 
				
			||||||
    this.replace(txs, direction);
 | 
					    this.replace(txs, direction);
 | 
				
			||||||
 | 
				
			|||||||
@ -2,9 +2,9 @@ import { Component, OnInit, OnDestroy, ViewChild, ElementRef } from '@angular/co
 | 
				
			|||||||
import { Location } from '@angular/common';
 | 
					import { Location } from '@angular/common';
 | 
				
			||||||
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
 | 
					import { ActivatedRoute, ParamMap, Router } from '@angular/router';
 | 
				
			||||||
import { ElectrsApiService } from '../../services/electrs-api.service';
 | 
					import { ElectrsApiService } from '../../services/electrs-api.service';
 | 
				
			||||||
import { switchMap, tap, debounceTime, catchError, map, shareReplay, startWith, pairwise } from 'rxjs/operators';
 | 
					import { switchMap, tap, throttleTime, catchError, map, shareReplay, startWith, pairwise } from 'rxjs/operators';
 | 
				
			||||||
import { Transaction, Vout } from '../../interfaces/electrs.interface';
 | 
					import { Transaction, Vout } from '../../interfaces/electrs.interface';
 | 
				
			||||||
import { Observable, of, Subscription } from 'rxjs';
 | 
					import { Observable, of, Subscription, asyncScheduler } from 'rxjs';
 | 
				
			||||||
import { StateService } from '../../services/state.service';
 | 
					import { StateService } from '../../services/state.service';
 | 
				
			||||||
import { SeoService } from 'src/app/services/seo.service';
 | 
					import { SeoService } from 'src/app/services/seo.service';
 | 
				
			||||||
import { WebsocketService } from 'src/app/services/websocket.service';
 | 
					import { WebsocketService } from 'src/app/services/websocket.service';
 | 
				
			||||||
@ -33,7 +33,6 @@ export class BlockComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
  strippedTransactions: TransactionStripped[];
 | 
					  strippedTransactions: TransactionStripped[];
 | 
				
			||||||
  overviewTransitionDirection: string;
 | 
					  overviewTransitionDirection: string;
 | 
				
			||||||
  isLoadingOverview = true;
 | 
					  isLoadingOverview = true;
 | 
				
			||||||
  isAwaitingOverview = true;
 | 
					 | 
				
			||||||
  error: any;
 | 
					  error: any;
 | 
				
			||||||
  blockSubsidy: number;
 | 
					  blockSubsidy: number;
 | 
				
			||||||
  fees: number;
 | 
					  fees: number;
 | 
				
			||||||
@ -124,6 +123,7 @@ export class BlockComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
          return of(history.state.data.block);
 | 
					          return of(history.state.data.block);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          this.isLoadingBlock = true;
 | 
					          this.isLoadingBlock = true;
 | 
				
			||||||
 | 
					          this.isLoadingOverview = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          let blockInCache: BlockExtended;
 | 
					          let blockInCache: BlockExtended;
 | 
				
			||||||
          if (isBlockHeight) {
 | 
					          if (isBlockHeight) {
 | 
				
			||||||
@ -170,13 +170,9 @@ export class BlockComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
        this.transactions = null;
 | 
					        this.transactions = null;
 | 
				
			||||||
        this.transactionsError = null;
 | 
					        this.transactionsError = null;
 | 
				
			||||||
        this.isLoadingOverview = true;
 | 
					        this.isLoadingOverview = true;
 | 
				
			||||||
        this.isAwaitingOverview = true;
 | 
					        this.overviewError = null;
 | 
				
			||||||
        this.overviewError = true;
 | 
					 | 
				
			||||||
        if (this.blockGraph) {
 | 
					 | 
				
			||||||
          this.blockGraph.exit(direction);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }),
 | 
					      }),
 | 
				
			||||||
      debounceTime(300),
 | 
					      throttleTime(300, asyncScheduler, { leading: true, trailing: true }),
 | 
				
			||||||
      shareReplay(1)
 | 
					      shareReplay(1)
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    this.transactionSubscription = block$.pipe(
 | 
					    this.transactionSubscription = block$.pipe(
 | 
				
			||||||
@ -194,11 +190,6 @@ export class BlockComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
      this.transactions = transactions;
 | 
					      this.transactions = transactions;
 | 
				
			||||||
      this.isLoadingTransactions = false;
 | 
					      this.isLoadingTransactions = false;
 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!this.isAwaitingOverview && this.blockGraph && this.strippedTransactions && this.overviewTransitionDirection) {
 | 
					 | 
				
			||||||
        this.isLoadingOverview = false;
 | 
					 | 
				
			||||||
        this.blockGraph.replace(this.strippedTransactions, this.overviewTransitionDirection, false);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    (error) => {
 | 
					    (error) => {
 | 
				
			||||||
      this.error = error;
 | 
					      this.error = error;
 | 
				
			||||||
@ -226,18 +217,19 @@ export class BlockComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
      ),
 | 
					      ),
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    .subscribe(({transactions, direction}: {transactions: TransactionStripped[], direction: string}) => {
 | 
					    .subscribe(({transactions, direction}: {transactions: TransactionStripped[], direction: string}) => {
 | 
				
			||||||
      this.isAwaitingOverview = false;
 | 
					 | 
				
			||||||
      this.strippedTransactions = transactions;
 | 
					      this.strippedTransactions = transactions;
 | 
				
			||||||
      this.overviewTransitionDirection = direction;
 | 
					      this.isLoadingOverview = false;
 | 
				
			||||||
      if (!this.isLoadingTransactions && this.blockGraph) {
 | 
					      if (this.blockGraph) {
 | 
				
			||||||
        this.isLoadingOverview = false;
 | 
					        this.blockGraph.destroy();
 | 
				
			||||||
        this.blockGraph.replace(this.strippedTransactions, this.overviewTransitionDirection, false);
 | 
					        this.blockGraph.setup(this.strippedTransactions);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    (error) => {
 | 
					    (error) => {
 | 
				
			||||||
      this.error = error;
 | 
					      this.error = error;
 | 
				
			||||||
      this.isLoadingOverview = false;
 | 
					      this.isLoadingOverview = false;
 | 
				
			||||||
      this.isAwaitingOverview = false;
 | 
					      if (this.blockGraph) {
 | 
				
			||||||
 | 
					        this.blockGraph.destroy();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.networkChangedSubscription = this.stateService.networkChanged$
 | 
					    this.networkChangedSubscription = this.stateService.networkChanged$
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user