Skip to content

Commit

Permalink
fix(ImagePreview): 图片预览组件移动端无法移动图片, 导致图片放大后图片显示不完整 (#180)
Browse files Browse the repository at this point in the history
Co-authored-by: Simplelegant <466033631@qq.com>
  • Loading branch information
futianyun and Simplelegant authored Feb 14, 2022
1 parent 7433802 commit 6becbb8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions devui/image-preview/image-preview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ export class DImagePreviewComponent implements OnInit, OnDestroy {
}
}

@HostListener('touchstart', ['$event'])
touchstart($event) {
$event['clientX'] = $event.changedTouches[0].clientX;
$event['clientY'] = $event.changedTouches[0].clientY;
this.transformableImageElementRef.mouseDown($event);
}

@HostListener('touchmove', ['$event'])
touchmove($event) {
$event['clientX'] = $event.changedTouches[0].clientX;
$event['clientY'] = $event.changedTouches[0].clientY;
this.transformableImageElementRef.mouseMove($event);
}

@HostListener('touchend', ['$event'])
touchend($event) {
this.transformableImageElementRef.mouseDown($event);
}

@HostListener('window:keydown.ArrowLeft', [])
arrowLeft() {
this.pre();
Expand Down

0 comments on commit 6becbb8

Please sign in to comment.