@kevinburke/flot 5.1.1 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,7 @@ import { trigger } from './helpers.js';
24
24
  }
25
25
 
26
26
  function initTouchNavigation(plot, options) {
27
+ /** @type {{ zoomEnable: boolean, prevDistance: number | null, prevTapTime: number, prevPanPosition: {x: number, y: number}, prevTapPosition: {x: number, y: number} }} */
27
28
  var gestureState = {
28
29
  zoomEnable: false,
29
30
  prevDistance: null,
@@ -31,6 +32,7 @@ import { trigger } from './helpers.js';
31
32
  prevPanPosition: { x: 0, y: 0 },
32
33
  prevTapPosition: { x: 0, y: 0 }
33
34
  },
35
+ /** @type {{ prevTouchedAxis: string, currentTouchedAxis: string, touchedAxis: any, navigationConstraint: string, initialState: any }} */
34
36
  navigationState = {
35
37
  prevTouchedAxis: 'none',
36
38
  currentTouchedAxis: 'none',
@@ -87,7 +89,7 @@ import { trigger } from './helpers.js';
87
89
  drag: function(e) {
88
90
  presetNavigationState(e, 'pan', gestureState);
89
91
 
90
- if (useSmartPan) {
92
+ if (useSmartPan && navigationState.initialState) {
91
93
  var point = getPoint(e, 'pan');
92
94
  plot.smartPan({
93
95
  x: navigationState.initialState.startPageX - point.x,
@@ -111,7 +113,7 @@ import { trigger } from './helpers.js';
111
113
  }
112
114
 
113
115
  if (wasPinchEvent(e, gestureState)) {
114
- updateprevPanPosition(e, 'pan', gestureState, navigationState);
116
+ updatePrevPanPosition(e, 'pan', gestureState, navigationState);
115
117
  }
116
118
  }
117
119
  };
@@ -143,7 +145,7 @@ import { trigger } from './helpers.js';
143
145
 
144
146
  var dist = pinchDistance(e);
145
147
 
146
- if (gestureState.zoomEnable || Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN) {
148
+ if (gestureState.zoomEnable || (gestureState.prevDistance != null && Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN)) {
147
149
  zoomPlot(plot, e, gestureState, navigationState);
148
150
 
149
151
  //activate zoom mode