jpilfold / ngx-image-viewer

An image viewer component for Angular 2+
MIT License
49 stars 54 forks source link

Issue when pressing escape key #38

Open HowardMed opened 5 years ago

HowardMed commented 5 years ago

Issues when we go from fullscreen to windowed mode by pressing the escape key on the keyboard, rather than fullscreen button present on the image-viewer. Because in your toggleFullscreen() method it just reverses the value of 'fullscreen' value. So when we press escape key in fullscreen mode, it takes us to windowed mode but the value of fullscreen value stays the same(since toggleFullscreen() wasn't invoked), and hence it takes 2 clicks on the fullscreen button to take to fullscreen again.

HowardMed commented 5 years ago

Escape key event is not fired in fullscreen mode. So gotta find some other way around. I personally used @HostListener('fullscreenchange', ['$event']) to fix the issue in my code.