@absolutejs/beacon 0.6.21 → 0.6.22

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.
package/dist/index.js CHANGED
@@ -683,6 +683,7 @@ var createBeacon = (options) => {
683
683
  const MEDIA_STALL_DEFAULT_MS = 1e4;
684
684
  const THRASHED_CURSOR_DEFAULT_REVERSALS = 8;
685
685
  const THRASHED_CURSOR_WINDOW_MS = 2000;
686
+ const THRASHED_CURSOR_REVERSAL_COSINE = -0.5;
686
687
  const NAVIGATION_RESPONSE_DEFAULT_MS = 8000;
687
688
  const LAYOUT_OVERFLOW_SETTLE_DEFAULT_MS = 600;
688
689
  const LAYOUT_OVERFLOW_MAX_REPORTS_DEFAULT = 5;
@@ -2907,7 +2908,9 @@ var createBeacon = (options) => {
2907
2908
  for (let index = 1;index < points.length; index += 1) {
2908
2909
  const prior = points[index - 1];
2909
2910
  const current = points[index];
2910
- if (prior.dx * current.dx < 0 || prior.dy * current.dy < 0)
2911
+ const dot = prior.dx * current.dx + prior.dy * current.dy;
2912
+ const magnitudeProduct = Math.hypot(prior.dx, prior.dy) * Math.hypot(current.dx, current.dy);
2913
+ if (dot / magnitudeProduct <= THRASHED_CURSOR_REVERSAL_COSINE)
2911
2914
  reversals += 1;
2912
2915
  }
2913
2916
  if (reversals < reversalThreshold)
@@ -3826,5 +3829,5 @@ export {
3826
3829
  BEACON_ATTRIBUTE
3827
3830
  };
3828
3831
 
3829
- //# debugId=031AAABEB97215B864756E2164756E21
3832
+ //# debugId=757A87482E13AD7364756E2164756E21
3830
3833
  //# sourceMappingURL=index.js.map