Skip to content

Commit

Permalink
Refactor on 162d199
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Oct 5, 2023
1 parent bdecfee commit bf9d72a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/app/components/image/image.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.p-image-preview-container {
position: relative;
display: inline-block;
line-height: 0;
}

.p-image-preview-indicator {
Expand All @@ -18,6 +19,7 @@
height: 100%;
outline: none;
border: none;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
Expand Down
6 changes: 1 addition & 5 deletions src/app/components/image/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { FocusTrapModule } from 'primeng/focustrap';
template: `
<span [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style">
<img [attr.src]="src" [attr.srcset]="srcSet" [attr.sizes]="sizes" [attr.alt]="alt" [attr.width]="width" [attr.height]="height" [ngStyle]="imageStyle" [class]="imageClass" (error)="imageError($event)" />
<button type="button" class="p-image-preview-indicator" (click)="onImageClick()" #previewButton [ngStyle]="{'height': imgHeight, 'width': width + 'px'}" style="border: 'none';">
<button type="button" class="p-image-preview-indicator" (click)="onImageClick()" #previewButton [ngStyle]="{'height': height + 'px', 'width': width + 'px'}" style="border: 'none';">
<ng-container *ngIf="indicatorTemplate; else defaultTemplate">
<ng-container *ngTemplateOutlet="indicatorTemplate"></ng-container>
</ng-container>
Expand Down Expand Up @@ -230,10 +230,6 @@ export class Image implements AfterContentInit {
min: 0.5
};

get imgHeight() {
return this.document && this.document.defaultView ? getComputedStyle(DomHandler.findSingle(this.el.nativeElement, 'img'))['height'] : '100%';
}

constructor(@Inject(DOCUMENT) private document: Document, private config: PrimeNGConfig, private cd: ChangeDetectorRef, public el: ElementRef) {}

ngAfterContentInit() {
Expand Down

1 comment on commit bf9d72a

@vercel
Copy link

@vercel vercel bot commented on bf9d72a Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.