only allow zoom by mouse wheel or selection when time axis is available

This commit is contained in:
2019-12-27 19:16:21 +01:00
parent 4f5fe15ac7
commit 90244c6e4b
3 changed files with 41 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { DataType, AxesTypes } from '../plot.service';
@Component({
selector: 'pdb-plot-view',
@@ -16,6 +17,8 @@ export class PlotViewComponent implements OnInit {
imageUrl : string;
axes: AxesTypes;
@Output()
zoomRange : EventEmitter<SelectionRange> = new EventEmitter<SelectionRange>();
@@ -89,7 +92,7 @@ export class PlotViewComponent implements OnInit {
//console.log("dragStart inPlot: " + this.isInPlot(event));
event.preventDefault();
if (event.buttons == 1 && this.isInPlot(event)) {
if (event.buttons == 1 && this.isInPlot(event) && this.axes.hasXAxis(DataType.Time)) {
const pos = this.positionInImage(event);
this.in_drag_mode = true;
this.drag_start_x = pos.x;
@@ -157,7 +160,7 @@ export class PlotViewComponent implements OnInit {
}
zoomByScroll(event) {
if (this.isInImage(event) && event.deltaY != 0) {
if (this.isInImage(event) && event.deltaY != 0 && this.axes.hasXAxis(DataType.Time)) {
this.in_drag_mode = false;
this.hideZoomInSlider();