Skip to content

Commit

Permalink
Fixes #246 and #228
Browse files Browse the repository at this point in the history
  • Loading branch information
Mawi137 committed Jan 15, 2020
1 parent 5c0d2db commit 90b7ef3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion projects/ngx-image-cropper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-image-cropper",
"version": "2.1.0",
"version": "2.1.1",
"description": "An image cropper for Angular",
"author": "Martijn Willekens",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<img
#sourceImage
class="source-image"
*ngIf="safeImgDataUrl"
[src]="safeImgDataUrl"
[style.visibility]="imageVisible ? 'visible' : 'hidden'"
(load)="imageLoadedInView()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class ImageCropperComponent implements OnChanges, OnInit {
marginLeft: SafeStyle | string = '0px';
imageVisible = false;

@ViewChild('sourceImage', {static: true}) sourceImage: ElementRef;
@ViewChild('sourceImage', {static: false}) sourceImage: ElementRef;

@Input()
set imageChangedEvent(event: any) {
Expand Down Expand Up @@ -817,10 +817,10 @@ export class ImageCropperComponent implements OnChanges, OnInit {
}

private getClientX(event: any): number {
return event.touches && event.touches[0] && event.touches[0].clientX || event.clientX;
return (event.touches && event.touches[0] ? event.touches[0].clientX : event.clientX) || 0;
}

private getClientY(event: any): number {
return event.touches && event.touches[0] && event.touches[0].clientY || event.clientY;
return (event.touches && event.touches[0] ? event.touches[0].clientY : event.clientY) || 0;
}
}

0 comments on commit 90b7ef3

Please sign in to comment.