From 0ceddd2662d79ceb51ca9f5b30304e36f97fbc36 Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Tue, 26 Feb 2019 15:30:16 +0100 Subject: [PATCH] Add swipe gestures into motion detail Adds swipe gestures into motion detail, to nacigate them easily on mobile devices Animations are left out for now, since they are complex to develop. Alters the navigation gesture slightly to only work from the edge of a given screen --- client/src/app/base.component.ts | 10 +++++ client/src/app/site/base/base-view.ts | 6 +++ client/src/app/site/base/list-view-base.ts | 4 +- .../motion-detail.component.html | 4 +- .../motion-detail/motion-detail.component.ts | 42 ++++++++++++++++--- client/src/app/site/site.component.html | 8 +++- client/src/app/site/site.component.ts | 37 ++++++++-------- 7 files changed, 84 insertions(+), 27 deletions(-) diff --git a/client/src/app/base.component.ts b/client/src/app/base.component.ts index e28c3ed02..0998064f4 100644 --- a/client/src/app/base.component.ts +++ b/client/src/app/base.component.ts @@ -17,6 +17,16 @@ export abstract class BaseComponent { */ private titleSuffix = ' - OpenSlides'; + /** + * Holds the coordinates where a swipe gesture was used + */ + protected swipeCoord?: [number, number]; + + /** + * Holds the time when the user was swiping + */ + protected swipeTime?: number; + /** * Settings for the TinyMCE editor selector */ diff --git a/client/src/app/site/base/base-view.ts b/client/src/app/site/base/base-view.ts index d355e8e20..ada149a9c 100644 --- a/client/src/app/site/base/base-view.ts +++ b/client/src/app/site/base/base-view.ts @@ -64,6 +64,12 @@ export abstract class BaseViewComponent extends BaseComponent implements OnDestr } } + /** + * To catch swipe gestures. + * Should be overwritten by children which need swipe gestures + */ + protected swipe(e: TouchEvent, when: string): void {} + /** * automatically dismisses the error snack bar and clears subscriptions * if the component is destroyed. diff --git a/client/src/app/site/base/list-view-base.ts b/client/src/app/site/base/list-view-base.ts index 096ea0a0e..5a89e5b5f 100644 --- a/client/src/app/site/base/list-view-base.ts +++ b/client/src/app/site/base/list-view-base.ts @@ -60,7 +60,9 @@ export abstract class ListViewBaseComponent -
+