multiblock padding

This commit is contained in:
Mononaut 2024-09-23 23:35:30 +00:00
parent 17db3d9004
commit d2b918cf15
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
4 changed files with 10 additions and 7 deletions

View File

@ -74,6 +74,7 @@ export class BlockOverviewMultiComponent implements AfterViewInit, OnDestroy, On
displayWidth: number;
displayHeight: number;
displayBlockWidth: number;
displayPadding: number;
cssWidth: number;
cssHeight: number;
shaderProgram: WebGLProgram;
@ -388,16 +389,17 @@ export class BlockOverviewMultiComponent implements AfterViewInit, OnDestroy, On
this.displayWidth = window.devicePixelRatio * this.cssWidth;
this.displayHeight = window.devicePixelRatio * this.cssHeight;
this.displayBlockWidth = window.devicePixelRatio * this.blockWidth;
this.displayPadding = window.devicePixelRatio * this.padding;
this.canvas.nativeElement.width = this.displayWidth;
this.canvas.nativeElement.height = this.displayHeight;
if (this.gl) {
this.gl.viewport(0, 0, this.displayWidth, this.displayHeight);
}
for (let i = 0; i < this.scenes.length; i++) {
const blocksPerRow = Math.floor((this.displayWidth + this.padding) / (this.displayBlockWidth + this.padding));
const x = (i % blocksPerRow) * (this.displayBlockWidth + this.padding);
const blocksPerRow = Math.floor(this.displayWidth / (this.displayBlockWidth + (this.displayPadding * 2)));
const x = this.displayPadding + ((i % blocksPerRow) * (this.displayBlockWidth + (this.displayPadding * 2)));
const row = Math.floor(i / blocksPerRow);
const y = this.displayHeight - ((row + 1) * this.displayBlockWidth);
const y = this.displayPadding + this.displayHeight - ((row + 1) * (this.displayBlockWidth + (this.displayPadding * 2)));
if (this.scenes[i]) {
this.scenes[i].resize({ x, y, width: this.displayBlockWidth, height: this.displayBlockWidth, animate: false });
this.start();

View File

@ -3,6 +3,7 @@
#blockGraph
[isLoading]="false"
[numBlocks]="numBlocks"
[padding]="padding"
[blockWidth]="blockWidth"
[resolution]="resolution"
[blockLimit]="stateService.blockVSize"

View File

@ -83,7 +83,7 @@ export class EightBlocksComponent implements OnInit, OnDestroy {
width: '1080px',
height: '1080px',
maxWidth: '1080px',
padding: '',
margin: '',
};
containerStyle = {};
resolution: number = 86;
@ -128,7 +128,7 @@ export class EightBlocksComponent implements OnInit, OnDestroy {
width: this.blockWidth + 'px',
height: this.blockWidth + 'px',
maxWidth: this.blockWidth + 'px',
padding: (this.padding || 0) +'px 0px',
margin: (this.padding || 0) +'px ',
};
this.cacheBlocksSubscription = this.cacheService.loadedBlocks$.subscribe((block: BlockExtended) => {

View File

@ -85,7 +85,7 @@ export class EightMempoolComponent implements OnInit, OnDestroy {
width: '1080px',
height: '1080px',
maxWidth: '1080px',
padding: '',
margin: '',
};
containerStyle = {};
resolution: number = 86;
@ -177,7 +177,7 @@ export class EightMempoolComponent implements OnInit, OnDestroy {
width: this.blockWidth + 'px',
height: this.blockWidth + 'px',
maxWidth: this.blockWidth + 'px',
padding: (this.padding || 0) +'px 0px',
margin: (this.padding || 0) +'px ',
};
this.websocketService.startTrackMempoolBlocks(this.blockIndices);