diff src/app/waveform/waveform.component.ts @ 155:53ddfd792844

Prevent accidentally seeking after zooming on desktop.
author Lucas Thompson <dev@lucas.im>
date Tue, 21 Mar 2017 14:22:52 +0000
parents 0b1743589281
children 3f54066a0e01
line wrap: on
line diff
--- a/src/app/waveform/waveform.component.ts	Tue Mar 21 14:01:28 2017 +0000
+++ b/src/app/waveform/waveform.component.ts	Tue Mar 21 14:22:52 2017 +0000
@@ -55,6 +55,7 @@
   private offsetAtPanStart: number;
   private initialZoom: number;
   private initialDistance: number;
+  private zoomOnMouseDown: number;
 
   constructor(private audioService: AudioPlayerService,
               private piperService: FeatureExtractionService,
@@ -636,6 +637,16 @@
     this.seekedSubscription.unsubscribe();
   }
 
+  seekStart(): void {
+    this.zoomOnMouseDown = this.timeline.timeContext.zoom;
+  }
+
+  seekEnd(x: number): void {
+    if (this.zoomOnMouseDown === this.timeline.timeContext.zoom) {
+      this.seek(x);
+    }
+  }
+
   seek(x: number): void {
     if (this.timeline) {
       const timeContext: any = this.timeline.timeContext;