1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

fixing Edge scrolling bug

This commit is contained in:
Patrik J. Braun 2018-05-09 13:37:21 -04:00
parent aafe44b4d2
commit 44cde498ea
3 changed files with 11 additions and 12 deletions

View File

@ -45,6 +45,8 @@ export class GalleryComponent implements OnInit, OnDestroy {
private _navigation: NavigationService) { private _navigation: NavigationService) {
this.mapEnabled = Config.Client.Map.enabled; this.mapEnabled = Config.Client.Map.enabled;
document.getElementsByTagName('body')[0].style.overflowY = 'scroll';
} }
updateTimer(t: number) { updateTimer(t: number) {
@ -129,7 +131,7 @@ export class GalleryComponent implements OnInit, OnDestroy {
await this.shareService.wait(); await this.shareService.wait();
if (!this._authService.isAuthenticated() && if (!this._authService.isAuthenticated() &&
(!this.shareService.isSharing() || (!this.shareService.isSharing() ||
(this.shareService.isSharing() && Config.Client.Sharing.passwordProtected == true))) { (this.shareService.isSharing() && Config.Client.Sharing.passwordProtected === true))) {
return this._navigation.toLogin(); return this._navigation.toLogin();
} }

View File

@ -8,39 +8,35 @@ export class OverlayService {
private scrollWidth: number = null; private scrollWidth: number = null;
public showOverlay() { public showOverlay() {
// disable scrolling
//disable scrolling
document.getElementsByTagName('body')[0].style.overflowY = 'hidden'; document.getElementsByTagName('body')[0].style.overflowY = 'hidden';
this.OnOverlayChange.trigger(true); this.OnOverlayChange.trigger(true);
} }
public hideOverlay() { public hideOverlay() {
document.getElementsByTagName('body')[0].style.overflowY = 'scroll'; document.getElementsByTagName('body')[0].style.overflowY = 'scroll';
this.OnOverlayChange.trigger(false); this.OnOverlayChange.trigger(false);
} }
getScrollbarWidth() { getScrollbarWidth() {
if (this.scrollWidth == null) { if (this.scrollWidth == null) {
const outer = document.createElement('div');
let outer = document.createElement('div');
outer.style.visibility = 'hidden'; outer.style.visibility = 'hidden';
outer.style.width = '100px'; outer.style.width = '100px';
outer.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps outer.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps
document.body.appendChild(outer); document.body.appendChild(outer);
let widthNoScroll = outer.offsetWidth; const widthNoScroll = outer.offsetWidth;
// force scrollbars // force scrollbars
outer.style.overflowY = 'scroll'; outer.style.overflowY = 'scroll';
// add innerdiv // add innerdiv
let inner = document.createElement('div'); const inner = document.createElement('div');
inner.style.width = '100%'; inner.style.width = '100%';
outer.appendChild(inner); outer.appendChild(inner);
let widthWithScroll = inner.offsetWidth; const widthWithScroll = inner.offsetWidth;
// remove divs // remove divs
outer.parentNode.removeChild(outer); outer.parentNode.removeChild(outer);
@ -51,7 +47,7 @@ export class OverlayService {
} }
getPhantomScrollbarWidth() { getPhantomScrollbarWidth() {
if (document.getElementsByTagName('body')[0].style.overflowY == 'hidden') { if (document.getElementsByTagName('body')[0].style.overflowY === 'hidden') {
return this.getScrollbarWidth(); return this.getScrollbarWidth();
} }
return 0; return 0;

View File

@ -91,7 +91,8 @@
"radix": true, "radix": true,
"semicolon": [ "semicolon": [
true, true,
"always" "always",
"ignore-bound-class-methods"
], ],
"triple-equals": [ "triple-equals": [
true, true,