image viewer is modified
This commit is contained in:
parent
542aa0433c
commit
cc2087a466
@ -26,6 +26,7 @@
|
|||||||
matTooltip="{{ 'common.messages.zoomReset' | translate }}"
|
matTooltip="{{ 'common.messages.zoomReset' | translate }}"
|
||||||
matTooltipPosition="below"
|
matTooltipPosition="below"
|
||||||
aria-label=""
|
aria-label=""
|
||||||
|
(click)="onClickZoomReset()"
|
||||||
>
|
>
|
||||||
<!--<mat-icon>settings_overscan</mat-icon>-->
|
<!--<mat-icon>settings_overscan</mat-icon>-->
|
||||||
|
|
||||||
@ -51,6 +52,7 @@
|
|||||||
matTooltip="{{ 'common.messages.zoomOut' | translate }}"
|
matTooltip="{{ 'common.messages.zoomOut' | translate }}"
|
||||||
matTooltipPosition="below"
|
matTooltipPosition="below"
|
||||||
aria-label=""
|
aria-label=""
|
||||||
|
(click)="onClickZoomOut()"
|
||||||
>
|
>
|
||||||
<!--<mat-icon>zoom_out</mat-icon>-->
|
<!--<mat-icon>zoom_out</mat-icon>-->
|
||||||
<svg
|
<svg
|
||||||
@ -75,6 +77,7 @@
|
|||||||
matTooltip="{{ 'common.messages.zoomIn' | translate }}"
|
matTooltip="{{ 'common.messages.zoomIn' | translate }}"
|
||||||
matTooltipPosition="below"
|
matTooltipPosition="below"
|
||||||
aria-label=""
|
aria-label=""
|
||||||
|
(click)="onClickZoomIn()"
|
||||||
>
|
>
|
||||||
<!--<mat-icon>zoom_in</mat-icon>-->
|
<!--<mat-icon>zoom_in</mat-icon>-->
|
||||||
<svg
|
<svg
|
||||||
@ -162,7 +165,14 @@
|
|||||||
fxFlexFill
|
fxFlexFill
|
||||||
fxLayoutAlign="center center"
|
fxLayoutAlign="center center"
|
||||||
>
|
>
|
||||||
<img *ngIf="fileDownloadUrl" [src]="fileDownloadUrl" />
|
<img
|
||||||
|
#downloadImage
|
||||||
|
*ngIf="fileDownloadUrl"
|
||||||
|
[src]="fileDownloadUrl"
|
||||||
|
[style.width]="(zoomRatio / 100) * naturalWidth + 'px'"
|
||||||
|
[style.height]="'auto'"
|
||||||
|
(load)="onLoadFileDownloadUrl(downloadImage)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -39,11 +39,15 @@
|
|||||||
height: calc(100% - 60px);
|
height: calc(100% - 60px);
|
||||||
|
|
||||||
.ucap-image-viewer-image-wrapper {
|
.ucap-image-viewer-image-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 20px;
|
|
||||||
background-color: rgba(0, 0, 0, 0.7);
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
height: inherit;
|
position: absolute;
|
||||||
|
max-width: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
OnInit,
|
||||||
|
Input,
|
||||||
|
Output,
|
||||||
|
EventEmitter,
|
||||||
|
ElementRef,
|
||||||
|
ViewChild
|
||||||
|
} from '@angular/core';
|
||||||
import { ucapAnimations } from '../../animations';
|
import { ucapAnimations } from '../../animations';
|
||||||
import { FileEventJson } from '@ucap-webmessenger/protocol-event';
|
import { FileEventJson } from '@ucap-webmessenger/protocol-event';
|
||||||
import { FileDownloadItem } from '@ucap-webmessenger/api';
|
import { FileDownloadItem } from '@ucap-webmessenger/api';
|
||||||
@ -24,9 +32,17 @@ export class ImageViewerComponent implements OnInit {
|
|||||||
|
|
||||||
fileDownloadItem: FileDownloadItem;
|
fileDownloadItem: FileDownloadItem;
|
||||||
|
|
||||||
|
naturalWidth = 0;
|
||||||
|
naturalHeight = 0;
|
||||||
|
|
||||||
|
zoomRatio = 100;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
ngOnInit() {}
|
ngOnInit() {
|
||||||
|
this.naturalWidth = this.fileInfo.imageWidth;
|
||||||
|
this.naturalHeight = this.fileInfo.imageHeight;
|
||||||
|
}
|
||||||
|
|
||||||
onClickDownload(): void {
|
onClickDownload(): void {
|
||||||
this.fileDownloadItem = new FileDownloadItem();
|
this.fileDownloadItem = new FileDownloadItem();
|
||||||
@ -36,4 +52,26 @@ export class ImageViewerComponent implements OnInit {
|
|||||||
onClickClose(): void {
|
onClickClose(): void {
|
||||||
this.closed.emit();
|
this.closed.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLoadFileDownloadUrl(img: HTMLImageElement) {
|
||||||
|
console.log('onLoadFileDownloadUrl', img.naturalWidth, img.naturalHeight);
|
||||||
|
this.naturalWidth = img.naturalWidth;
|
||||||
|
this.naturalHeight = img.naturalHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
onClickZoomOut() {
|
||||||
|
if (60 >= this.zoomRatio) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.zoomRatio -= 10;
|
||||||
|
}
|
||||||
|
onClickZoomIn() {
|
||||||
|
if (180 <= this.zoomRatio) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.zoomRatio += 10;
|
||||||
|
}
|
||||||
|
onClickZoomReset() {
|
||||||
|
this.zoomRatio = 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user