mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
WIP on ACS-8602-The-tabs-names-in-window-are-not-match-in-the-design
ACS-24317 fix src double call
This commit is contained in:
committed by
Darya Blavanovich
parent
4609a53a99
commit
36a6b0e568
@@ -81,46 +81,7 @@ export class ImgViewerComponent implements AfterViewInit, OnChanges, OnDestroy {
|
||||
isSaving = new EventEmitter<boolean>();
|
||||
|
||||
@ViewChild('image', { static: false })
|
||||
public imageElement: ElementRef;
|
||||
|
||||
public scale: number = 1.0;
|
||||
public cropper: Cropper;
|
||||
public isEditing: boolean = false;
|
||||
|
||||
get currentScaleText(): string {
|
||||
return Math.round(this.scale * 100) + '%';
|
||||
}
|
||||
|
||||
constructor(private appConfigService: AppConfigService, private urlService: UrlService) {
|
||||
this.initializeScaling();
|
||||
}
|
||||
|
||||
initializeScaling() {
|
||||
const scaling = this.appConfigService.get<number>('adf-viewer-render.image-viewer-scaling', undefined) / 100;
|
||||
if (scaling) {
|
||||
this.scale = scaling;
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.cropper = new Cropper(this.imageElement.nativeElement, {
|
||||
autoCrop: false,
|
||||
dragMode: 'move',
|
||||
background: false,
|
||||
scalable: true,
|
||||
zoomOnWheel: true,
|
||||
toggleDragModeOnDblclick: false,
|
||||
viewMode: 1,
|
||||
checkCrossOrigin: false,
|
||||
ready: () => {
|
||||
this.updateCanvasContainer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.cropper.destroy();
|
||||
}
|
||||
imageElement: ElementRef;
|
||||
|
||||
@HostListener('document:keydown', ['$event'])
|
||||
onKeyDown(event: KeyboardEvent) {
|
||||
@@ -161,6 +122,18 @@ export class ImgViewerComponent implements AfterViewInit, OnChanges, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
scale: number = 1.0;
|
||||
cropper: Cropper;
|
||||
isEditing: boolean = false;
|
||||
|
||||
get currentScaleText(): string {
|
||||
return Math.round(this.scale * 100) + '%';
|
||||
}
|
||||
|
||||
constructor(private appConfigService: AppConfigService, private urlService: UrlService) {
|
||||
this.initializeScaling();
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
const blobFile = changes['blobFile'];
|
||||
if (blobFile?.currentValue) {
|
||||
@@ -179,6 +152,34 @@ export class ImgViewerComponent implements AfterViewInit, OnChanges, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.cropper = new Cropper(this.imageElement.nativeElement, {
|
||||
autoCrop: false,
|
||||
checkOrientation: false,
|
||||
dragMode: 'move',
|
||||
background: false,
|
||||
scalable: true,
|
||||
zoomOnWheel: true,
|
||||
toggleDragModeOnDblclick: false,
|
||||
viewMode: 1,
|
||||
checkCrossOrigin: false,
|
||||
ready: () => {
|
||||
this.updateCanvasContainer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.cropper.destroy();
|
||||
}
|
||||
|
||||
initializeScaling() {
|
||||
const scaling = this.appConfigService.get<number>('adf-viewer-render.image-viewer-scaling', undefined) / 100;
|
||||
if (scaling) {
|
||||
this.scale = scaling;
|
||||
}
|
||||
}
|
||||
|
||||
zoomIn() {
|
||||
this.cropper.zoom(0.2);
|
||||
this.scale = +(this.scale + 0.2).toFixed(1);
|
||||
|
Reference in New Issue
Block a user