entry edit, fix menu touch

This commit is contained in:
2021-11-21 16:43:36 +01:00
parent 2bd1e7a9d1
commit 185f28e262
18 changed files with 344 additions and 68 deletions
+13 -9
View File
@@ -1,4 +1,4 @@
import { Component, HostListener } from '@angular/core';
import { Component, HostListener, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { DomSanitizer } from '@angular/platform-browser';
import { MatIconRegistry } from '@angular/material/icon';
@@ -9,6 +9,7 @@ import { AuthService } from '../../services/auth.service';
import { UserService } from '../../services/user.service';
import { I18nService } from '../../services/i18n.service';
import { SettingsService } from '../../services/settings.service';
import { MatSidenav } from '@angular/material/sidenav';
@Component({
selector: 'ui-main',
@@ -16,7 +17,8 @@ import { SettingsService } from '../../services/settings.service';
styleUrls: [ './main.ui.scss' ]
})
export class UiMain {
opened = true;
opened: boolean = true;
darkTheme: boolean = false;
title = 'bstlboard';
currentLocale: String;
@@ -143,7 +145,6 @@ export class UiMain {
fromEvent(document, 'touchstart').subscribe((event: TouchEvent) => {
if (event.touches[ 0 ]) {
this.touchStartX = event.touches[ 0 ].screenX;
}
})
@@ -154,12 +155,15 @@ export class UiMain {
})
fromEvent(document, 'touchend').subscribe((event: TouchEvent) => {
const touchDiff = this.touchStartX - this.touchX;
if (touchDiff < 0 && touchDiff < (this.touchThresh * -1) && !this.opened) {
this.opened = true;
} else if (touchDiff > 0 && touchDiff > this.touchThresh && this.opened) {
this.opened = false;
if (this.touchX != 0) {
const touchDiff = this.touchStartX - this.touchX;
this.touchStartX = 0;
this.touchX = 0;
if (touchDiff < 0 && touchDiff < (this.touchThresh * -1) && !this.opened) {
this.opened = true;
} else if (touchDiff > 0 && touchDiff > this.touchThresh && this.opened) {
this.opened = false;
}
}
})
}