Skip to content

Commit

Permalink
added bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
parth181195 committed Oct 26, 2024
1 parent cf53457 commit d2c866d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
<div class="canvas-wrap">
@if (isBrowser && config.alignment) {
<canvas #canvas [height]="wrapper.clientHeight*2" [width]="wrapper.clientWidth*2"></canvas>
<canvas #canvas [height]="canvasHeight" [width]="canvasWidth"></canvas>
}
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/app/components/logo-wrapper/logo-wrapper.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {GdgInlineComponent} from "../logos/gdg-inline/gdg-inline.component";
export class LogoWrapperComponent implements AfterViewInit {
@ViewChild('canvas') canvas: ElementRef<HTMLCanvasElement>;
@ViewChild('wrapper') wrapper: ElementRef<HTMLDivElement>;
canvasHeight = 0;
canvasWidth = 0;
context: CanvasRenderingContext2D;
config: ConfigType & any = {}
protected readonly Communities = Communities;
Expand All @@ -33,6 +35,7 @@ export class LogoWrapperComponent implements AfterViewInit {
this.isBrowser = isPlatformBrowser(platformId);
this.configService.getConfig.subscribe(change => {
this.config = change;
console.log(change)
setTimeout(_ => {
this.drawImage()
}, 1000)
Expand All @@ -43,10 +46,12 @@ export class LogoWrapperComponent implements AfterViewInit {
}



onConfigChange(node: ElementRef) {
if (!node) return;
this.nodeRef = node;
this.canvasHeight = node.nativeElement.height.baseVal.value
this.canvasWidth = node.nativeElement.width.baseVal.value;

}

drawImage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</style>
</defs>
<g id="Layer_1-2" data-name="Layer_1">
<path d="M0 0h269.2v44H0V0Z" [attr.fill]="config|color:'bg'" style="stroke-width: 0"/>
<text text-anchor="middle"
style="font-family:GoogleSansDisplay-Regular,&quot;Google Sans Display&quot;;font-size:17.24px"
y="40" x="47.5">
Expand Down

0 comments on commit d2c866d

Please sign in to comment.