[ADF-5377] Viewer: Image Crop (#6977)

* changed dependency

* Update lib/core/viewer/components/img-viewer.component.ts

Co-authored-by: Denys Vuika <denys.vuika@alfresco.com>

Co-authored-by: Denys Vuika <denys.vuika@alfresco.com>
This commit is contained in:
Urse Daniel
2021-05-06 17:21:15 +03:00
committed by GitHub
parent aa5cbea7f5
commit f5c29a5ec8
4 changed files with 48 additions and 1 deletions

View File

@@ -89,6 +89,7 @@ export class ImgViewerComponent implements AfterViewInit, OnChanges {
dragMode: 'move',
background: false,
scalable: true,
modal: false,
zoomOnWheel: false,
toggleDragModeOnDblclick: false,
viewMode: 1,
@@ -175,16 +176,26 @@ export class ImgViewerComponent implements AfterViewInit, OnChanges {
this.cropper.rotate( -90);
}
cropImage() {
this.isEditing = true;
this.cropper.setDragMode('crop');
this.cropper.crop();
}
save() {
this.isEditing = false;
this.cropper.setDragMode('move');
this.cropper.getCroppedCanvas().toBlob((blob) => {
this.submit.emit(blob);
this.cropper.clear();
});
}
reset() {
this.isEditing = false;
this.cropper.clear();
this.cropper.reset();
this.cropper.setDragMode('move');
this.scale = 1.0;
this.cropper.zoomTo(this.scale);
}